iptables rules are created and modified using iptables command, saved using iptables-save and we can load the saved files using iptables-restore command.
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
The iptables-persistent package automatically loads saved iptables rules. It does this by using the rules stored in /etc/iptables/rules.v4 for IPv4, which are generated and saved when the package is installed.
To use iptables-persistent, install the package:
| |