Fail2Ban Commands

Sometimes you might get blocked by the Intrusion Detection system. This can be due to a device using the wrong password to register, and this blocks you out. Or, the wrong password is entered too many times through the Web UI. We recommend you whitelist your known IP addresses through the Firewall Whitelist. But in the case, you have been blocked and you have access to the Linux terminal, here are some commands for Fail2Ban that you can use to manage the intrusion detection system from a command line level.

To see the possible Fail2Ban commands, run the following command from the Linux Command Line.

To see the clients that have been banned due to too many failed attempts through SSH, run the following command.

root@debian:~# fail2ban-client status sshd

To see the clients that have been banned due to too many failed attempts to register through Asterisk, run the following command.

To unban an IP Address, run the following command.

Where {IP_ADDRESS} is the exact IP address to unban. Do not include the curly braces.

To ban an IP address, run the following command.

root@debian:~# fail2ban-client set sshd banip {IP_ADDRESS}

Where {IP_ADDRESS} is the exact IP address to ban. Do not include the curly braces.

To block an IP address using IPTables, run the following command.

root@debian:~# iptables -I INPUT 1 -s IPAddress -j DROP

To unblock an IP address using IPTables, run the following command.

root@debian:~# iptables -D INPUT -s IPAddress -j DROP

Using these commands you can manage the Intrusion Detection system directly through the Linux Command Line.

What are your feelings
Updated on December 18, 2023