Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux_router:netfilter [2024-06-23 Sun wk25 08:56] – [Relationships Between Chains and Tables] baumkp | linux_router:netfilter [2024-06-23 Sun wk25 09:11] (current) – baumkp | ||
---|---|---|---|
Line 46: | Line 46: | ||
| | ||
</ | </ | ||
+ | |||
+ | |||
+ | =====IPTables and Netfilter===== | ||
+ | The following is taken from Digitalocean [[https:// | ||
+ | |||
+ | ++++ tldr| | ||
+ | |||
+ | ====IPTables Tables and Chains==== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | Within each '' | ||
+ | |||
+ | The names of the built-in chains mirror the names of the '' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | *'' | ||
+ | |||
+ | Chains allow the administrator to control where in a packet’s delivery path a rule will be evaluated. Since each table has multiple chains, a table’s influence can be exerted at multiple points in processing. Because certain types of decisions only make sense at certain points in the network stack, every table will not have a chain registered with each kernel hook. | ||
+ | |||
+ | There are only five '' | ||
+ | |||
+ | ====Which Tables are Available? | ||
+ | |||
+ | Let’s step back for a moment and take a look at the different tables that '' | ||
+ | |||
+ | ===The Filter Table=== | ||
+ | The filter table is one of the most widely used tables in '' | ||
+ | |||
+ | ===The NAT Table=== | ||
+ | The '' | ||
+ | |||
+ | ===The Mangle Table=== | ||
+ | The '' | ||
+ | |||
+ | This table can also place an internal kernel “mark” on the packet for further processing in other tables and by other networking tools. This mark does not touch the actual packet, but adds the mark to the kernel’s representation of the packet. | ||
+ | |||
+ | ===The Raw Table=== | ||
+ | The '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ===The Security Table=== | ||
+ | The '' | ||
====Relationships Between Chains and Tables==== | ====Relationships Between Chains and Tables==== | ||
Line 80: | Line 126: | ||
==== IPTables and Connection Tracking==== | ==== IPTables and Connection Tracking==== | ||
- | We introduced the connection tracking system implemented on top of the netfilter framework when we discussed the raw table and connection state matching criteria. Connection tracking allows iptables to make decisions about packets viewed in the context of an ongoing connection. The connection tracking system provides iptables with the functionality it needs to perform “stateful” operations. | + | We introduced the connection tracking system implemented on top of the '' |
- | Connection tracking is applied very soon after packets enter the networking stack. The raw table chains and some sanity checks are the only logic that is performed on packets prior to associating the packets with a connection. | + | Connection tracking is applied very soon after packets enter the networking stack. The '' |
- | The system checks each packet against a set of existing connections. It will update the state of the connection in its store if needed and will add new connections to the system when necessary. Packets that have been marked with the NOTRACK target in one of the raw chains will bypass the connection tracking routines. | + | The system checks each packet against a set of existing connections. It will update the state of the connection in its store if needed and will add new connections to the system when necessary. Packets that have been marked with the '' |
- | Available States | + | |
+ | ===Available States=== | ||
Connections tracked by the connection tracking system will be in one of the following states: | Connections tracked by the connection tracking system will be in one of the following states: | ||
- | | + | *'' |
- | ESTABLISHED: | + | |
- | RELATED: Packets that are not part of an existing connection, but are associated with a connection already in the system are labeled RELATED. This could mean a helper connection, as is the case with FTP data transmission connections, | + | |
- | INVALID: Packets can be marked INVALID if they are not associated with an existing connection and aren’t appropriate for opening a new connection, if they cannot be identified, or if they aren’t routable among other reasons. | + | |
- | UNTRACKED: Packets can be marked as UNTRACKED if they’ve been targeted in a raw table chain to bypass tracking. | + | |
- | SNAT: This is a virtual state set when the source address has been altered by NAT operations. This is used by the connection tracking system so that it knows to change the source addresses back in reply packets. | + | |
- | DNAT: This is a virtual state set when the destination address has been altered by NAT operations. This is used by the connection tracking system so that it knows to change the destination address back when routing reply packets. | + | |
The states tracked in the connection tracking system allow administrators to craft rules that target specific points in a connection’s lifetime. This provides the functionality needed for more thorough and secure rules. | The states tracked in the connection tracking system allow administrators to craft rules that target specific points in a connection’s lifetime. This provides the functionality needed for more thorough and secure rules. | ||
+ | ++++ | ||
====Some references==== | ====Some references==== |