I always seem to forget about this. At least on Debian systems, iptables rules won’t automatically persist  after a reboot. In order to get your carefully crafted firewall rules to stick you need to load them up at boot time. Here’s one way of doing it:

Once you have your rules defined the way you want, save them to a file –

iptables-save > /etc/firewall.conf

Then create the file “iptables” in


And fill it with this content:

iptables-restore < /etc/firewall.conf

Make it executable:

chmod +x /etc/network/if-up.d/iptables

Cross your fingers and you should have your iptables back as you left them even after a reboot.

Source debian-administration.org/articles/445