↑ ↓ select, Enter open, Esc close

Block a single IP address immediately with iptables

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
iptables -I INPUT -s 203.0.113.25 -j DROP

Inserts a rule at the top of the INPUT chain that drops all packets from the given IP. The block takes effect immediately and lasts until a reboot or until the firewall is reloaded. To remove it, use the same line with -D instead of -I.

Note: Never enter your own admin IP. For recurring attackers, Fail2Ban or the Plesk firewall is the permanent solution.

Open question before approval: Auf Plesk-Servern mit Firewall-Erweiterung prüfen, ob die Regel beim nächsten Anwenden der Plesk-Firewall verworfen wird und ob iptables-nft dort Standard ist.

Also searched as

  • how to block an ip with iptables
  • iptables drop ip address
  • block attacker ip linux

Related one-liners

All in Security

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.