Ubuntu Boot auto-load iptables configuration

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.