How to disable Ping response in Ubuntu
This post was written by admin on June 20, 2010
Posted Under: General
Posted Under: General
If you want to disable ping response in your ubuntu to protect your machine.You can try following commands in terminal.
First of all,open up a terminal window from Applications->Accessories menu and run this to get super user privilege:
sudo -i
Then:
Method 1:
run this command to disable ping response:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
and you can type this to re-enable:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Method 2:
run this to disable ping response:
iptables -I INPUT -i ech0 -p icmp -s 0/0 -d 0/0 -j DROP
and this to allow ping response:
iptables -I INPUT -i ech0 -p icmp -s 0/0 -d 0/0 -j ACCEPT
Hope this help!
Related posts:
- Ubuntu using Ramdisk for better performance and fast response
- Optimize the Usage of Swap to Speed up Response for Ubuntu
- Enable and Disable Notebook PC’s touch tablet in Ubuntu
- How to Clear and Disable Totem’s recent history in Ubuntu 11.04 Unity
- Clear and Disable Recent Documents list on ubuntu gnome

Reader Comments
Is the iptables method permanent?
[Reply]
Similar but drops echo-requests for the local network.
iptables -A INPUT -p icmp –icmp-type echo-request -s 192.168.1.0/24 -d 192.168.1.0/24 -j DROP
[Reply]
neither method is permanent unless you already have some mechanism that saves your iptables and restores them on reboot.
method 1 can be made permanent by editing the /etc/sysctl.conf file so that the setting gets picked up at boot time.
net.ipv4.icmp_echo_ignore_all=1
[Reply]