
Useful commands to ban or unban an IP address from cli. For that we will use the fail2ban-client command.
Unban
Before unban an ip address, you have to find the jail where the ip address has been ban. To do that, first identify the iptables rule name:
$ iptables -L -n
Find the jail name:
$ fail2ban-client status
and unban the ip address : fail2ban-client set yourjailname unbanip 10.20.30.45
If you use an older version (before v0.8.8) : fail2ban-client get yourjailname actionunban 10.20.30.45
Ban
It is almost the same to ban an ip address: fail2ban-client set yourjailname banip 10.20.30.45
Reference
My Powershell script categories
- Active Directory
- Cluster
- Database
- Exchange
- Files and folders
- Hardware
- Network
- Operating System
- PKI
- SCCM
- Service and process
- Tips
- VMWare
Ban-Unban an IP address from cli with fail2ban