Monday, January 11, 2010

Linux - Blocking IP addresses

Ever need to block an IP address from connection to you linux box?

This is quite easy and simple to acheive, with IPTABLES...

# sudo iptables -A INPUT -s 1.2.3.4 -j DROP

just modify the ip address to the one required.


Need to view what IP Addresses have been added to the system

# sudo iptables -L



Remove the blocked IP Address from the chain

# sudo iptables -D INPUT -s 1.2.3.4 -j DROP

No comments:

Post a Comment