Many malicious attacks begin with a ping scan. Disabling ICMP echo requests prevents your system’s discovery with a ping.
Disable ICMP echo responses temporarily
You can temporarily disable the ICMP using the following method but this setting will be erased after the reboot.
root@lifelinux:~# echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Also, to enable the ICMP echo responses back, type the following command:
root@lifelinux:~# echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Disable ICMP echo responses permanently
You can permanently disable the ICMP echo reponses using the following method:
Edit the sysctl.conf file:
root@lifelinux:~# vi /etc/sysctl.conf
And add the following line:
net.ipv4.icmp_echo_ignore_all = 1
After that, execute sysctl -p to enforce this setting immediately:
root@lifelinux:~# sysctl -p
The above command loads the sysctl settings from the sysctl.conf.