Ban module overview
The Ban module allows administrators to ban visitors or requests to their site from individual IP addresses. The Ban module is disabled by default in the Standard profile. Once enabled, you may also need to clear Drupal's cache registry before it appears under the /admin/config/people path.
For more advanced features and sophisticated levels of IP based protection, it is also worth considering system installed alternatives such as fail2ban.
In Drupal 7, the Ban functionality is part of the System module in Drupal core, rather than being a separate module.
To ban an IP address
- Navigate to /admin/config/people/ban.
- Enter an IP address (for example, 10.0.0.1).
- Click Add.
Note Drupal will prevent you from banning your own IP address.
To remove the ban from an IP address
- Navigate to the ban page (see above).
- Beside an IP address, click Delete.
Remove a ban with Drush
These commands show all entries, removes the ban on a specific IP, and removes all bans using Drush.
drush sql:query "SELECT * from ban_ip;"
drush sql:query "DELETE FROM ban_ip WHERE ip='119.80.1.6';"
drush sql:query "TRUNCATE ban_ip;"Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion