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 use below command to ban IPs which is hurting my site,but doesn't work. I don't know why

iptables -I INPUT -s 89.200.143.50 -j DROP
iptables -I INPUT -s 37.46.112.102 -j DROP

Please help

Centos 5.7+LAMP

#iptables -L -n output:~

Chain INPUT <policy Accept> 
target INPUT opt source         destination 
DROP   all   --  89.200.143.50  0.0.0.0/0 
DROP   all   --  37.46.112.102  0.0.0.0/0 

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

1 Answer 1

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

 
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.