Skip to content

December 24, 2010

Disable ping in Linux Server

The PING ( Packet Internet Groper )command is used to test the connection and latency between two network connections. These connections can be either in a local area network or a wide area network or the internet as a whole. The PING command sends packets of information to a specified IP Address and then measures the time it takes to get a response from the specified computer or device.

Disable ping using apf firewall

  • To do the same make sure that apf is installed in your server

To disable ping using apf we need to enable the same in apf configuration file /etc/apf/conf.apf.

Open the configuration file /etc/apf/conf.apf with your favorite editor,

vi /etc/apf/config.apf

Check for the following line,
IG_ICMP_TYPES="3,5,8,11,0,30"
from the line remove the number 8 at the entry.

To reflect the changes restart the apf service

/etc/init.d/apf restart

Disable ping using iptables

iptables -I INPUT  -p icmp -m icmp --icmp-type echo-request -j REJECT

To save the changes and to reflcet the in iptables configuration file do the following command.

service iptables save

Disable ping from /etc/sysctl.conf

Inorder to disable ping from /etc/sysctl.conf, open the fille and add the following lines and save.

# Ignore Ping
net.ipv4.icmp_echo_ignore_all = 1

To reflect the change in the network setting of the server restart the network services with the following command.

/etc/rc.d/init.d/network restart

Do the above steps and after completing the same check wether the ping is disabled or not with the following command,

ping l3admins.com
Read more from Linux

Leave a comment

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

required
required

*