Networking HowTos
Networking HowTos

Disable icmp ping replies on Linux

February 13, 2012 Linux

Having a computer that replies to ping requests allows for simple network connectivity tests, however there may be circumstances where you need to disable ping replies coming from your computer.
This can be done using firewall rules, however Linux provides an easy way to change the kernel parameters at run time to disable ping replies. Kernel parameters can be changed using the ‘sysctl’ command.
Command to disable ping replies:

$ sudo sysctl -w net.ipv4.icmp_echo_ignore_all=1

Command to enable ping replies:

$ sudo sysctl -w net.ipv4.icmp_echo_ignore_all=0

You can check the current status by running the following command:

$ sysctl net.ipv4.icmp_echo_ignore_all

You Might Also Like