Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The ssh manual pages states the following:

 -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. 

 -R [bind_address:]port:host:hostport
         Specifies that the given port on the remote (server) host is to
         be forwarded to the given host and port on the local side.

Aren't those two descriptions mixed up?

When I use ssh -L it takes a remote port and "binds" (or forwards) it to a port on my local machine so that I can talk to some remote machine by talking to myself (localhost:port).

When I use ssh -R it takes a port from a computer on my local network and "binds" (or forwards) it to a port on the remote machine (ssh server). Then when I'm on the server, I can talk to the port of a computer on the same network as the computer that I just connected from using (localhost:port).

This also explains the use of L for local and R for remote (wherever the port is being bound to).

(I don't know if i'm using the word "bind" correctly. That't what I'm trying to imply with the quotes)

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You have your definition of "forward" mixed up. It is the packets that are forwarded (from local to remote for -L, and from remote to local for -R).

share|improve this answer
    
Ah ok. So -L does bind to my local machine but packets are forwarded through that local port to the remote machine. –  James T Mar 26 '12 at 2:03
    
Exactly :-) Now you got it right! –  tiktak Mar 28 '12 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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