Wiki‎ > ‎

SSH Tunneling between R1 and savor

posted Oct 18, 2011, 10:03 AM by Dong Xu
Simplest form:
ssh user@host -L <in port>:<destination>:<out port>
ssh user@host -R <in port>:<destination>:<out port>

Using L will forward any connections to localhost through the ssh tunnel out of the host to where ever destination points on the out port. The in and out ports don't have to match. R will do the opposite, any connects to the remote host, usually only localhost only, will be brought back to the local host and sent to destination on the out port. On Linux the in port has to be greater than 1024 most of the time as 0 to 1024 are privileged.


ssh -L Connect to cocoa opening a tunnel that you can use to ssh directly to r1.
ssh -R Connect to r1 opening a tunnel back to cocoa that points to savor.

Once you have those you can connect to them in a second terminal by: ssh localhost -p 12345 or scp -P 12345 file localhost:file