Chains of rules are organized into Tables. Netfilter currently has three tables.
Mangle Table - This allows the contents of the packet to be changed. Shorewall uses rules in this table to mark packets for traffic shaping/control (/etc/shorewall/tcrules file) and for setting the Type of Service (TOS) for the packet (/etc/shorewall/tos).
NAT Table - Allows modification of the source and destination IP and port.
Filter Table - This is where most ACCEPT/DROP/REJECT decisions are made in Shorewall.
Each table has a number of pre-defined chains as shown in the table that follows. Packets flow through the chains in the order of that table.
Ordinal | Table | Chain | Shorewall Usage | Comments |
1 | Mangle | PREROUTING |
|
|
2 | NAT | PREROUTING |
|
Only connection requests go here -- packets that are part of or related to an established connection use information from the connection tracking table. |
3 | Filter | INPUT | <zone>2fw filtering | |
3 | Filter | FORWARD | <zone>2<zone> filtering | |
3 | Filter | OUTPUT | fw2<zone> filtering | |
4 | Mangle | POSTROUTING | TOS | |
5 | NAT | OUTPUT | DNAT rules where the source zone is fw | Only connection requests go here -- packets that are part of or related to an established connection use information from the connection tracking table. |
5 | NAT | POSTROUTING |
|
Only connection requests go here -- packets that are part of or related to an established connection use information from the connection tracking table. |
The connection tracking table can be displayed using the "shorewall show connections" command.