IPtables tricks
iptables -t nat -I PREROUTING -p tcp –destination-port
- redirecting incoming packets to other ports
iptables -t nat -I POSTROUTING -o
- all packets that would go through internet connected interface will be maqueraded
I recently found out that this redirect doesn’t work for traffix generated to the local interface. Following the advice from [this list](http://lists.netfilter.org/pipermail/netfilter/2004-March/051478.html) I made it to work (I don’t know if you need some special kernel options as they suggested it just worked for me on 2.6.x).
iptables -t nat -I OUTPUT -p tcp –destination-port