Iptables tables rules being overwritten a few minutes after reboot

iptablesubuntu-12.04

I have some rules that I would like to apply, I added the following

pre-up iptables-restore < /etc/iptablesRules

to /etc/network/interfaces so that they would automatically be applied.

After a reboot they are applied but after a few minutes they are being overwritten, by the default set?

Its an Ubuntu 12.04 vps.

Any ideas what could be causing this?

— FIXED —

After much mulling around it turns out there was a file /etc/sysconfig/firewall which was overwriting any rules set using the /network/interfaces as well as the iptables-persistent options.

So the lesson learned is that moving from one vps provider to another isn't exactly straight forward even if its the same OS.

Best Answer

I was looking into your problem and it looks like there's issue with your version of Ubuntu. More specifically dealing with how pre-up and Network Manager are working. It seems a lot of people have used the iptables-persistent package to successfully restore rules on start up with Ubuntu 12.04.

After installing iptables-persistent it will ask you if you'd like to save your current rules, or create a new rule set.