We all know how to ssh to a remote box...
Basic SSH connection with ssh 99.88.77.66
99.88.77.66
+-------+ +--------+
| LOCAL |----------------------------| REMOTE |
+-------+ +--------+
Tunnel port 6000 to a remote server, through a gateway with ssh -L 6000:192.168.10.24:5984 99.88.77.66
99.88.77.66 192.168.10.10 192.168.10.24
+-------+ +--------+ +-------+
| LOCAL |----------------------------| REMOTE |--------------------------| OTHER |
+-------+ +--------+ +-------+
:6000 =========================================================> :5984
This allows us to access port 5984 on the a box behind the REMOTE, through port 6000 on localhost.
The -L
flags are strange, but they describe the tunnel in the following way:
[bind_address:]port:host:hostport
| LOCAL SIDE | REMOTE SIDE |
Where:
- LOCAL SIDE is where the connection is from, and bind_address defaults to localhost`.
- REMOTE SIDE is from the point of view where the connection terminates, and can describe the network topology that the remote server has access to