Ubuntu 12.04 LTS - iptables v1.4.12
Where are iptables's rulesets saved when invoking
iptables-save <ruleset-name> ?
According to this answer basic way of saving iptables's rules is invoking
iptables-save > /etc/iptables/rules.v4 ip6tables-save > /etc/iptables/rules.v6
and afterwards loading/restoring these rules in
iface eth0 inet static .... pre-up iptables-restore < /etc/iptables/rules.v4 pre-up ip6tables-restore < /etc/iptables/rules.v6
... or putting these into a shell script in
This can be simplified by installing the
sudo apt-get install iptables-persistent inovoke-rc.d iptables-persistent save update-rc.d iptables-persistent defaults
Following some tutorials i tried to invoke
service iptables status ( a non-existant/unknown command for the
iptables version/package that comes pre-installed with 12.04 ) and found this interesting output:
Aborting iptables initd: unknown command(s): "status". ... save <ruleset> save the current ruleset load <ruleset> load a ruleset ... Saved rulesets: active, inactive ...
There seem to be two rulesets i can load (
.. but where are these stored?
I can't find their location as active/inactive are pretty bad search terms and
dpkg-query -L iptables doesn't help either.
As i'm provisioning my servers with
chef it would be nice to know wether there is some place i can put my rulesets and add a simple shell script to
/etc/networking/if-pre-up to load these.
Then i could ommit the
iptables-persistent package which ain't that flexible as it doesn't allow loading different rulesets.
Thanks for your help.