Or if you struggle with creating the rules you might have a look at several building tools like firehol (http://firehol.sf.net), fwbuilder etc, to just build you more generic ruleset and let them generate the iptables commands for you.