iptables

man iptables

sudo iptables-save > ~/iptables-out-default
sudo apt install iptables-persistent
sudo systemctl is-enabled netfilter-persistent.service

sudo iptables -L
sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 80   -j ACCEPT
sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 443  -j ACCEPT
sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 8082 -j ACCEPT
sudo /sbin/service iptables save

sudo iptables-save > ~/iptables-out
sudo /sbin/iptables-restore <  ~/iptables-out

linux - Cannot access port 80 from remote location but works on local? - Server Fault How to save iptables firewall rules permanently on Linux - nixCraft