How to disable Ping Response on Linux

You need to have root permissions to execute these commands

I. DISABLE PING RESPONSE PERMANENTLY

  1. Append this line to /etc/sysctl.conf file.
                [root@testserver ~]$net.ipv4.conf.icmp_echo_ignore_all = 1
                
  2. Reload sysctl.
                [root@testserver ~]$sysctl -p /etc/sysctl.conf
                

II. DISABLE PING RESPONSE TEMPORARILY

  • Use this command to disable ping response:
                [root@testserver ~]$echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
                
  • Use this command to re-enable ping response:
                [root@testserver ~]$echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all
                

Leave a Reply

Your email address will not be published. Required fields are marked *