# Fail2ban einrichten – SSH & Gameserver vor Brute-Force schützen

Fail2ban installieren & konfigurieren: SSH-Jails, Ban-Zeit, Whitelist – Schutz vor Brute-Force auf VPS und Root Server.

**Kurzantwort:** Fail2ban installierst du mit `apt install fail2ban` – der SSH-Jail ist auf Ubuntu/Debian meist sofort aktiv und sperrt Angreifer nach 5 Fehlversuchen automatisch.

**Wenn du hier landest:** Du siehst tausende Failed-Login-Versuche in den Logs oder willst SSH zusätzlich absichern.

## Installation

`apt update && apt install fail2ban -y
systemctl enable --now fail2ban
fail2ban-client status
fail2ban-client status sshd`
## Basis-Konfiguration

`cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local

# Unter [DEFAULT]:
bantime  = 1h
findtime = 10m
maxretry = 3

# Unter [sshd]:
enabled = true
port    = ssh
logpath = /var/log/auth.log

systemctl restart fail2ban`
## Eigene IP whitelisten

`# In jail.local [DEFAULT]:
ignoreip = 127.0.0.1/8 DEINE-HOME-IP`
## Gebannte IPs anzeigen

`fail2ban-client status sshd
fail2ban-client set sshd unbanip 1.2.3.4`
## Kombination mit SSH-Härtung

- [SSH absichern (Keys)](/de/root-v-server/ssh-absichern)
- [UFW Firewall](/de/root-v-server/firewall-ports)
- [VPS komplett einrichten](/de/root-v-server/vps-einrichten)
*Produkte & Bestellung: [Root/VPS Server](https://nexorahost.com/Dedicated-server) · Verwaltung: [panel.nexorahost.de](https://panel.nexorahost.de) · [Mein Konto](https://nexorahost.com/account) · [nexorahost.com](https://nexorahost.com) (Frankfurt · 1 Tbit/s DDoS · 99,9 % Uptime)*
