ssh tunneling with local port

November 7th, 2006 mysurface Posted in Admin, ssh | Hits: 15513 | No Comments »

I remember I do post an example of how to do a dynamic tunnelling through ssh.

For this post, I am going to tunnel specific port from a remote site to my localhost. Assume the remote site have vncserver which open a display port at :1 for you, and its domain name is “myvnc.net”. VNC need 2 ports for connecting it. It start from 5800 and 5900. Seems that the display port is at :1, therefore, you need to access myvnc.net:5801 and myvnc.net:5901. But the port is not open at router, but you have ssh port 22 open. Hey lets play the trick!

ssh -L5801:myvnc.net:5801 -L5901:myvnc.net:5901 mysurface@myvnc.net

By doing that, now the remote port 5801 and 5901 is already forward to my localhost. So Now I can fireup vncview and access the desktop like this

localhost:1

Leave a Reply