Sunday, June 12, 2011

Apache and other services in alternative ports on Dynamic IP hosting

If you don't want to mess up with Apache and other mail services on alternative port esecially on dynamic hosting,then there is a easy way out:
Issue this command:


iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $srcPortNumber -j REDIRECT --to-port $dstPortNumber


So if you want to redirect port 81 to Apache:


iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 81 -j REDIRECT --to-port 80


So you can set up alternative port in your Dynamic DNS provider and host your own server.