0

I have a openvz linux vps and am trying to disable requests to 'ping' to my VPS. How can i do this?

2
  • 2
    I hope you're not doing this because of "security" - ICMP echo is harmless, useful as a diagnostic tool and as far as DDoS attack vectors go is one of the least effective. Dec 4, 2010 at 12:36
  • On top, ICMP has a usefull side feature so you are efficiently sabotaging parts of the IP stack. You basically disable PathMTU functionality.
    – TomTom
    Oct 24, 2013 at 20:14

4 Answers 4

5

You can use iptables rules to achieve this:

iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
0
1

Add the following line to your init script for the network (the name depends on the distribution you use):

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

This disables ping responses.

To reenable, use the following command:

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

To make this permanent set the following into /etc/sysctl.conf (if you have such a file)

net.ipv4.conf.icmp_echo_ignore_all = 1

1

Simplest method of disabling ping response is to add an entry in /etc/sysctl.conf file. If the Iptables flushes or stop server will start responding to ping responses again. I suggest the following entry in your /etc/sysctl.conf file

net.ipv4.icmp_echo_ignore_all = 1

this will tell kernel to not respond any ping response, after this run sysctl -p on shell to implement the changes without reboot.

For more info please refer: http://www.trickylinux.net/disable-ping-response-linux/

0

You need iptables (or something similar) that blocks ICMP. http://www.cyberciti.biz/tips/linux-iptables-9-allow-icmp-ping.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .