Turn your Raspberry Pi into an easy VPN using OpenSSH

There are plenty of tutorials out there on how to turn your Raspberry Pi into a full-fledged VPN, often using OpenVPN. However, many people don’t need all of the features (and all of the setup) of a full VPN server in order to just protect their browsing when they are on unsecured wireless networks (or for whatever other reason you would want a VPN).

Enter OpenSSH. Most of you know it as the program that lets you login to other computers and servers through the command line; for a long time, that’s all I did with it too. However, you can use it as a simple VPN on your Raspberry Pi as well! First, go into your router’s settings and make sure that you have a port open through which your VPN will go; personally, I use port 3312. Then, run the following command on your Pi:

$ ssh -TCD:3312 username@localhost

Where username is the name of your user on the Pi; you will also be asked for that user’s password at the time. Then, all you need to do is configure your browser to use that to connect to the internet. Go to Preferences->Advanced->Network->Connections and click on Settings. Select “Manual Proxy Configuration” and enter your home’s public IP address as the “SOCKS Host.” Put in 3312, or whatever port you chose to use, in the port field and everything should work fine. When you end the ssh session, the proxy will stop working, so remember to switch your Firefox preferences back to “No proxy” or you won’t be able to browse. It is that simple!

Leave a Reply

Your email address will not be published. Required fields are marked *