iptables setup on Ubuntu

Install the Persistent Firewall Service

sudo apt-get update
sudo apt-get install iptables-persistent

Save your running iptable rules to a file

sudo iptables-save > /path/to/my/firewall-rule

Restore from saved rules immediately

sudo iptables-restore < /my/firewall-rule

Reload your iptable immediately for 10 seconds for testing

sudo iptables-apply -t 10 your_rules_file

Save your iptable permanently. Survives even after reboot

sudo invoke-rc.d iptables-persistent save

Leave a Comment

Your email address will not be published. Required fields are marked *