How to create a SSH tunnel

You can connect to a remote host [remote-host] using another machine [proxy-host]. This can be accomplished if the [proxy-host] as an SSH server running. To do so, logon to the [proxy-host] from your computer. Issue the following command at the command prompt:

ssh -p [proxy-ssh-port] -L [local-port]:[remote-host]:[remote-port]
       [user-name]@[proxy-host]

where

  • [proxy-ssh-port] is the ssh port to connect to
  • [local-port] is the local port the client software will connect to
  • [remote-host] is the name or the IP address of the end point of the tunnel
  • [remote-port] is the port of the end point of the tunnel
  • [user-name] is the user name SSH will use to logon
  • [proxy-host] is the name or the IP of the machine that will act as the proxy

To connect to the machine [remote-host], port [remote-port] from your computer, simply connect to localhost, port  [local-port].