How to Block Ping Request on a Linux Server

To block ping requests on a Linux server, you can use a firewall to block the ICMP protocol. You can do this using the iptables command.

Here is an example of how to block ping requests using iptables:

sudo iptables -A INPUT -p icmp --icmp-type echo-request -j DROP

This will block all incoming ping requests to the server.

You can also block ping requests using the ufw firewall. To do this, run the following command:

sudo ufw deny in icmp

This will block all incoming ICMP traffic, including ping requests.

Keep in mind that blocking ping requests can make it more difficult to troubleshoot network issues, as ping is often used as a basic connectivity test. If you do decide to block ping requests, make sure you have other tools and methods in place for monitoring the health of your network.

Leave a Comment