How to disable ICMP echo responses in Linux

by lifeLinux on May 2, 2011

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.

[email protected]:~# echo 1 >  /proc/sys/net/ipv4/icmp_echo_ignore_all


Also, to enable the ICMP echo responses back, type the following command:

[email protected]:~# 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:

[email protected]:~# 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:

[email protected]:~# sysctl -p

The above command loads the sysctl settings from the sysctl.conf.

Related Posts:

Leave a Comment

Previous post:

Next post: