I have drawn some sketches
##I have drawn some sketches TheThe machine, where the ssh tunnel command is typed is called »your host«.
##Introduction
Introduction
- local:
-L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.local:
-L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.ssh -L sourcePort:forwardToHost:onPort connectToHostmeans: connect with ssh toconnectToHost, and forward all connection attempts to the localsourcePortto portonPorton the machine calledforwardToHost, which can be reached from theconnectToHostmachine. remote:
-R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.ssh -R sourcePort:forwardToHost:onPort connectToHostmeans: connect with ssh toconnectToHost, and forward all connection attempts to the remotesourcePortto portonPorton the machine calledforwardToHost, which can be reached from your local machine.
ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine.
- remote:
-R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.
ssh -R sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the remote sourcePort to port onPort on the machine called forwardToHost, which can be reached from your local machine.
##Additional options
Additional options
Your example
##Your example TheThe third image represents this tunnel. But the blue computer called »your host« represents the computer where someone starts the ssh tunnel, in this case the firewalled machine.

