Disabling ICMP on linux systems

1 min read

In Linux, you can disable ICMP traffic by configuring kernel parameters. To do this, follow these steps:

1. Open the file /etc/sysctl.conf in a text editor, for example, using the command nano /etc/sysctl.conf.

2. Add the following line to the end of the file:

net.ipv4.icmp_echo_ignore_all = 1

3. Save and close the file.

4. To apply the new settings, run the command:

sudo sysctl -p

After completing these steps, all incoming ICMP requests will be blocked in Linux, and the computer will not respond to ICMP Echo Requests (ping).

To undo the blocking of ICMP traffic in Linux, change the value of the parameter net.ipv4.icmp_echo_ignore_all to 0 or completely remove this line from the file /etc/sysctl.conf. Then, either reboot the server or run the command sudo sysctl -p to apply the new settings.

Didn’t find the answer?Contact support — we’ll help you sort it out.
Open a ticket →