OpenVPN - Client Port Forwarding
Oct 21, 2017
An SSH tunnel will be much faster and I recommend using that with autossh
instead if possible.
Example:
$PUBLIC_IP=1.1.1.1
$SERVER_TUN_IP=172.16.0.1
$CLIENT_TUN_IP=172.16.0.2
iptables -t nat -A PREROUTING -d $PUBLIC_IP -p tcp --dport 80 -j DNAT --to-dest $CLIENT_TUN_IP:80
iptables -t nat -A POSTROUTING -d $CLIENT_TUN_IP -p tcp --dport 80 -j SNAT --to-source $SERVER_TUN_IP