Port forwarding with PuTTY

A couple of days ago, while being at home, I had to access a couple of services for testing, that are under normal circumstances only accessible from the companies intranet.

While there is a VPN which I can access, my current internet provider lacks the desired bandwidth for normal work to be done via the VPN. For commodity reasons, or for others unknown to me, the company has a backdoor server, which grants me easy access on companies intranet.

Never having done before port forwarding, I looked it up a bit, and found the PuTTY articles of doing it rather confusion, from one point of view: not being verbose enough for the ones who never had to deal with port forwarding before.

I was already aware of the principle behind port forwarding, and if you aren’t I don’t think I can make it much clearer than the with following image[1].

SSH port forwarding diagram

For the port forwarding you need to have access to a ssh server that has port forwarding enabled (which is by default), and another server you cannot access; unless you are using port forwarding for other, more obscure reasons. Right?… right?

The two steps required in order to achieve port forwarding with PuTTY[2]:
Port forwarding with putty step 1
Port forwading with putty step 2

In the first step you add the IP/Hostname of the SSH server, while in the second step you set the local port and the destination of the port forwarding (with port number). After you click Add on the second step you can hit the Open button. The SSH server will pop up the terminal window and ask for the required credentials. After logging in you must leave the terminal window open.

From that point onward any connection done to the port 2000 (in my example) will forward to the destination you specified.

While this is a procedure which someone with half a brain could do[3], I was really stumped on it.

ssh -L 2000:destination.server:6667 ssh.server:22

Yes, if you have SSH client installed it is much easier. But we both know that under Windows the defacto SSH client is PuTTY.

  1. Image taken from here, copyright on the image is their as well.
  2. Yes, two steps, aside from the article I’ve read which had four steps, of which two have dealt with a little customization
  3. And that would make me practically brainless :)


Filed under Insight