How to configure putty for 3 hop ssh tunnel connection?
It's not clear if you are just wanting to connect to an additional machine on the same network as Linux Machines 1/2 or if you need to jump to another network beyond them (for example Machine 4 on 172.22.1.x).
If you're simply trying to get to another machine on the same 192.168.1.x network as Linux Machine 1/2, use an actual SSH Tunnel (found under Putty's Connection -> SSH -> Tunnels
menu). You can set up multiple tunnels to as many machines as you need to.
If you are actually trying to get to a third network, you can open up another instance of Putty that connects via a tunnel defined on your original Putty instance.
- Define a tunnel in Putty that forwards a port on your local machine (2222 for example) to Port 22 on Linux Machine2
- Then open another Putty instance on your Windows Machine that uses the tunnel (i.e. connect to Localhost:2222) AND defines a new tunnel to forward an additional port (2223 for example) to Port 22 on Machine4 (your 3rd hop).
- Open one more instance of Putty and connect to Localhost:2223 to access Machine4
I've only ever done this with 2 hops so I don't know how it will perform. It's not an ideal solution, but it may work if this is your only option.
Edit: If you're not limited to Windows/Putty, this (Transparent Multi-hop SSH) may do what you want. If you are limited to Windows, Cygwin may have some more flexible SSH tools.
Related videos on Youtube
karthick87
Hi my name is Karthick,completed B.Tech Information Technology.I have started using ubuntu in the year 2008, at that time i used dual boot with windows.I have completely shifted to ubuntu in the last year.And i have been helping people in irc,ubuntuforums and askubuntu. My wiki page: Click here My ubuntuforums Profile: Click here My Launchpad Profile: Click here
Updated on September 18, 2022Comments
-
karthick87 almost 2 years
How do I configure Putty for a 3 hop SSH tunnel connection? I know how to configure Putty for a 2 hop SSH tunnel connection, but now I am looking for a way to configure it with 3 hops. Can someone explain to me the procedure on how we can achieve it?
For two hops, I am following the below method.
Windows 10 (Putty) --> Linux Machine1 (192.168.1.100) --> Linux Machine2 (192.168.1.150)
- In the session window given the destination address (192.168.1.150) and port 22.
- In the Proxy option, I have given the intermediate server IP (192.168.1.100) and port 22.
- Also for the telnet command, I have given the following.
plink -agent -l %user %proxyhost -nc %host:%port
The above setup works fine for 2 hops. But now my requirement is a 3 hop SSH tunnel. How do i modify the current one and add 1 more hop?
-
karthick87 almost 8 yearsYes my requirement is to get to a third network. I will try out this solution.. But just thinking if this could be configured in single putty instance.. Than creating 2 different instances.
-
karthick87 almost 8 yearsActually host b can be accessed only from host a and host c can only be accessed from hostb. So from my windows machine i need to pass 3 hops to reach the destination (hosta, hostb, hostc).
-
thephez almost 8 yearsI can't think of a way to do this without multiple Putty instances. Basically, you're using Putty as a virtual router to connect networks that aren't physically connected.