Fail2ban is a popular firewall and security tool that protects your server from malicious attacks. It automatically detects questionable behavior from IP addresses sending requests to your server and blocks them using jail-rules. But sometimes you may find that it has blocked a friendly IP address, and you may want to unban it from your system. In this article, we will learn how to unban IP with Fail2ban.
How to Unban IP With Fail2ban
Here are the steps to unban IP with Fail2ban.
1. Find the right jail
Fail2ban organizes the banned IP addresses into various jails. The tricky part is to find the right jail for the banned IP address. Open terminal and run the following command to list all iptables rules.
$ iptables -L -n
Run the following command to get actual jail names.
$ fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'
Analyze the iptables rules and fail2ban jail names to identify the right combination of iptables rule and fail2ban jail name.
2. Unban IP address
Once you have figured out the right jail name, run the following command to unban that IP address from the jail. Replace JAILNAMEHERE with jail name of banned IP and IPADDRESSHERE with the IP address you want to unban.
Fail2ban < v0.8.8
$ fail2ban-client get JAILNAMEHERE actionunban IPADDRESSHERE
Fail2ban > v0.8.8
$ fail2ban-client set JAILNAMEHERE unbanip IPADDRESSHERE
That’s it. In this short article, we have learnt how unban IP address with Fail2ban.
Also read:
NGINX Allow Local Network
How to Prevent Direct Access to Images in NGINX
How to Prevent Direct Access to Images in Apache
How to Know Which Shell I am Using in Linux
How to Delete Objects in Django
Related posts:
How to Configure Access Control Lists (ACL) in Linux
How to Install Fonts in Ubuntu
How to Secure SSH Server on your System
How to Save Dictionary to File in Python
Sed Command to Delete Lines in Linux
How to Delete All Text in File Using Vi Editor
How to Add Repository in Ubuntu/Debian Linux
How to Get User Input in Shell Script

Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.