Ssh – VPN connection over SSH

sshtunnelingvpn

I'm behind a firewall which only allow ports 80 and 443 out.

I have an Ubuntu server at home which got an SSH server running on 443 and it works fine. Therefore I can tunnel my traffic behind this firewall through SSH.

However, I want to make an VPN connection between the computer behind the firewall and the server via SSH, to make ALL internet connections go through the tunnel without being needed to configure a proxy on every application I need to tunnel.

The computer behind the firewall uses Windows XP.

Is this possible?

Best Answer

Yes, piece of cake!

Your WindowsXP box would need to become the default route for all your other computers. I do this often using a similar technique to tunnel traffic through an HTTP proxy firewall.

Couple things you need to do:

  1. On your ubuntu server, locate the sshd.conf file and enable, if not already GatewayPorts yes

  2. Install Putty on your WinXP computer and configure a connection from WinXP to your Ubuntu server and under the Tunnels section, create some tunnel entries making sure to check the box "Local ports accept connections from other hosts", then use some random unprivledged ports. You should have a list like so:

L5000 1.2.3.4:443 where 5000 is the local port you listen on and 1.2.3.4 is your ubuntu server.

  1. Now you need to enable Routing and Remote Access service under the services (right click My Computer, manage & navigate to services section). Once enabled, need to edit the following RegKey: HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > Tcpip > Parameters and look for something like “IPEnableRouter”. Double click on it and turn the value from 0 to 1 and reboot your computer.

  2. After the reboot, pop open a command prompt and type some commands:

    netsh routing ip nat install netsh routing ip nat add interface "if-public" full (where if-public is the interface used to connect to ubuntu server) netsh routing ip nat add interface "if-private" private

It should be obvious that your WinXP machine cannot be using DHCP; you'll need static IP assignments here.

Related Topic