How to save the firewall rules of iptables

Source: Internet
Author: User

Save iptablesOfFirewallThe rules are as follows:

Solution:

The rules created by the iptables command are temporarily stored in the memory. If the system restarts before permanently saving these rules, all the rules will be lost. If you want the rules set by iptables to take effect after the system is restarted next time, you need to permanently save these rules and run them as root:

/Sbin/service iptables save

This operation runs the iptables initialization script, which runs the/sbin/iptables-save program and updates the current iptables configuration file/etc/sysconfig/iptables.

The original configuration file is saved as iptables. save.

The next time the system starts, the iptables initialization script will use the/sbin/iptables-restore command to re-read the content of the/etc/sysconfig/iptables file.

Therefore, it is better to check the rule before submitting a new iptables rule to the/etc/sysconfig/iptables file. You can also apply the iptables configuration file in other versions of the system here. This helps to distribute the configuration file to multiple Linux Hosts.

Note: After distributing the/etc/sysconfig/iptables file, each system will execute the/sbin/service iptables restart command to make the rule take effect.

The article shows whether the above method is used to solve the problem of saving the firewall rules of iptables. Share it with your friends!

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.