Disable ICMP Echo (PING) in Linux

You can use this advice in many different distributions of Linux.

When using a computer with Linux, in addition to various tips included in my publication and on this blog, it is worth considering disabling ICMP echo, which is the response to PING queries.

ICMP (Internet Control Message Protocol) is a network layer protocol used by network devices to diagnose network communication issues. It is used by PING to check if the machine is up and connected to the network.

To disable ICMP echo on a Linux computer, you should:

  1. Add the following lines to the file /etc/sysctl.conf :

net.ipv4.icmp_echo_ignore_all = 1
net.ipv6.icmp_echo_ignore_all = 1

If you want to use the nano editor for this purpose, the command to add these lines looks like this:

sudo nano /etc/sysctl.conf

  1. After adding these lines and saving the file, you should issue one more command in the terminal:

sudo sysctl -p /etc/sysctl.conf

Then, for safety, you can restart the computer.

From now on, ICMP Echo is disabled.