SSH port forwarding
From BNL Physics Computing
[edit]
Forwarding ports through SSH to allow non SSH communication
When one forwards ports through SSH it makes it look like the port of one machine is actually on another. In this example we will connect to a web server running on port 80 on a machine called "internal" which is inside the BNL firewall by forwarding port 8080 on the local machine through gateway.
user@home> ssh -L 8080:internal:80 gateway -N -n &
The "-L" option sets up the forwarding, the "-N" tells ssh to not run anything on gateway (otherwise a shell would be opened) and "-n" tells ssh to close stdin so that we can put this ssh command in the background.
