iptables rules are created and modified using
iptables command, saved using
iptables-save and we can load the saved files using
It is possible to create a script using the above commands to create and save an iptables file, and load it again at system startup. But there is an easier way.
iptables-persistent for Debian based systems
iptables-persistent takes over the task of loading the saved iptables rules. To do this, the rules saved in
/etc/iptables/rules.v4 will be used for IPv4 which can be created by storing the iptables rules at the time of package installation.
iptables-persistent, install the package:
sudo apt-get install iptables-persistent