Article Title: iptables Firewall creates a secure network. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Security is always a constant topic on the Internet. Only when the network exists will there be security problems, and you will face the risk of being attacked. Use the iptables/netfilter network architecture after the Linux2.4 kernel to implement the packet filtering firewall. To some extent, it replaces the common functions of hardware firewalls to create a secure network environment.
The so-called "packet filtering" technology, that is, through the "quintuple" of matching data-Source ip, destination ip, source port, destination port and protocol (ip, tcp, udp, icmp ). A general network firewall ensures Intranet security by matching the data.
Iptables and netfilter
I. First, we need to clarify these two concepts:
1. the linux firewall is implemented by the linux kernel, rather than by the system's service programs. The linux kernel uses the netfilter architecture to implement this function.
2. iptables is only a management tool for netfilter. Implement firewall policies by managing iptables.
Ii. "Three Disciplines" and "five notes" in iptables"
1. Three disciplines: nat filter and mangle
2. five major notes: PREROUTING, FORWARD, POSTROUTING, INPUT, and OUTPUT
The architecture diagram is as follows:
-------- PREROUTING --- → [ROUTING] ----> FORWARD ----- → POSTROUTING Mangle| Mangle BytesMangle Nat| Filter |Nat
|
Optional |
INPUT OUTPUT
|Mangle|Mangle
BytesFilter|Nat Filter
| ------------ → Local ----------- → | |
Filter, nat, and mangel are rule tables, and the other five are rule chains. The rules are included in the chain, and the Rule chain is included in the rule table. Nat is used for address translation, filter is used for packet filtering (the most used is the IP address), and mangel is used for Policy Routing and Traffic Shaping (a bit QOS). The rule chain is allocated as follows:
* Filter: INPUT, FORWARD, and OUTPUT
* Nat: PREROUTING, POSTROUTING, and OUTPUT
* Mangel: PREROUTING, POSTROUTING, OUTPUT, INPUT, and FORWARD |
[1] [2] [3] Next page