SSH – How to Create Tunnel Over Multiple Hops Using PuTTY

puttysshtunnel

I have these config:
Host with putty — > Gateway A (port 22 open) –> FinalMachine (port 22 with gateway A open and port 18080 with apache).

Like I don't have communication from Host with putty with FinalMachine I would like to tunneling the connection to can connect directly from Host to 18080 of FinalMachine.

I'm trying to do with putty but I can't find the solution.
Anyone could help me please? Thanks!

Best Answer

Method 1, using 2 instances of putty

  • Putty 1: Local forward 20022:GatewayB:22, Connect to GatewayA
  • Putty 2: Local forward 18080:FinalMachine:18080, Connect to localhost:20022

Method 2:

  • Putty Local forward 18080:127.0.0.1:18080,
    • From within session do next step ssh -L 18080:FinalMachine:18080 GatewayB