Examples: Saving and Restoring Iptables Rules

To restore rules automatically upon Linux system reboot add following command to your /etc/rc.local file, enter:# vi /etc/rc.local
Append the line:/sbin/iptables-restore < /root/dsl.fw
Save and close the file. Please note that under Red Hat enterprise Linux (RHEL) / CentOS / Fedora Linux you can use following commands to save and restore firewall rules. To Save the rules to /etc/sysconfig/iptables file:# /etc/init.d/iptables save
To restore the rules from /etc/sysconfig/iptables file:# /etc/init.d/iptables start
If you are using Debian / Ubuntu Linux open /etc/network/interfaces:# vi /etc/network/interfaces
Append the line to eth0 section:post-up iptables-restore
Close and save the file. Reboot the system.