Iptables: Difference between revisions

From Anthony Pastor Wiki Notes - Verba volant, scripta manent
Jump to navigation Jump to search
(Created page with "To create persistent rules with iptables you could use the Debian/Ubuntu package: '''iptables-persistent''' apt-get update apt-get install iptables-persistent -y iptables-sa...")
 
No edit summary
Line 1: Line 1:
To create persistent rules with iptables you could use the Debian/Ubuntu package: '''iptables-persistent'''
To create persistent rules with iptables you could use the Debian/Ubuntu package: '''iptables-persistent'''


<syntaxhighlight lang="bash">
apt-get update
apt-get update
apt-get install iptables-persistent -y
apt-get install iptables-persistent -y


To export and save current rules:
iptables-save > /etc/iptables/rules.v4
iptables-save > /etc/iptables/rules.v4
ip6tables-save > /etc/iptables/rules.v6
ip6tables-save > /etc/iptables/rules.v6
</syntaxhighlight>


After each reboot all rules will be restored automatically through an init-script.
After each reboot all rules will be restored automatically through an init-script.
NB: The initscript is called: /etc/init.d/netfilter-persistent
NB: The initscript is called: /etc/init.d/netfilter-persistent

Revision as of 15:39, 16 June 2015

To create persistent rules with iptables you could use the Debian/Ubuntu package: iptables-persistent

apt-get update
apt-get install iptables-persistent -y

To export and save current rules:
iptables-save > /etc/iptables/rules.v4
ip6tables-save > /etc/iptables/rules.v6

After each reboot all rules will be restored automatically through an init-script. NB: The initscript is called: /etc/init.d/netfilter-persistent