Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 sudo fail2ban-client status sshd

This will display the list of currently banned IP addresses for that service.

Managing Banned IPs

Unban an IP Address
If a legitimate IP is banned by mistake, you can manually unban it:

Code Block
 sudo fail2ban-client unban <IP_ADDRESS>


Restart Then restart Fail2ban to apply the changes:

...

  1. Open the configuration file for the jail you want to modify (for example, SSH):

    Code Block
     sudo nano /etc/fail2ban/jail.local


  2. Find the jail configuration (e.g., [sshd]), and add the IPs you wish to whitelist under ignoreip. You can list multiple IPs separated by spaces:

    Code Block
     [sshd] ignoreip = 192.168.1.1 203.0.113.50


  3. Restart Finally, restart Fail2ban to apply the changes:

    Code Block
     sudo systemctl restart fail2ban


...

Code Block
ignoreip = 203.0.113.0/24

This command will whitelist all IPs in the range 203.0.113.0 to 203.0.113.255.

...