Saving IPTABLES rules on Ubuntu 16.04

In order to preserve your IPTABLES rules upon reboot, install iptables-persistant.

sudo apt-get install iptables-persistent

If you make any changes to the rules, run the following commands so you don’t lose them during a system reboot.

sudo netfilter-persistent save
sudo netfilter-persistent reload