Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm using iptables on Ubuntu 10.04 and whenever I set iptables rules they will revert after a while. I set them with iptables -I INPUT or iptables -D INPUT and they work immediately and I see them in iptables -L INPUT but after a while the rules revert.

I even exported the rules

iptables-save > /etc/firewall.conf

I even created a script /etc/network/if-up.d/iptables

iptables-restore < /etc/firewall.conf

and I even checked firewall.conf and it has the rules I want in it.

So why would iptables be reverting?


I found this in /etc/cron.daily/apf

/etc/apf/apf -f >> /dev/null 2>&1
/etc/apf/apf -s >> /dev/null 2>&1

Would this be flushing the iptables rules?

share|improve this question

The wiki page references feisty etc. so may be out of date but I would guess its still relevant: suggests that NetworkManager may be the culprit... then suggests how to get NetworkManager to play nice.

share|improve this answer
There is no /etc/NetworkManager on my system and man -k Network Manager doesn't show anything which looks like it... I think Network Manager isn't installed on my system – David Jun 2 '11 at 10:14
Are you sure? The capitalisation of the 'N' & 'M' is important. – PriceChild Jun 2 '11 at 10:23
yes. very sure ls /etc/N* ls: cannot access /etc/N*: No such file or directory – David Jun 2 '11 at 11:04

I'm not familiar with apf, but it's easy enough to check if that's the culprit. Remove it from cron.

I'd also do something like grep -ri --color iptables /etc and also check /var/log/messages and /var/log/syslog for anything that could be doing this.

share|improve this answer
Yeah I had already grepped for iptables under etc but there is nothing (other then my above-mentioned script). Good idea with grepping the logs too but there was nothing there either. I've confirmed that the apf script flushes the iptables rules so I'Ve removed it. Now I just have to wait until the daily cron goes... This was a tricky one since the script flushing the iptables rules doesn't have the word "iptables" in it – David Jun 3 '11 at 10:24

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.