In this tutorial we will demonstrate how to persist iptables rules across reboots.
By default, when you create iptables rules its active, but as soon as you restart your server, the rules will be gone. Therefore we need to persist these rules across reboots.
We require the package
iptables-persistent and I will install it on a debian system so I will be using
Ensure that the service is enabled to start on boot:
Creating Iptables Rules
In this case I will allow port 80 on TCP from all sources:
To persist our current rules, we need to save them to
Now when we restart, our rules will be loaded and our previous defined rules will be active.
Thanks for reading, feel free to check out my website, feel free to subscribe to my newsletter or follow me at @ruanbekker on Twitter.