Disable The Ping Response On Linux?

Sometimes you may want to disable ping response for many reasons, may be for a security reason… This article explains how do I disable the ping response on Linux ?

Disable ping response Temporarily

To disable the PING response, login as root and type the following command
# echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

To reenable the PING response do this:
# echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all

Disable ping response Permanently

Edit the /etc/sysctl.conf file and add the following line
net.ipv4.conf.icmp_echo_ignore_all = 1

Execute sysctl -p to enforce this setting immediately
# sysctl -p


  1. For centos 6.3 64 bit i'm running: net.ipv4.conf.icmp_echo_ignore_all = 1 didn't worked should have been net.ipv4.icmp_echo_ignore_all = 1

    Without the conf!

  2. "net.ipv4.conf.icmp_echo_ignore_all" is an unknown key

  3. You can also block ICMP IPv6 traffic using:

    iptables -A INPUT -p icmpv6 --icmp-type echo-request -j DROP

    Source: http://www.sysadmit.com/2016/03/linux-respuesta-ping-habilitar-o-deshabilitar.html