Linux - How to block ping ICMP packets in server, Block ICMP or ping using iptables

How to block ping ICMP packets in server

Linux disable or block ping packets all together

You can setup kernel variable to drop all ping packets. Type the following command at shell prompt:
 # echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
The above command will disable the ping request by setting up the kernel variable (ICMP) to drop packets

Enable ping request
 # echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all

You can add following line to /etc/sysctl.conf file:
# vi /etc/sysctl.conf
  net.ipv4.icmp_echo_ignore_all = 1
This will permanently enable the kernal variable to block or drop the ping packets all together.

NOTE: If you find the kernal variable make sure the value is set to 1, If you dont find net.ipv4.icmp_echo_ignore_all then simply added to the last line be sure the value is equals to 1.

Block ICMP using iptables
# iptables -A INPUT -p icmp -j DROP

Ping command is a handy command for system admins to check the whether the server is up or not? By default this variable is not added in the server.

The topic on Linux - How to block ping ICMP packets in server is posted by - Math

Hope you have enjoyed, Linux - How to block ping ICMP packets in serverThanks for your time

Tech Bluff