How to setup an ssh tunnel to an internal network’s web server from outside the internal network using Putty

puttyssh-tunnel

Here's my situation.

  • At work there's an internal network.
  • I can access the work network from home by ssh'ing to a linux box that faces both the internet and the internal network.
  • The work network has another linux box running a web server.
  • I want to connect to the web server on the second linux box with my windows box at home.
  • The web server uses many vhosts.
  • My home network uses ip addresses like 192.168.1.1.
  • My work networks uses up addresses like 192.168.0.1.

I think I can achieve this using ssh tunnels but I'm not clear on what settings to use in Putty and I'm not sure what to put in my hosts file for the vhosts.

Thanks for the help!

Best Answer

Okay... This is very possible with Putty though not as easy as with OpenSSH on a Linux machine. I would very much recommend setting up an SSH identity key and installing it on the boxes that you are connecting to and use the Putty Agent (pagent.exe) key forwarding agent. That said here is the steps to take.

First, create a Putty connection profile for your work Linux box that you can reach from home. You'll want to be sure under Connection -> Data that you set your Auto-login username. Then under Connection -> SSH -> Auth be sure that Allow agent forwarding is checked. Now save this profile and make note of the name you call it (ie- work-jumpbox).

With this setup you now want to setup a second profile for the box behind the work jumpbox. Set this profile up with the correct host name/IP address and port of the webserver in the office. You then want to go to Connection -> Data -> Proxy and set the Proxy Type to local and set the Telnet command or local-proxy-command to plink -load work-jumpbox -nc %host:%port\n (replace work-jumpbox with whatever you called your previous profile for the work linux box.

Now save this profile (ie- work-webserver) and when you want to connect to it load it and click connected it should log you into the office web server after it logs into the jumpbox silently.