Re: how to store iptables rules
On Sat January 24 2009, abdelkader belahcene wrote:
> hi,
> please i want to save the iptables for next sessions,
> now I have to run iptables after each reboot.
> I tried iptables-save, it did't.
> thanks for help
> bela
we just had this discussion. Look for the subject: iptables/firestarter
here is what I took to be the ANSWER:
http://www.debian-administration.org/articles/615 has more information
about this topic.
Personally, I do this:
Ensure that you have your firewall rules set up as you wish them.
Then, edit /etc/network/interfaces to add the following:
# Bring up firewall
pre-up iptables-restore < /etc/iptables.rules
# And save fw state on shutdown
post-down iptables-save -c > /etc/iptables.rules
However, people seem to be saying that this may have drawbacks, as if
you add a bad rule or otherwise negatively alter your ruleset, it
would get automatically saved. Since I make all edits to my iptables
rules in a shell script that I source when I want to change them, I'm
not too worried about that, but you can see several alternate
solutions from the link above.
Hope this helps!
--
Paul Cartwright
Registered Linux user # 367800
Registered Ubuntu User #12459
Reply to: