Linux: Network Firewall principle

Source: Internet
Author: User

Linux: Network Firewall

Netfilter:frame

Iptables: Data packet filtering, Nat,mangle and other rules-generated tools


Network: IP packet header, TCP packet header


Firewall: Hardware, Software: rules (matching criteria, handling methods)


Framework:

Default rule:

Open: Blocking

Off: Pass

Rules: Matching Criteria

IP: Source IP, Destination IP

TCP: Source port, Destination port

TCP Three-time handshake: syn=1,fin=0,rst=0,ack=0;

syn=1,ack=1,fin=0,rst=0;

Ack=1,syn=0.rst=0,fin=0 (established);

UDP: Source port, Destination port

Icmp:icmp-type


Data message filtering:

Linux2.0

Ipfw/firwall

Linux2.2

Ipc

Linux2.4

Iptables/netfilter

hook function: Hook functions

Prerouting

Input

Output

Forward

Postrouting

Rule chain:

Filter (filtered): Table

INPUT

OUTPUT

FORWARD

Nat (address translation): Table

Prerouting

OUTPUT

Postrouting


Mangle (Modify message header, disassemble, modify, package): Table

Prerouting

Input

Output

Forward

Postrouting


Raw ():

Prerouting

OUTPUT

Iptables


Custom chains: can only function when called, and there should be a return mechanism if none of the rules in the custom chain match.

User can delete a custom empty chain

Default chain cannot be deleted


Each rule has a built-in counter

The number of packets to be matched

The sum of the size of the packets being matched to


Rules: Matching criteria, handling actions


iptables [-t TABLES] COMMAND CHAIN [num] matching standard-j processing method


Matching Criteria:

Generic match:

-S,--src specify the original address

-D,--dst specify Destination address

-P, {TCP|UDP|ICMP}: Specify protocol

-I, INTERFACE: Specifies the interface to which the data packet flows

Chains available for definition: Prerouting,input,forward

-O, INTERFACE: Specifies the outgoing interface of the data message

can be used for standard definition of chain Output,postrouting,forward

Extended match:

Implied extension: Do not specifically indicate which module is being extended, because the-p {tcp|udp|icmp} is used at this time

Show extensions: You must indicate which module is being extended and use the-M option in iptables to complete this function


-j TARGET

ACCEPT

DROP

REJECT





This article from "Operation and maintenance Growth Road" blog, declined reprint!

Linux: Network Firewall principle

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.