Command line SSH tunnel

From BNL Physics Computing

An SSH tunnel is setup using the -L option of the ssh program. The syntax of the -L option is local port:destination address:destination port. The "local port" is an arbitrary port number above 1024 that you will use for the tunnel. Since the BNL HTTP proxy uses port 3128, that is what we will use here. The "destination address" is the address you want to access from the far end of the tunnel. Since we want to access the BNL HTTP proxy, the destination address is 192.168.1.130 or httpvipinside.sec.bnl.local. Finally, the "destination port" is the standard port for the BNL HTTP ptoxy - 3128. The tunnel is then setup using the command

ssh -L 3128:192.168.1.130:3128 yourAccount@your.gateway.bnl.gov

Where you substitute the appropriate name for "yourAccount" and "your.gateway.bnl.gov". Running this command will open a normal connection to your gateway machine and you can use it for things other than just the tunnel you opened, but the connection has to remain open for the length of time you want to use the tunnel. You can also minimize the window and forget about it until you want to close the tunnel.