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
- RFC 1918 Destination Rejections
- Marking Packets for Traffic Control
- TOS
2 NAT PREROUTING
- DNAT Rules
- Static NAT DNAT mapping
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
- Masquerading (/etc/shoreawll/masq)
- SNAT (/etc/shorewall/masq)
- Static NAT SNAT Mapping
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.