How to chain SSH tunnels using PuTTY
Posted | archive
Here’s a simple tutorial of how to setup a chained SSH tunnel with two SSH hosts.
- Open PuTTY and connect to your first (nearest to you) ssh node
- In the console, connect to your final ssh (which IP will be shown as an exit of chained tunnel) like this:
ssh -CfNg -D 127.0.0.1:8787 user@hostname
- Right click putty title bar for context menu and click
Change settings
, like the following screenshot:
This settings means, PuTTY will listen on your local machine port 7777, and forward everything to 127.0.0.1:8787 on the first ssh server. Since in step #2 we have 127.0.0.1:8787 already there listening as a socks5 tunnel, the chain SSH tunnel is complete.
Picture provided by ditaa.org using a nice ASCII2Graph tool called ditaa
If you understand how to chain SSH tunnel using two ssh nodes, it’s easy to expanding it to three or more.
Comments