Introduction
A server administrator or user may need to disable PING or ICMP temporary replies from an Ubuntu server for several reasons, including:
- Security.
- Avoiding network congestion.
- Preventing network flooding
ping hostname -f.
This guide explains how to temporarily disable and re-enable PING or ICMP replies from an Ubuntu Server 16.04.2 using the command line.
Prerequisites
- Ubuntu Server 16.04.2.
- Root or sudo access to the server.
Implementation
Follow the instructions below to disable PING or ICMP replies from the Ubuntu server temporarily.
Step 1: Disable PING or ICMP Replies
From the command line, run:
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
This temporarily disables ICMP echo replies from the server.
Step 2: Re-enable PING or ICMP Replies
To re-enable PING and ICMP replies, run:
echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all
Alternatively, you can reboot the server to restore the setting.
Note: This configuration is temporary. Once the server is rebooted, the setting will be reset, so you will need to apply it again if required.
Conclusion
Using the /proc/sys/net/ipv4/icmp_echo_ignore_all setting, you can temporarily disable PING or ICMP replies on Ubuntu Server 16.04.2. Setting the value to 1 disables the replies, while setting it to 0 re-enables them.
FAQs
1. How do I temporarily disable ping on Ubuntu?
Run:
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
2. How do I enable ping again?
Run:
echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all
3. Will this setting remain after a reboot?
No. The setting is temporary and will be reset after the server is rebooted.
4. Does disabling ping block all network connections?
No. This setting specifically disables ICMP echo replies. Other network services, such as SSH, can continue to operate normally.
5. Why would an administrator disable ICMP replies?
It may be done for security considerations, to reduce unnecessary network traffic, or to avoid certain types of ping-based network flooding.
Related Articles
SSH Setup in a Newly Installed Ubuntu Server
Learn how to install OpenSSH Server and establish a remote SSH connection to a newly installed Ubuntu server.
Add Exim Service to Fail2Ban on Ubuntu
Learn how to configure Fail2Ban to protect the Exim mail service on an Ubuntu server.
Read the Exim and Fail2Ban guide
Talk to our experts
Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team here.