How to Disable Ping Response on Ubuntu Server

July 5, 2013 — 2 Comments

This simple and brief tutorial is going to show you how to disable ping response on Ubuntu Server to make it more secure.

To get started, run command below to get the root privilege:

sudo su

Then you can disable ping via one of below commands:

    echo  1  > /proc/sys/net/ipv4/icmp_echo_ignore_all


    iptables  -I  INPUT  -i  ech0  -p   icmp  -s  0/0  -d  0/0   -j  DROP

To re-enable ping:

    echo  0  > /proc/sys/net/ipv4/icmp_echo_ignore_all


    iptables  -I  INPUT  -i  ech0  -p   icmp  -s  0/0  -d  0/0   -j  ACCEPT

To make it permanently, edit the “/etc/sysctl.conf” file so that the setting gets picked up at boot time.


I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to

2 responses to How to Disable Ping Response on Ubuntu Server

  1. I don’t understand how to edit files in the root im a complete noob

    • To edit files in the root, which is easily done from the terminal, I would suggest navigating to the directory of the file by typing:

      #cd directory-of-file
      //this will move the terminal directory to that specified

      //this will list the directory structure, should list the file you wish to edit

      # sudo nano file-name
      //this will open the nano text editor to edit the specified file in the terminal window

      To save the changes press CTRL and O at the same time, and to exit press CTRL and X at the same time.

Leave a Reply


Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>