Original: http://www.xuebuyuan.com/730127.html
Use of iptables see Http://wiki.ubuntu.org.cn/IptablesHowTo
After the iptables configuration is complete, the rules are automatically applied immediately, but after the machine restarts, the rules are lost
Under Ubuntu, you can save Iptables settings by following these steps, and enable automatic loading
1, iptables after the configuration is done manually save
Execute Iptables-save >/etc/iptables.up.rules, save the current configuration in Iptables.up.rules file, the filename can be arbitrary.
The command to switch to root user execution, sudo will prompt for no permissions, or you can modify the/etc/iptables.up.rules permissions,
sudo chmod a+w/etc/iptables.up.rules, then you can directly execute Iptables-save >/etc/iptables.up.rules.
Looking at the file, you can see that the Iptables rules are recorded.
2. Modify the NIC configuration file
Add a line to the last line of the NIC IP profile/etc/network/interfaces pre-up Iptables-restore </etc/iptables.up.rules
Where:/etc/iptables.up.rules is the configuration file location and name that you customized in the first step
3. Restart Server verification
Ubuntu Boot auto-load iptables configuration (RPM)