Linux : How to block IP address with IPtables

By | November 22, 2010

Here is a quick how to block a specific IP address with the IPtables Linux firewall.

Open the IPtables script :

vi /etc/sysconfig/iptables

To block INBOUND IP address, add the following :

iptables -A INPUT -s 0.0.0.0 -j DROP

To block OUTBOUND IP address :

iptables -A OUTPUT -p tcp -d 0.0.0.0 -j DROP

(replace 0.0.0.0 with the IP you want to block)