The application of Iptables

Source: Internet
Author: User
Tags filter pack iptables linux

Absrtact: This paper introduces the principle and configuration of Firewall tool--iptables in linux2.4.x kernel, and also gives the example of practical application, and concludes the difference between iptables and ipchains in the end of the article.

I. Overview

Starting with the 1.1 kernel, Linux already has a packet-filtering function, and in the 2.0 kernel we use IPFWADM to manipulate the kernel-pack-and-go rule. After that, in the 2.2 kernel, we used ipchains to control the kernel-pack-and-go rule. Now that the latest Linux kernel version is 2.4.1, we are no longer using ipchains in the 2.4 kernel, but using a completely new kernel-packet-management tool--iptables. This new kernel-pack-filtering tool will make it easier for users to understand how they work, easier to use, and, of course, more powerful.

We said Iptables is just a tool for managing kernel-pack filtering, iptables can add, insert, or delete rules in the core Package filter form (chain). Actually, the netfilter (a common architecture in the Linux core) and its associated modules (such as the Iptables module and the NAT module) are the real ways to implement these rules, so let's look at how the NetFilter works.

Second, the principle

NetFilter is a common architecture in the Linux core, which provides a series of "tables", each consisting of a number of "chains" (chains), each of which can consist of one or several rules (rule). We can understand that NetFilter is the container of the table, the table is the container of the chain, and the chain is the container of the rules (as shown in figure).

The default table for the system is "filter", which contains input, forward, and output 3 chains. Each chain can have one or several rules, each one of which is defined as "if the packet header meets such a condition, the packet is processed". When a packet arrives at a chain, the system starts checking from the first rule to see if it meets the conditions defined by the rule: if satisfied, the system will process the packet according to the method defined by the rule, and continue to check the next rule if it is not satisfied. Finally, if the packet does not conform to any of the rules in the chain, the system processes the packet according to the predefined policy (policy) of the chain.



Related Article

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.