This document describes a small portion of iptables and how to setup a basic firewall using iptables. There are many huge books on iptables so I cannot go into any sort of detail here. If you want to create a more advanced firewall, then I suggest installing shorewall and reading the documentation http://www.shorewall.net/Introduction.html about setting it up. I generally use shorewall on my systems and configure them using http://www.webmin.com/.