- Forums
- Networking
- how to block pings ICMP
If You Want To Avoid Getting Pings On Your Server You Can Block All Pings Icmp Does Not Have A Tcp Udp Port [3488], Last Updated: Mon Jun 24, 2024
Webune Tutorials
Mon Jan 11, 2010
3 Comments
493 Visits
If you are visiting us on this forum today you are probably wanting to know how you can disable incoming pings to your server.
one of the questions from our members regarding ping was. what port does ICMP uses? ICMP doesnt use a port to block to a firewall, but you can still block all incoming ping requests how do you avoid pings?
if you have a linux server, like fedora, centos or redhat for example, you can edit the sysctl.conf file.
first, ping your server and make sure you are getting ping replies. i am using widows xp, so i will open the DOS terminal and ping my ip: example:
C:\Users\MyPC>ping 192.168.0.2
Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time<1ms TTL=12
Reply from 192.168.0.2: bytes=32 time<1ms TTL=12
Reply from 192.168.0.2: bytes=32 time<1ms TTL=12
Reply from 192.168.0.2: bytes=32 time<1ms TTL=12
Ping statistics for 192.168.0.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0msnext login as superuser on your remote linux server. i will be using SSH to login to my shell.
then send this command to edit sysctl.conf
SHELL COMMAND:
nano /etc/sysctl.conf
NOTE: i am using nano to edit the file, but you can use vi is you want to
next look for this line:
net.ipv4.icmp_echo_ignore_allNOTE: if you dont find
net.ipv4.icmp_echo_ignore_all then simply added to the last line
be sure the the value is equals to 1 - so make it look like this:
net.ipv4.icmp_echo_ignore_all = 1after you have made the changes, save the file and restart your network:
SHELL COMMAND:
/etc/init.d/network restart
now ping your server again, now you should see something like this:
Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: Destination host unreachable.
Reply from 192.168.0.2: Destination host unreachable.
Reply from 192.168.0.2: Destination host unreachable.
Reply from 192.168.0.2: Destination host unreachable.
Ping statistics for 192.168.0.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),