If you working with Linux or Unix (Open|Free)BSD, you probably got in situation to use their firewall tools. Linux has its iptables, and originally in OpenBSD there is pf ( packet filter )
Couple years ago, I gave an short presentation about these two firewall tools, you can find it at below link
I find it interesting as an comparative overview, but improvements are welcome.
It is under Creative common license