What kernel version are you using ?
Kernel 2.4.x => use iptables
Kernel 2.2.x => use ipchains
Kernel 2.0.x => use ipfwadm
If you want to learn more about iptables (ipchains and ipfwadm).
Take a look at the documentation and Tutorials at Netfilter / iptables
http://www.netfilter.org/
If you want a quick way to setup a firewall.
Try the following software.
Firestarter
http://firestarter.sourceforge.net/
Shorewall
http://www.shorewall.net/
Firegate
http://firegate.sourceforge.net/