How to Set Up an SSH Tunnel With PuTTY

Setting up SSH tunnels

There’s lots of articles on SSH tunneling, and plenty that cover how to create a tunnel with PuTTY, so why write another one? Because I spent longer than I should have trying to get this working the other day, and failing due to a simple order of operations issue. So I decided to spell it out step-by-step, for people like me who need that extra little bit of help.

Step 1 – Load the Gateway

First, if you have not already done so, create and save the SSH gateway server as you would any other. Next, select it from the Saved Sessions list and click ‘Load’ as shown below:

Putty Gateway

Step 2 – Configure the Tunnel

In the left-hand side nav tree, click Connection > SSH > Tunnels. Enter the port that you want to connect to locally under “Source port”. Then supply the destination address (the server that is available from your SSH gateway, but not from your local machine) as “Destination” as shown in the following image:

putty ssh tunnel

Step 3 – Open the Tunnel

Click “Add”, which will set the configuration as shown:

Then click “Open” to connect to your gateway. Login as usual. Now, as long as you leave that SSH terminal window open, all traffic to the Source Port on your localhost will be forwarded on to the Destination. If the destination port provides a web service, you can open a browser tab and visit http://127.0.0.1:8080 in this example, and you should see the service from the Destination server.