Came from this question: What's ssh port forwarding and what's the difference between ssh local and remote port forwarding, I am confused about this usage:
ssh -L 123:farawayhost:456 remotehost
ssh -L sourcePort:forwardToHost:onPort connectToHost
means: connect with ssh toconnectToHost
, and forward all connection attempts to the localsourcePort
to portonPort
on the machine calledforwardToHost
, which can be reached from theconnectToHost
machine.
What does "..., which can be reached from the connectToHost
machine." mean exactly?
If I understand correctly, ssh -L 123:localhost:456 remotehost
is a specific case for the above command, where both farawayhost
and remotehost
are on the same machine.
So when farawayhost
is and remotehost
are not on the same machineļ¼ how does it work? Does it mean that I need to log into remotehost
first and then farawayhost
?