3

I am trying to translate the SSH command:

ssh -N -L 1521:server1.com:1521 username@server2.com

into PuTTY.

  • -N: Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
  • -L [bind_address:]port:host:hostport: Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.

The command first SSH to user_name@server2.com, which in turn connect to server1 so that it fowarrds port 1521 (server behind NAT).

In a more abstract way, the command could be written as:

ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER

I tried to write the following PuTTY command:

putty -N -D 1521 -P 1521 server2.com username@server1.com

with:

  • -N: suppress starting a shell or command.
  • -D: set up SOCKS-based dynamic port forwarding on a local port.
  • -P: specify a port number

according to the PuTTY manual.

However I get:

enter image description here

What could be the issue?

I disabled the firewall, and checked that putty.exe allowed to communicate with Internet.


Using the PuTTY GUI, the tunnel works with the following configuration:

enter image description here

enter image description here

enter image description here

enter image description here

  • 2
    If all you need is just forward port - you can use plink 'plink -ssh -N -L 1521:server1.com:1521 username@server2.com' – ALex_hha Mar 23 '16 at 11:52
  • ... or you could install Cygwin and use OpenSSH like you normally would. ;) – n.st Apr 2 '16 at 11:32
  • @n.st Thanks, sure, actually there is an OpenSSH for Windows, and their ssh.exe works fine :) – Franck Dernoncourt Apr 2 '16 at 13:25
4

I am trying to translate the SSH command ssh -N -L 1521:server1.com:1521 username@server2.com into PuTTY.

If all you need is just forwarding port - you can use plink instead

> plink.exe -ssh -N -L 1521:server1.com:1521 username@server2.com

I'd curious how to fix the putty.exe command as well

the same things

> G:\putty.exe -ssh -P 2222 -N -L :2222:192.168.88.130:2222 root@node1.example.net -i C:\Users\ALex\.ssh\node1.ppk

enter image description here

  • Thanks, +1 that works. (I'd curious how to fix the putty.exe command as well) – Franck Dernoncourt Mar 23 '16 at 17:37
1

Putty requires the protocol to be mentioned as well. Since you are using ssh, add '-ssh' option as well. You can refer the following link :

putty command line options

So a simple command would look like:

putty.exe -ssh -P 22 admin@server
  • Thanks, but I don't have shell access on server2, and I just want to tunnel through it. I tried putty -ssh -N -D 1521 -P 1521 server2.com username@server1.com, it didn't work either. ` – Franck Dernoncourt Mar 23 '16 at 17:42
0

It might have to do with your ability/inability to assign a port on the local computer. Try running puTTy with administrative privileges on your local machine.

  • 1
    On windows you don't need any additional privileges to bind ports > 1024 – ALex_hha Mar 23 '16 at 22:16

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.