Advertising sustains the DA. Ads are hidden for members. Join today

Ban module overview

Last updated on
26 February 2026

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

  1. Navigate to /admin/config/people/ban.
  2. Enter an IP address (for example, 10.0.0.1).
  3. Click Add.

Note Drupal will prevent you from banning your own IP address.

To remove the ban from an IP address

  1. Navigate to the ban page (see above).
  2. 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;"

Tags

Help improve this page

Page status: No known problems

You can: