You are here
Home > Linux > Disable > Ubuntu Disable ICMP / Enable ICMP (Ping) Temp and Permanent Solution

Ubuntu Disable ICMP / Enable ICMP (Ping) Temp and Permanent Solution

Disable ICMP / Enable ICMP on Ubuntu

Ubuntu – Disable ICMP / Enable ICMP

Today I will show you how to Permanently disable ICMP / enable ICMP ping requests to your Ubuntu machine. I will also be covering how to temporarily disable ICMP / enable ICMP

So let me show you how:
1. Open the terminal by pressing ctrl+alt+t
2. Now type the following command to show your current IP Address and press enter

ip addr show

Look for something similar to inet xxx.xx.xx.xx (the x’s represents your IP numbers) under eth0 if you using lan cable and wlan0 for wireless

3. Now type ping followed by your IP and you should get a reply that looks similar to the following

64 bytes from icmp_seq=1 ttl=64 time=0.033 ms

This means that ICMP is currently enabled

4. Lets switch user to privileged user so we can do the changes by typing the following and hitting enter

sudo su

5. Now we will immediately but temporary (after a restart of your machine it will be reverted) disable ICMP by typing the following

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

6. If you ping your IP address now you will not get a reply which means that ICMP has been disabled

7. To make the change permanent you will need to change the sysctl.conf file by typing the following

sudo gedit /etc/sysctl.conf

8. Add the following line under #net.ipv6.conf.all.forwarding=1


This will ensure that the setting gets enabled after a restart of your machine

9. Should you wish to enable ICMP again you can use the following command

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

10. And you should also remove the net.ipv4.icmp_echo_ignore_all=1 from the sysctl.conf file to enable it permanently

Please rate the tutorial if it was helpful and also like the video. Should you wish to see more Ubuntu related videos, please subscribe to my YouTube Channel.

If this was helpful please consider a donation

Thank you for following my tutorial. You can click here for more Ubuntu Tutorials.