Ban was a core module from Drupal 8 to 11 and has moved to contrib for Drupal 12.
Ban allows administrators to ban visitors or requests to their site from individual IP addresses.
The Ban module is made to be extremely fast and lightweight, so that in cases of DDoS the Ban middleware intercepts fast and with little memory footprint.
Post-Installation
To ban an IP address
- Navigate to /admin/config/people/ban.
- Enter an IP address (for example, 10.0.0.1).
- Click Add.
Drupal will prevent you from banning your own IP address.
To remove the ban from an IP address in the UI
- Navigate to the ban page (see above).
- Beside an IP address, click Delete.
Ban Drush Commands
Available commands for the "ban" namespace:
ban:ban [ban-ban] Ban an IP address.
ban:flush [ban:unban-all|ban-flush|ban-unban-all] Unban all IP addresses.
ban:list [ban-list] List all banned IP addresses.
ban:unban [ban-unban] Unban a specific IP address.
ban:unban-all Unban all IP addresses.
Additional modules & libraries
- Perimeter module uses ban to block IPs that accessed configured URLs
- Crowdsec module uses ban to ban IPs by attack signals
- Autoban module allows automatizing IP ban using watchdog table by the module rules.
- For more advanced features and sophisticated levels of IP based protection, it is also worth considering system installed alternatives such as fail2ban
Alternative modules
- Advanced Ban is not built upon Ban and provides advanced features like banning IP-ranges, configuring the ban message etc. - please note that this comes at a cost of performance, especially in cases of DDoS - for details see #2972332: Introduce the ability to use CIDR Notation to ban IP-Ranges
Supporting organizations:
proudly helps to maintain this module for the Drupal community
Project information
- Project categories: Administration tools, Security
865 sites report using this module
- Created by drumm on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
1.1.0-beta2
released 2 April 2026
Works with Drupal: ^11.2 || ^12
Install:
Development version: 1.1.x-dev updated 2 Apr 2026 at 11:45 UTC



