$ sudo systemctl restart fail2ban $ sudo systemctl status fail2ban ● fail2ban.service - Fail2Ban Service Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2020-12-22 16:01:45 +08; 5s ago Docs: man:fail2ban(1) Process: 46536 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) Main PID: 46539 (f2b/server) Tasks: 5 (limit: 408286) Memory: 13.4M CGroup: /system.slice/fail2ban.service └─46539 /usr/bin/python3.6 -s /usr/bin/fail2ban-server -xf start
Dec 22 16:01:45 tiny-server systemd[1]: Starting Fail2Ban Service... Dec 22 16:01:45 tiny-server systemd[1]: Started Fail2Ban Service. Dec 22 16:01:45 tiny-server fail2ban-server[46539]: Server ready
# 测试是否正常运行 $ sudo fail2ban-client ping Server replied: pong
# 查看fail2ban状态 $ fail2ban-client status Status |- Number of jail: 1 `- Jail list: ssh-iptables $ fail2ban-client status ssh-iptables Status for the jail: ssh-iptables |- Filter | |- Currently failed: 0 | |- Total failed: 0 | `- File list: /var/log/secure `- Actions |- Currently banned: 0 |- Total banned: 0 `- Banned IP list:
# 查看iptables的禁用情况 sudo iptables --list -n
# 解禁一个特定IP fail2ban-client set ssh-iptables unbanip 192.168.1.8