fbpx How to Disable Ping Responses in Linux: /proc/sys/net | Certificação Linux

How to Disable Ping Responses in Linux

📅 03/17/2020 ⏱ 1 min ✍️ Uira Ribeiro
Linuxcommandshow-to
How to Disable Ping Responses in Linux
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

Disabling PING can be a good security strategy, preventing curious users from using PING to scan networks looking for active Hosts to try exploits.

Another good reason is to avoid Ping "flood" on the network, which can be done with the "-f" option of ping, flooding the destination host with several ping packets.

This approach does not require Netfilter packet filters.

To Temporarily Disable Ping Response

You can temporarily disable the ping response using the following method.

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

Note that this configuration does not survive system reboot.

To restore ping responses, use the following command:

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

To permanently disable ping response

You can permanently disable the ping response using the following method.

Step 1: Edit the file /etc/sysctl.conf and add the following line.

net.ipv4.icmp_echo_ignore_all = 1

Step 2: Run sysctl -p to apply this configuration immediately.

sysctl -p

After this, incoming ping packets will simply be discarded.

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp