2013年10月22日 星期二

Local/Remote port forwarding/mapping

Local port forwarding - 

ssh -L local_tunnel_listen_port:destination_host:destination_port sh_server

To establish a SSH tunnel  where whenever there's a packet detected on port local_tunnel_listen_port, send it through the SSH tunnel. The ssh server will receive this packet and send it to the destination server and port.

Remote port forwarding -

ssh -R local_tunnel_listen_port:localhost:localhost_ssh_port ssh_server

To establish a SSH tunnel where whenever there's a packet detected on port local_tunnel_listen_port on ssh_server, the ssh_server send it through the tunnel to localhost:localhost_ssh_port.

Reference links
http://phorum.vbird.org/viewtopic.php?t=21325
http://en.wikipedia.org/wiki/Port_forwarding