Detailed explanation of Linux system iptables rule execution order

Source: Internet
Author: User

Preliminary Knowledge (RPM): Iptable has three queue (table) rules, mangle queue, filter queue, Nat queue.

1. The mangle table which is responsible for the alteration of quality of service bits in the TCP header.

2. The second table is the filter queue which was responsible for packet filtering.

* Forward chain:filters packets to servers protected by the firewall.

* Input Chain:filters packets destined for the firewall.

* Output Chain:filters packets originating from the firewall.

3. The third table is the NAT queue which is responsible to network address translation. It has two built-in chains; These are:

* Pre-routing Chain:nats packets The destination address of the packet needs to be changed.

* Post-routing Chain:nats Packets when the source is the packet needs to be changed

Personal Summary:

When Iptables executes the rule, is executed from top to bottom from the rule table, if no matching rules are encountered, a single line is executed, if a matching rule is encountered, then the execution of these rules, followed by the actions of these rules (accept, reject, log, etc.), Deciding on the next step of implementation, there are generally three cases of follow-up execution.

1. One is to continue executing the next rule within the current rule queue. For example, after the log in the filter queue is executed, the next rule within the filter queue is also executed.

2. One is to abort execution of the current rule queue and go to the next rule queue. For example, you can break other rules in the filter queue from the execution of the accept and jump to the NAT queue rule to perform

3. One is to abort execution of all rule queues.



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.