Today we will see how to block ping responses in Linux.
This trick has no real interest unless you want to hide a little the presence of your machine on a network.
We still keep in mind that the command nmap is able to bypass this trick (eg nmap-sP 127.0.0.1).
To disable response to ping, open a terminal as root and run the following command:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
And to go back:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Warning, these two commands perform the change dynamically and at the next boot, this change is lost.
To make a permanent change, you must edit your /etc/sysctl.conf as follows:
echo “net.ipv4.icmp_echo_ignore_all = 1” >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf