SNAT and DNAT
IPLOCAL=a.b.c.d IPREMOTE=x.y.z.w echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING -p tcp --dport 33307 -j DNAT --to-destination ${IPREMOTE}:3306 iptables -t nat -A POSTROUTING -p tcp -d ${IPREMOTE} --dport 3306 -j SNAT --to-source ${IPLOCAL}