Wednesday, April 29, 2015

Disable PING replies on Linux

You may want to disable ping replies for many reasons, may be for a security reason, or to avoid network congestion.

Disable ping reply Temporarily

# echo "1" >  /proc/sys/net/ipv4/icmp_echo_ignore_all

Also, to enable the ping reply back, set the value to “0″ as shown below.

# echo "0" >  /proc/sys/net/ipv4/icmp_echo_ignore_all

Disable ping reply Permanently

Step 1: Edit the sysctl.conf file and add the following line.

net.ipv4.icmp_echo_ignore_all = 1

Step 2: Execute sysctl -p to enforce this setting immediately.

# sysctl -p

The above command loads the sysctl settings from the sysctl.conf file.
After the ping reply is disabled using one of the above method, when somebody tries to ping your machine they will end up waiting without getting a ping reply packet even when the machine is up and running.

No comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More