HOWTO: Tunnel Ports with OpenSSH


I’d intended on doing a HowTo on setting up a VPN server in Ubuntu, but I’ve yet to get it working, so for now, this will do ๐Ÿ™‚

Now, to begin.

Imagine you want to port a tunnel on server (the machine you can SSH into), to your laptop, say port 5901, a VNC port.
To do so, you’d need the following command, executed from your laptop.

ssh -L 5902:IP_Server:5901 username@IP_server

That would tunnel port 5901 on your server, to port 5902 on your laptop.

You could also access the ports of a different machine, by logging onto your server, so long as those ports are accessible from your server and changing the IP address in the port:IP:port section ๐Ÿ™‚

One really rather cool trick of OpenSSH is it’s ability to create a SOCKs proxy automatically. That means that, so long as you can SSH home to your server, you can use your internet connection wherever you are. Simply run

ssh -D port username@IP_server

I generally use port 8888, though you can use whatever you have free. Configure your browser’s proxy to point to localhost and that port, and your requests will be routed through your own home net connection. ๐Ÿ™‚

VPN HowTo to follow ๐Ÿ™‚


2 Responses to “HOWTO: Tunnel Ports with OpenSSH”

  1. Good day very nice web site!! Man .. Excellent ..
    Wonderful .. I’ll bookmark your blog and take the feeds additionally? I’m glad to find numerous helpful info here within the submit, we’d like develop extra strategies in this regard, thanks for sharing. . . . . .

%d bloggers like this: