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

Can't figure out why iptables rules are dropped.

sudo iptables -A INPUT -s -j DROP

Any suggestions are welcome.

share|improve this question
Think you might need to expand. Do you mean you have a set of iptables rules and they sometimes all vanish, or only some of them vanish? Or do you mean something else entirely? – EightBitTony Jun 23 '11 at 8:40
Entirely vanish. – Somebody Jun 23 '11 at 10:10
up vote 2 down vote accepted

sudo iptables -A INPUT -s -j DROP

If you just run the above command, it just loads that rule into the kernel, not really changing the iptables file. This would be lost on a reboot or a restart of iptables.

service iptables save

would save the rules to /etc/sysconfig/iptables and the change would survive a reboot.

share|improve this answer
Thanks mate. :) Guess this is my mistake. – Somebody Jun 23 '11 at 10:12

Your -A is adding the rule to the end of the INPUT rules. iptables works on first match wins. My guess is that some earlier rule is allowing the connections from the listed IP address and so your rule is never seeing them.

Solution: use -I

sudo iptables -I INPUT -s -j DROP

This will insert your rule at the beginning of the INPUT table. For further information have a look at the iptables man pages.

share|improve this answer

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.