Ssh – Can you connect to a VPN through an SSH reverse tunnel

sshssh-tunnelvpnvpn-client

Say I have two machines, both running Linux;

Machine A is running a VPN server and is behind a NAT.

Machine B is the VPN client.

Machine A creates a reverse SSH tunnel from itself to Machine B, exposing a port on Machine B that connects back to the VPN running on Machine A.

How can I connect to Machine A's VPN server from Machine B through the SSH reverse tunnel?

Best Answer

A SSH tunnel only works with TCP, so your VPN server must be configured to use TCP for connections. You connect the the tunnel endpoint on Machine B just as you would connect to Machine A. In other words, just replace the ip address and destination port in your client configuration.