[clug] Why is my SSH port forwarding failing all of a sudden?

Tony Lewis tony at lewistribe.com
Tue Feb 2 11:31:23 UTC 2016


On 02/02/16 22:18, Chris Smart wrote:
>
> This looks like you're sshing to localhost on port 55554, is that what
> is supposed to happen when you ssh to "remotehost?" Did you point the
> remotehost to localhost in /etc/hosts or something?

Sorry for the obfuscation.

There are three machines  concerned: client, tunnel and server.

The client ssh (Cygwin) has a config like this:

Host tunnel
   HostName tunnel.fqdn
   Port 12345
   User tunnel
   LocalForward 55554 server.local:22

Host serverlocal
   HostName localhost
   Port 55554

so I can "ssh -N tunnel" which translates to "ssh -p 12345 -L 
55554:server.local:22 tunnel at tunnel.fqdn"

And once the tunnel is established I can "ssh user at serverlocal" which 
translates to "ssh -p 55554 localhost", which should tunnel through the 
established connection to tunnel.fqdn and establish a connection to what 
the tunnel server knows as server.local

The config file is just to enable me to give shorthand names to mappings.



> Also, in the more recent reply above you said that regular SSH worked 
> and that SSH *only* failed when you tried to forward ports (-L 
> option), but that command is failing on regular SSH. So I'm a bit 
> confused. Can you post the exact command you're using to ssh 
> port-forward and just swap out the remote IP for "remoteip" and swap 
> out the ip address of the machine you're forwarding ports to with 
> "forwardip" or something? -c 

So when I am home (no need for tunneling) "ssh user at server.local" just 
works.  It works from tunnel and it works from client.

Hope that clears things, and I appreciate the help so far.

Tony




More information about the linux mailing list