Best Answer
You don't say how you want to stop these pings, but essentially there are two parts to a
ping: an ICMP Echo Request and ICMP Echo Response.
These two are ICMP Type 8 and ICMP Type 0 respectively.
To block incoming echo requests (when someone pings your machine ignore it):
iptables -I INPUT -p icmp --icmp-type 8 -j DROP
If you are acting as a router/firewall for a network, you would place this in the FORWARD
table:
iptables -I FORWARD -p icmp --icmp-type 8 -j DROP
It is generally a sensible idea to drop any unsolicited responses, so I would have the
following in my INPUT table:
iptables -A INPUT -p icmp --icmp-type 0 -m state ! --state RELATED,ESTABLISHED -j DROP
|
Very simple solution
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
Response by: jalal3623 points |
A ping is a simple echo request using the Internet Control Message Protocol (ICMP), so the
following should work: iptables -A INPUT -p icmp --icmp-type 8 -j DROP. ICMP type 8 is echo as specified here: http://www.iana.org/assignments/icmp-parameters
|