3.4 More Information on Masquerading David Ranch has written an excellent new HOWTO on Masquerading, which has a large amount of overlap with this HOWTO. You can currently find that HOWTO at
4. IP Firewalling Chains
4.1 How Packets Traverse The Filters
4.1.1 Using ipchains
4.1.2 Operations on a Single Rule
4.1.3 Filtering Specifications
4.1.3.1 Specifying Source and Destination IP Addresses
4.1.3.2 Specifying Inversion
4.1.3.3 Specifying Protocol
4.1.3.3.1 Specifying UDP and TCP Ports
4.1.3.3.2 Specifying ICMP Type and Code
4.1.3.4 Specifying an Interface
4.1.3.5 Specifying TCP SYN Packets Only
4.1.3.6 Handling Fragments
4.1.4 Filtering Side Effects
4.1.4.1 Specifying a Target
4.1.4.2 Logging Packets
4.1.4.3 Manipulating the Type Of Service
4.1.4.4 Marking a Packet
4.1.4.5 Operations on an Entire Chain
4.1.4.6 Creating a New Chain
4.1.4.7 Deleting a Chain
4.1.4.8 Flushing a Chain
4.1.4.9 Listing a Chain
4.1.4.10 Resetting (Zeroing) Counters
4.1.4.11 Setting Policy
4.1.5 Operations on Masquerading
4.1.6 Checking a Packet
4.1.7 Multiple Rules at Once and Watching What Happens
4.2 Useful Examples
4.2.1 Using ipchains-save
4.2.2 Using ipchains-restore
5. Miscellaneous.
5.1 How to Organize Your Firewall Rules
5.2 What Not To Filter Out
5.2.1 ICMP packets
5.2.2 TCP Connections to DNS (nameservers)
5.2.3 FTP Nightmares
5.3 Filtering out Ping of Death
5.4 Filtering out Teardrop and Bonk
5.5 Filtering out Fragment Bombs
5.6 Changing Firewall Rules
5.7 How Do I Set Up IP Spoof Protection?
5.8 Advanced Projects
5.8.1 SPF: Stateful Packet Filtering
5.8.2 Michael Hasenstein's ftp-data hack
5.9 Future Enhancements
6. Common Problems
6.1 ipchains -L Freezes!
6.2 Masquerading/Forwarding Doesn't Work!
6.3 -j REDIR doesn't work!
6.4 Wildcard Interfaces Don't Work!
6.5 TOS Doesn't Work!
6.6 ipautofw and ipportfw Don't Work!
6.7 xosview is Broken!
6.8 Segmentation Fault With `-j REDIRECT'!
6.9 I Can't Set Masquerading Timeouts!
6.10 I Want to Firewall IPX!
7. A Serious Example.
7.1 The Arrangement
7.2 Goals
7.3 Before Packet Filtering
7.4 Packet Filtering for Through Packets
7.4.1 Set Up Jumps From forward Chain
7.4.2 Define the icmp-acc Chain
7.4.3 Good (Internal) to DMZ (Servers)
7.4.4 Bad (external) to DMZ (servers).
7.4.5 Good (internal) to Bad (external).
7.4.6 DMZ to Good (internal).
7.4.7 DMZ to bad (external).
7.4.8 Bad (external) to Good (internal).
7.4.9 Packet Filtering for the Linux Box Itself
7.4.9.1 Bad (external) interface.
7.4.9.2 DMZ interface.
7.4.9.3 Good (internal) interface.
7.5 Finally
8. Appendix: Differences between ipchains and ipfwadm.