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 :)
Filed under: HowTo, Ubuntu | 2 Comments
Tags: HowTo, Server, SSH, Ubuntu