Debian – Make iptables restore on boot, or save persistant


Generate-tables-iconHere is how to save your iptables config and make it stick even after a reboot. There is two ways of doing this (at least). We will use the latest method that will require you to install iptables-persistent.
apt-get install iptables-persistent

Then we will use the iptables-save command to save our current config. This you only need to do if you have made changes to the iptable after you installed the iptables-persistent package. Because when you install the package, it takes your current config and makes it persistent.

iptables-save > /etc/iptables/rules.v4
If you uses ipv6 as well, you can save that too
iptables-save > /etc/iptables/rules.v6

These two files will be loaded when your system is booting.

Happy saving!

Have any Question or Comment?

Leave a Reply