Skip to content

How to block an IP address with iptables

Linux

FAQ · Linux · Help & Support

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).

Still have questions?

Our support team is happy to help - via ticket, email, or phone.