08. Nov 2026
1 min
IPTables is a useful tool for managing network traffic. To block an IP address, use iptables -A INPUT -s [IP_ADDRESS] -j DROP. To unblock it, use iptables -D INPUT -s [IP_ADDRESS] -j DROP.
To display the current rules, use iptables -L -n -v. Make sure to save the rules so they persist after a reboot. On Debian/Ubuntu, install sudo apt install iptables-persistent once and save the current rules with sudo netfilter-persistent save (they are stored in /etc/iptables/rules.v4).