Use persistent iptables on Debian
Now I cannot input any Japanese characters on my f**kin' arch laptop, so I write this article in English.
How should I make iptables persistent?
RedHat-like distro has /etc/sysconfig/iptables for persistent iptables, while Debian does not. How should we do? We used to write /etc/network/if-pre-up.d/iptables & /etc/network/if-post-down.d/iptables by hands. Now the answer is clearly shown in iptables - Debian Wiki. Let's install iptables-persistent.
sudo apt-get install iptables-persistent
This command tells you two important informations.
- The rule files are located in /etc/iptables directory. rules.v4 is for IPv4, while rules.v6 is for IPv6.
- At this time you can import your iptables config automatically, however, you have to manually save rules from now on.
iptables-save > /etc/iptables/rules.v4 ip6tables-save > /etc/iptables/rules.v6
Those commands will help you.