Saving iptables rules – Debian Linux

I found it’d best to use the package: iptables-persistent for Debian/Ubuntu.

Since Ubuntu 10.04 LTS (Lucid) and Debian 6.0 (Squeeze) there is a package with the name “iptables-persistent” which takes over the automatic loading of the saved iptables rules. To do this, the rules must be saved in the file /etc/iptables/rules.v4 for IPv4 and /etc/iptables/rules.v6 for IPv6.

To install simply run:

apt-get install iptables-persistent

It will ask if you if you’d like to save your current rules to the /etc/iptables/rules.v4 file. You might as well say yes, and then modify that file if you need to.

Make sure to reboot to test to ensure your rules are correctly loaded upon reboot.

Who is 916networks

916 Networks supports small to medium size businesses in the Sacramento Region. Servicing all industries since 2009, 916 Networks is trustworthy, knowledgeable and reliable and takes pride in honest work at honest prices.