0

I never quite got why this isn't some built in setup, although maybe it is and stuff changes so quickly I just missed it. I can use iptables-save to generate something I can feed into iptables-restore, but what I was wondering is if there was a standard place to put it so that it gets picked up on boot without me having to add something to rc.local or the ever changing init/event.d scripts.

2 Answers 2

1

From the Ubuntu community help site it seems that Ubuntu has no default method to save rules, but the site suggests two ways:

  • pre-up and post-down statements in /etc/network/interfaces
  • scripts in /etc/network/if-pre-up.d and ../if-post-down.d

See this page for details.

Personally I prefer to use Shorewall and Shorewall6 to simplify iptables configuration, which restores iptables rules at startup automatically.

1

I think it is pretty common for people to use a front-end to iptables like firehol, shorewall, etc, or many others instead of manipulating the tables themselves. Most of these packages setup init scripts to install the rules at boot time for you, and you place your rules in a configuration file appropriate to that tool.

My preference is firehol, I really like the simplified syntax that I get. You don't have to sacrifice flexibility, you can create far more complex rules when you need them. It creates lots of chains to make the rule processing a lot more efficient then you typically see in rules sets entered by hand.

2
  • Shorewall has a nice feature where you can save a default configuration; if you try to apply a new config that fails for some reason, it will re-apply the saved configuration. Mar 27, 2010 at 0:26
  • @Tim Howland, with firehol if you use firehol try it too will attempt to install a new config and revert to the previous running config if there are any failures.
    – Zoredache
    Mar 27, 2010 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .