Tunnelling via SSH

Sometimes, the access to the lab/office computer is necessary. However, the university/company/organisation blocks my direct connection by its firewall, which is not good 🙁

Nevertheless, we can SSH to some computers in DMZ and then tunnelling to the lab/office computer for some specific applications.

Here, we leverage the forward function of SSH as following:
ssh -L port:host:hostport user@hostname

For example, we connect to a RDP server via SSH tunnel.

First, start the tunnel by
ssh -L 3389:123.123.123.123:3389 username@example.com
Above code starts a tunnel to 123.123.123.123:3389 where 123.123.123.123 is the RDP server ip address and 3389 is the RDP port.

Secondly, connect to 127.0.0.1:3389 via any RDP client.