Article 9.3 - fail2ban Automated IP Banning
Short answerInstall fail2ban, copy jail.local, enable sshd jail on your SSH port, start service, check bans with fail2ban-client status.
Overview
fail2ban watches logs and temporarily bans IPs after repeated failures. Use alongside — not instead of — firewall rules and SSH keys.
Install
apt install fail2ban -y
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.localRecommended jail.local excerpt
[DEFAULT]
bantime = 3600
findtime = 600
maxretry = 5
backend = systemd
[sshd]
enabled = true
port = 22
maxretry = 3
bantime = 86400Enable and verify
systemctl enable fail2ban --now
fail2ban-client status
fail2ban-client status sshd
fail2ban-client set sshd unbanip 203.0.113.10 # manual unban exampleMatch port to your SSH port. Deeper guide: How to Install Fail2Ban on Linux.
Frequently Asked Questions
Banned my own IP?
Unban via noVNC: fail2ban-client set sshd unbanip YOUR_IP or whitelist your office IP in jail.local.
Does fail2ban replace UFW?
No — use both. UFW controls which ports are open; fail2ban reacts to repeated auth failures.
Related Articles
Need More Help?
Search this knowledgebase for related guides. If the issue persists, open a ticket at billing.vpsgrid.net with your service ID, primary IP, and steps already tried. See What Information to Include in a Support Request and Security Responsibilities on Unmanaged VPS for scope and required details.
¿Le ha resultado útil esta respuesta?