This is a script for setting up a firewall with settings for tarpitting ssh and basic protections that everyone needs.
git clone https://github.com/ChrisTitusTech/firewallsetup.git
sudo apt install iptables-persistent
sudo /etc/init.d/netfilter-persistent save
Use iptable-save which is pre-installed
sudo iptables-save > /etc/iptables/iptables.rules
This is by far the simpliest way to save rules and check them # chkconfig --list | grep iptables
Note: chkconfig iptables on only needs to be run once to turn the service on
sudo chkconfig iptables on
sudo service iptables save