How to redirect a port to another IP and port with iptables on Linux

Linux

You can use the following shell commands to redirect a port to another port.

PORT_FROM=443 
PORT_TO=443 
DEST=10.33.35.110 
iptables -t nat -A PREROUTING -p tcp --dport $PORT_FROM -j DNAT --to $DEST:$PORT_TO 
iptables -t nat -A POSTROUTING -p tcp -d $DEST --dport $PORT_TO -j MASQUERADE