How to block IP address in Linux via ssh:


The following command will drop any packet coming from the IP address 1.2.3.4:

iptables -I INPUT -s 1.2.3.4 -j DROP

or you can use append

iptables -A INPUT  -s 1.2.3.4 -j DROP


How Do I Block Subnet (xx.yy.zz.ww/ss)?

Use the following syntax to block 10.0.0.0/8 on eth1 public interface:
iptables -i eth1 -A INPUT -s 10.0.0.0/8 -j DROP

How Do I View Blocked IP Address?

Simply use the following command:
iptables -L -v

How Do I Save Blocked IP Address?
service iptables save


 This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visitwww.codero.comchat with us online or give us a call at 866-2-CODERO. Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)