Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am on a private LAN My ip is, I want to block only ping requests from I am running ubuntu 11.10. I found two links

First tells how to block an IP but not how to block only ping requests.
Second tells how to disable ping all together.

Can someone please tell me how to block only ping requests from a specific IP

share|improve this question
up vote 7 down vote accepted

Using iptables is an exellent choice it's a very powerfull firewall feature built in to the Kernel

as root or with sudo:

iptables -A INPUT -s -p icmp -j DROP

will block all ping(icmp requests) from a the specified IP.

The following to block all ICMP:

iptables -A INPUT -p icmp -j DROP

Basically omitting the ip will bock ALL ping requests.

to remove the following active firewall rule:

iptables -A INPUT -p icmp -j DROP

change the -A (append) to -D (delete)

iptables -D INPUT -p icmp -j DROP

But do you have a good reason to block ICMP? Usually ICMP is a good thing. It is used for MTU discovery etc. Basically making sure that you will have a optimized network/Internet experience.

More info on why you shouldnt block ICMP here

share|improve this answer
+1 for why you shouldn't block ICMP. – zigg Jun 24 '12 at 12:44

Your Answer


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.