Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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. –  Hubert Kario Dec 4 '10 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 '13 at 20:14

4 Answers 4

up vote 5 down vote accepted

You can use iptables rules to achieve this:

iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
share|improve this answer
    
Great! Works. But you missed the s on iptable –  Daniel Dec 4 '10 at 13:42

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

share|improve this answer

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

share|improve this answer

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/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.