Where is iptables in Ubuntu 16.04?

iptables stores its information in RAM, meaning it's non-persistent. If you want to save/restore it at will, you'll need to use a couple commands.

First off, you would use iptables as normal to set up your rules the way you want them. Then, you can freeze these rules using something like:

sudo iptables-save | sudo tee /etc/iptables.conf

Then, to load your rules, it's a simple matter of running:

sudo iptables-restore < /etc/iptables.conf

You can add this to your /etc/rc.local or similar to have it run automatically at boot, or you can have your program call this executable (or just pass the same iptables rules over and over again).


Instead of iptables, you should actually take consideration in using ufw, the default firewall configuration tool provided by ubuntu internally.

All of the settings on firewall, which was configured through iptables, could be stored through ufw, such as the configuration file located at /etc/default/ufw.

NAT is also possible to be configured and stored: https://gist.github.com/kimus/9315140

Tags:

Iptables

16.04