Ubunto Server Make Firewall Rules Persist

Aly my friend was facing problem yesterday with his Ubuntu server iptables rules . after editing the rules it flushed every time after reboot.

Ubunto-Server

This is normal behavior for Ubuntu server but what if we need to make these rules persist after reboot , we tried many things , for me in RHEL it is piece of cake you just save it 😀

#/etc/init.d/iptables save

But with Ubuntu its little bit different , I made simple script to restore it from config file iun rc.local but it failed , and another script to start it after start the network service and it also failed.

So i used the easy way to handle such issues .. Just insert your rules on the active file for the iptables and no way to flush it.

– save your rules

#cat iptables.rules and it should contain your save one if not just save it
#cat iptables.rules > iptables.up.rules
#cat iptables.rules > /var/lib/iptables/active

#Viva Redhat 🙂

Advertisements