Most folks new and some experienced users think that the Linux kernel (2.4 & 2.6) comes with a built-in firewall named iptables. That is only the half of it.
Iptables is a part of the mechanism that provides the firewall capability of the Linux kernel, but it only provides the packet selection capability, and is built on top of the packet filtering capability known as Netfilter which forms the packet manipulation framework.
Together they form the modular capability of firewalling for the Linux kernel.
To get started in understanding Linux Firewalls and the Linux kernel's ability to render firewalling, network address translation (NAT), Port Address Translation (PAT), and many other capabilities like Stateful Packet Inspection (SPI), you need to read the following article in the Sans Institute Security Reading Room which can be downloaded at the following link and is entitled:
Netfilter and IPTables – A Structural Examination.
Be sure to download the referenced articles.
-- Tom