In a lot of network setups users are forced to use some kind of gateway server or bastion host to connect to their target server via SSH. Being able to connect to the target server with one click via putty saved me a lot of time.

Putty network diagram Given a common network setup like in the picture above, the first step is to set up a putty connection to gateway.example.com. You have to use a non-interactive authentication method like public key authentication using pagent. Then you save connection under a memorable name (e.g. gateway) so that it appears in the connection list in putty.

Now you can create the connection to the actual target. Put in the hostname/ip as you would reach it from the gateway. Then go to the connection/proxy screen and fill the following fields:

  • Proxy type: Local
  • local proxy command: plink.exe -load <CONNECTION NAME> -nc %host:%port \n

Putty proxy configuration

After saving the connection you will be able to connect to your target host by simple opening the saved connection to the target host. The connection through the gateway will be automatically opened by putty in the background.