Fail2ban How to Unban IP – Step by step

So how to unban IP with Fail2Ban?
Fail2ban is an application that will monitor your system logs and try to detect a certain type of attacks to your ServerLynx VPS.

Fail2ban can detect when an attempted compromise has been made, based on certain parameters. It will then add a new rule to iptables, blocking the IP address of the attacker. This block can either be temporary or permanent. Fail2ban can also alert you through email that an attack is occurring.

But sometimes, even Fail2ban can make a mistake and it will ban the IP that it shouldn’t and then you would want to unban it as quickly as possible, especially if its something important. Or sometimes you would have any other reasons you want to do that and then you wonder how to unban IP with Fail2ban.

Well, in this article, thats exactly what we will explore. Let’s dive into it.

Step 1 – Find the IP and its Jail

Today, we will use one of our VPS machines, in this case Advanced Lynx plan that you can buy here.

Fail2ban, depending on your configuration, will have one or multiple Jails. In our example, banned IPs that we want to unban are located in sshd jail. You can find the list of your jails by running this command(make sure to use sudo or run command as a root):

fail2ban-client status
fail2ban how to unban ip - list jails

As you can see, we have one jail. So all the banned IPs are in it.

Now we need to run the next command which will list us all the IPs that are banned inside of sshd jail:

fail2ban-client status sshd

Make sure to replace “sshd” with the name of your jail.

We want to unban

Step 2 – Unban the IP and confirm

Now to unban this IP run this:

fail2ban-client set sshd unbanip

Replace with the IP you want to unban.

fail2ban how to unban ip

The response should be 0, that would mean everything was done correctly and the IP is unbanned now. But lets also confirm it to make sure. Run the following command again(replace sshd with your jail):

fail2ban-client status sshd

Once you confirm that the IP is not listed in there anymore, your job is done.


Fail2ban is a great tool that can help you protect your server, but as every tool, sometimes it can make mistakes. Soon we will write more articles on Fail2ban with detailed explanations on how you can utilize it to protect your server the best way possible.

Luckily, Fail2ban is not very hard to understand and considering its simplicity, its worth learning more about it.
Security is an important part of every server, website and business, and Fail2ban really makes it very easy to implement some pretty good measures so you can rest assured your server is safe.

Until next time!

Similar Posts