Welcome to our Knowledge Base

Fail2Ban Commands

Reading Time: 1 min

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.

root@debian:~# man fail2ban-client

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.

root@debian:~# fail2ban-client status asterisk

To unban an IP Address, run the following command.

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

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.

Was it helpful for you ?
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x