« Apache - multiple virtual hosts on *80 | Main | iptables: redirecting ports »

September 07, 2012

iptables: method to simply block Ping requests...

Sometimes a system administrator would simply like to block out all incoming ping requests - issue the following command in order to adjust iptables for this functionality:

/sbin/iptables -I INPUT -j DROP -p icmp --icmp-type echo-request

(this reads drop all input of protocol type icmp, specifically echo-request).

Then to drop the rule, simply obtain the index number of the iptables rule:

/sbin/iptables -L INPUT --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 DROP icmp -- anywhere anywhere icmp echo-request

(the block ICMP request in number 1)

Drop the entry:

/sbin/iptables -D INPUT 1

Posted by cdgrieb at September 7, 2012 09:31 AM


Login to leave a comment. Create a new account.