Posted by Hans-Henry Jakobsen
As far as I know Debian doesn’t have any defined way to save your iptables rules.
I’ve done it this way:
First I’ve made my iptables rules and made sure they work.
Second is to save those rules to a configuration file
iptables-save > /root/scripts/iptables.save
I always try to save my custom scripts and required files in the /root/scripts/ folder.
Now make a script that loads the iptables rules at reboot
echo "#!/bin/bash" > /etc/network/if-up.d/iptables echo "iptables-restore < /root/scripts/iptables.save > >> /etc/network/if-up.d/iptables chmod +x /etc/network/if-up.d/iptables
This has been tested on Debian (Etch) 4.0