I'm sure many of you have been wondering how to use iptables to set up a basic firewall. I was wondering the same thing for a long time until I recently figured it out. I'll try to explain the basics to at least get you started.
http://www.justlinux.com/nhf/Security/IPtables_Basics.html