Server Fault is a question and answer site for system and network administrators. 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 use below command to ban IPs which is hurting my site,but doesn't work. I don't know why

iptables -I INPUT -s -j DROP
iptables -I INPUT -s -j DROP

Please help

Centos 5.7+LAMP

#iptables -L -n output:~

Chain INPUT <policy Accept> 
target INPUT opt source         destination 
DROP   all   -- 
DROP   all   -- 

Chain FORWARD <policy ACCEPT> 
target prot opt  source       destination

chain OUTPUT <policy Accept> 
target prot opt source        destination
share|improve this question
Can you post the output of iptables -L -n? – Khaled Mar 7 '12 at 15:06
@Khaled Post the output already.Please help to check – Edward Huang Mar 7 '12 at 15:18

Your rules look OK to me. Two questions I want to ask:

  1. How did you know this did not work?
  2. Are you filtering the traffic destined to this machine or forwarded to another machine? In the later case, you need to add your rules to FORWARD chain.

Here are some hints to help you:

To help you debug this, you can use tcpdump to check whether your server is responding to traffic coming from these IPs.

Also, you can use -j LOG target of iptables to make sure these rules are hit. Also, you can view iptables counters by iptables -L -n -v.

share|improve this answer
+1... use -L -n -v. Seeing counters and the like helps. – Jeff Ferland Mar 7 '12 at 16:01

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.