Assuming you want to stop people pinging you, use iptables (2.4 series kernels) / ipchains (2.2 series kernels) to drop the relevant packets. You just add some icmp rules something like the following :
/sbin/iptables -A INPUT -p icmp --icmp-type echo-requested -j DROP
/sbin/iptables -A OUTPUT -p icmp --icmp-type echo-reply -J DROP
or
ipchains -A input -p icmp -s any/0 8 -d any/0 -j DROP
ipchains -A output -p icmp -s any/0 0 -d any/0 -j DROP
You might read you question a little more different. I therefor post this... Perhaps you just want to know how to turn the ping command off. Default it runs until you stop it.
Try ctrl+c or ctrl+break
In some Unix systems (SCO for instance), the delete button has the same affect.
When breaking the ping command you recieve statistics regarding packet loss and more.
/Sören
Just to clarify, the 'echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all' quoted by marsd is certainly a good suggestion and is undoubtedly simplest as long as you want to block <all> interfaces on your machine. If you just want to block on a given interface you will have to use iptables/ipchains. Typically, you'd want to suppress pings from outside your lan but allow from inside, or perhaps from a nominated machine only. Also remember if you do use packet filtering that you do not want to block all icmp protocol packets - just those packet types that relate to ping.
If you meant as per Nostradamus' response you can use the syntax 'ping -c 5 127.0.0.1' where -c means number of pings. In this example ping would stop after 5 as it would on a Windows box.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.