Tunneling ports through SSH by mraziz

One of the annoying things if you are behind a strict firewall is finding out certain ports are blocked to your server and you would need to stop everything you are doing until this is resolved. This is very common in corporates.

A useful and effective approach to this problem is using SSH to tunnel any port through an established SSH connection, it doesn't require you to enable these ports on your firewall, all you need is port 22.

The way this method works is by forwarding local ports to the destination ports on your server through your SSH connection. To your client, it's connecting to localhost, while in reality it's being forwarded through port 22 to your server and from there it goes to your destination port. This means you can a map different port locally than your destination port on your server. For instance, you can map localhost:8123 to 192.168.1.100:5432.

The way to do this on Linux:

ssh -L 8123:localhost:5432  user@192.168.1.100