Ssh – How to route outgoing traffic through a PPTP VPN connection on a VPS without losing SSH access

routingsshvpn

I'm using a virtual Ubuntu Server (on Amazon EC2) and I want to connect to a PPTP VPN server to route outgoing traffic through this connection. To do this, I specify the following two options:

defaultroute
replacedefaultroute

This works – but the moment the tunnel to route the traffic is established, my SSH connection to the server is broken and I can't reconnect. This makes sense, but is nevertheless a real problem. Any ideas for a workaround? How can I route outgoing traffic through the VPN connection and still be able to SSH into the machine?

Best Answer

Traffic routes are determined by routing tables. The best way to preserve your SSH connection is to configure a static route that defines the non-VPN gateway as the way to reach wherever it is you're coming from. This prevents the server from trying to route your SSH traffic over the VPN, which you don't want.

Related Topic