Archive for March 24th, 2009

SSH Tunnel Quick Reference

No Comments »

This is really for my own benefit and quick reference. Here is the command to setup a local tunnel to a remote machine using ssh:

ssh -f -L [local-bind-address]:{local-port}:{endpoint-machine}:{endpoint-port} -N user@ssh-host

The options used:

-f – go into background before executing any commands
-L – For port forwarding [bind address:] local port : host : hostport
-N – Don’t run any commands on the remote SSH host, just set up the tunnel

The nice thing about this is that the endpoint machine can be different from the ssh host and the name used is in fact resolved by the remote ssh machine.