Iptables rules save and restore under Linux __linux

Source: Internet
Author: User
Tags iptables

We can usually use iptables to set up some firewall rules in Linux systems.


Iptables-t nat-a output-p tcp-j REDIRECT * * * * * * * * * application, the rule is only saved in memory, and the next time it restarts, the/etc/sysconfig/iptables firewall configuration file is reloaded by default.
1. If you want to use the currently added rule after restarting, you can save the current rule to a configuration file by/sbin/service Iptables Save, which will perform the Iptables initialization script, and the script runs/sbin/ Iptables-save The program and updates the current iptables, and the original configuration file is saved as Iptables.save.
2. Generally we can specify the saved profile Iptables-save > config file name
Perform Iptables-restore < profile file name if you want to restore a configuration
3. After applying the iptables rule, you want to restore the local default rules, perform service iptables restart, and reload/etc/sysconfig/iptables files. (At this point it looks like Iptables-restore </etc/sysconfig/iptables doesn't work)

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.