0

My desktop home computer (see the image below) connects via SSH to the Office Server (via internet, of course).

I connect to that server from my home desktop (running Linux) by using the OpenSSH client from Linux (note the -g for "gateway" switch):

ssh MyUser@OfficePublicIP -L 22222:172.26.0.10:22 -g

So, when the connection is made, I have a running SSH tunnel to the server for my LAN:

luis@HomeDesktop:~$ netstat -ano | grep "22222" -i
tcp        0      0 0.0.0.0:22222           0.0.0.0:*               LISTEN      off (0.00/0/0)

And now I can go to my home laptop and open an SSH session to the office server via my Home Desktop (running Windows) using PuTTY by doing:

PuTTY 192.168.0.101 -P 22222

The process is shown in this scheme (follow the black line arrows):

Home Desktop acting as gateway to Office Server for my Home Laptop

The problem is: I need to run Windows on my home desktop, instead of Linux. And I certainly prefer to use the Putty SSH client (I like its terminal configurability).

But Putty v0.63 seems not to have this -g (gateway) option that allows external connections to forwarded (tunnelized) ports.

I have done a research through the putty help .chm file, but nor Putty neither its associated tool PLink seem to have this option.

Does anyone know how to tunnelize connections to the office server from my home desktop, but keep using PuTTY?

0

Well... in fact, if what you want is only the neat PuTTY window for writing in the remote SSH session, you can use it only for that, and establish the tunnel by using (simultaneously in another console) any other SSH client port from Linux to Windows.

For example, the OpenSSH client from CygWin should work OK:

$ ssh -V
OpenSSH_6.6p1, OpenSSL 1.0.1f 6 Jan 2014

$ ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

Syntax is, by the way, the same you are using when you run Linux on your home desktop.

ssh MyUser@OfficePublicIP -L 22222:172.26.0.10:22 -g
0

You can patch/simulate the gateway option by simultaneously running in your home desktop a simple port forwarder in another port.

For example, I often use Port Forwarding for Windows (I do prefer the "old command line utility", so I can automate it via scripting). In your case, say 11111TCP will be the "transitional" port:

c:\>trivial_portforward.exe 11111 127.0.0.1 22222

Check that both port are listening by doing (on your home desktop):

c:\>netstat -ano | grep "11111" -i
TCP    0.0.0.0:11111          0.0.0.0:0              LISTENING       6724

netstat -ano | grep "22222" -i
TCP    127.0.0.1:22222        0.0.0.0:0              LISTENING       6028

And now, you can do from your laptop:

c:\>PuTTY 192.168.0.101 -P 11111

The SSH connection must succees. At the same time you should see on the trivial_portforward console the confirmation:

received connection from 192.168.0.102
connection to 127.0.0.1:22222 established

NOTE: You must use 127.0.0.1 instead of localhost (remember that your problem is that there is no redirection with PuTTY but for 127.0.0.1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.