My old post to set up a small rules set for iptables is deprecated so I decided to update this post and improve some rules.
This time I tested this iptables setup on my Raspberry Pi. I connected to my Pi via SSH and the first time I tested the rules order I locked myself out and I had to connect the monitor and keyboard to fix this. The rule order in this post worked for me to set everything up via SSH.
I also tried this setup on a virtual machine and made a screencast of it. You can find the video at the end of this post.
In this how-to I will give you an introduction to iptables and show you how to set up a small rule set for iptables. If you want more detailed information I recommend the man page of iptables (its great).
This post is deprecated
I wrote an updated version: click here