Documentation / Tutorials / Server

Remove ban from IPs banned by Fail2Ban

/ Server / Remove ban from IPs banned by Fail2Ban

Assuming you have secured your server using fail2ban, there comes a time when you may ban an IP wrongly. Here is how you can quickly check if that IP is banned and then un-ban it.

  1. fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status

    this command will give you a list of all the IPs banned by fail2ban and the Jail under which it has been banned.  if you the name of the jail you can check it using the following command as well.

    sudo fail2ban-client status wordpress2

    where wordpress2 is the name of the jail, as defined in jail.conf file.

  2. fail2ban-client set wordpress2 unbanip

    Once you have verified the IP, if it is banned you can use above command to remove the ban, wordpress2 is the name of the jail, while IP is the IP which is being removed from ban.

If you have static IPs then you can whitelist them so that they do not get banned, it can be done by setting ignoreip in jail.conf or jail.local file. Here is an example of it

ignoreip = =

You can see how a range of IPs or multiple IPs can be added. Afterwards, remember to restart the fail2ban server using

service fail2ban restart



Most Popular

Leave a Reply

Your email address will not be published.