Fail2ban Basic


How to install?

Debian/ Ubuntu
apt update -y && apt install fail2ban -y​


CentOS / Redhat

yum update && yum install fail2ban -y


Activated Jail list

fail2ban-client status


Actions under a jail

iptables -L -n


How to start / stop / restart

service fail2ban start 
service fail2ban stop
service fail2ban restart


How to ban/unban an IP?

fail2ban-client set JAILNAME banip IP_ADDRESS
fail2ban-client set JAILNAME unbanip IP_ADDRESS


Wants to Permanent Whitelist an IP?

nano /etc/fail2ban/jail.conf

Then fine the line called ignoreip= 127.0.0.1/8

There, you will just need to add the IP with space.

For example

ignoreip = 127.0.0.1/8 121.123.124.125

If you see # symbol infront of ignoreip, please remove that.
121.123.124.125 IP has been whitelisted in the above example

Did you find this article useful?



  • IPTables Firewall

    Existing Rules iptables -L -n Basic Rules iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables ...