Today I had the need to access my development web server at my office network. I have a firewall that runs SSH but doesn’t my firewall does not forward the port for the web server. So, in an emergency situation I was able to use an Linux with SSH and Tunnel into my network on port 80. Since I have a server running on port 80 on this computer I could not use this port. I chose port 8080 to use for the local port and forward it to my web server on the firewalled network. I did this by doing the following:
ssh <SSH HOST> -L 8080:192.168.1.X:80
Using SSH Tunneling I was able to then browse to http://localhost:8080 on this computer and successfully view the contents of my web server. So, any time you need to connect to a port on a computer behind a NAT firewall that you have access to SSH on is just use a SSH Tunnel and then use the -L Switch with the port on your local machine first, then the destination address and port. Simple!