How to Disable Ping Responses in Linux
Disabling PING can be a good security strategy, preventing curious users from using PING to scan networks looking for active Hosts to try exploits.
Another good reason is to avoid Ping "flood" on the network, which can be done with the "-f" option of ping, flooding the destination host with several ping packets.
This approach does not require Netfilter packet filters.
To Temporarily Disable Ping Response
You can temporarily disable the ping response using the following method.
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
Note that this configuration does not survive system reboot.
To restore ping responses, use the following command:
echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all
To permanently disable ping response
You can permanently disable the ping response using the following method.
Step 1: Edit the file /etc/sysctl.conf and add the following line.
net.ipv4.icmp_echo_ignore_all = 1
Step 2: Run sysctl -p to apply this configuration immediately.
sysctl -p
After this, incoming ping packets will simply be discarded.
That was just one piece. The course teaches the whole path — from your first command to exam day.