January 23rd, 2013Top StoryTurn a Raspberry Pi into a Personal VPN for Secure Browsing Anywhere You GoBy Melanie Pinola The tiny, inexpensive Raspberry Pi has a very low power consumption, which makes it a great always-on VPN (Virtual Private Network) server. With a VPN, you'll get secure access to your home network when you're on the go and can use it for secure web browsing when you're on public networks. Here's how to roll your own VPN with the Raspberry Pi. It's Raspberry Pi week at Lifehacker, and all week we'll be showing you some cool DIY projects you can put together with this little miracle of a device. If you haven't bought one yet, check out our introduction to the Pi to learn more about what it is, what you'll need, and the cool stuff you can do with one (such as turning it into an XBMC media center). For a basic introduction to VPNs, check out our guide to why you should start using a VPN (then come back here). What You'll NeedSetting up your Pi as a VPN and web proxy server doesn't require any new or special hardware beyond the basics. You'll need:
We've walked you through the steps of setting up a personal VPN with Hamachi and using it with Privoxy for secure browsing before, but the steps below are updated for Linux and the Pi in particular. We'll be entering some commands in the command line and changing configuration files, but really this project is very easy to do. (Hat tip to the Raspberry Pi community for the tips and troubleshooting used in this article.) Step One: Hook Up and Configure Your Raspberry PiIf you haven't already, follow the steps in our Beginner's Guide to DIYing with the Raspberry Pi to create the base system running Raspbian, the standard operating system for the Pi. Note, however, that there's one additional step you should take when following that guide, at the end in the configuration section (before step 3, finishing configuration). Change the default keyboard layout if you're not in the UK. The reason is some of our commands require special characters (e.g., #), which the UK layout changes. If you're following the setup guide above, you can change the keyboard layout in the configuration screen. Or, after you've set up the Pi, type in: sudo dpkg-reconfigure keyboard-configuration Then follow the prompts to switch to your country's layout and then either restart (using the invoke-rc.d keyboard-setup start Step Two: Update the Raspberry Pi and Install HamachiHamachi depends on a couple of packages that may not be present in your image, so we're going to first update the packages and hopefully save you time troubleshooting common errors. First, grab the latest update: sudo apt-get update Then, install LSB (a requirement for Hamachi): sudo apt-get install --fix-missing lsb lsb-core Be patient while it updates, and then you can download the latest Hamachi build for Linux: sudo wget https://secure.logmein.com/labs/logmein-hamachi_2.1.0.86-1_armel.deb If you get errors grabbing the Hamachi for Linux download, check the download page on LogMeIn to verify the version number (e.g., 2.1.0.86-1) and change it in the filename if necessary. Next, install Hamachi by entering: sudo dpkg -1 logmein-hamachi_2.1.0.86-1_armel.deb Step Three: Configure Hamachi on the Raspberry PiThe last step for our VPN setup is to get Hamachi running on the Pi and on our client PCs. On the Raspberry Pi, run the following to get the Pi connected to your LogMeIn account and create a new Hamachi network: sudo hamachi login sudo hamachi attach [INSERT LOGMEIN.COM EMAIL HERE] sudo hamachi set-nick [INSERT A NICKNAME FOR YOUR RASPBERRY PI] Now, on another machine, head over to LogMeIn and go to your "My Networks" section under networks. You'll see that the Pi (whatever you nicknamed it) is trying to connect and create a new network. Grant the Pi permissions and write down the network ID (a 9-digit number) for that network. Go back to the Raspberry Pi and enter: sudo hamachi do-join [THE NETWORK ID YOU WROTE DOWN] Then enter your LogMeIn password (if requested). You might need to approve the join request on LogMeIn from the other machine. Once you do so, the Pi will be part of the new VPN served by Hamachi. At LogMeIn.com, look for the virtual IP address assigned to the Pi and write that down, because you'll need it later. To be able to SSH into it and remotely control the Raspberry Pi, start the SSH server: sudo /etc/init.d/ssh start Step Four: Install Hamachi on Your ComputersAlmost done! For the Windows, Mac, or Linux computers you also want to connect to the VPN, you'll need to install the Hamachi client from the download page. After you do so, you can join the new VPN (Network > Join) and SSH into the Raspberry Pi or access network files, etc. (In Windows, use a tool like Putty or in Mac/Linux use Terminal to SSH, using the Raspberry Pi's IP address assigned by Hamachi in the server field). (Optional) Step Five: Install Privoxy on the Pi and Use It as Your Computer's Web ProxyBesides issuing remote commands to the Pi and accessing network files, you can use your Pi as a proxy server. By connecting Privoxy and Hamachi, you can secure and encrypt your browser sessions when you're using the public Wi-Fi at your local coffeeshop—keeping your data safe from prying eyes or malicious users. Here are the steps to set up Privoxy on the Pi:
Now you have your Privoxy server set up on the Pi, running over the secure VPN via Hamachi. All that's left to do is set Privoxy as your proxy server on your other computers. To do that:
Then enter the IP address of the Raspberry Pi, as assigned by Hamachi, in the proxy adress. The port is 8118. To test that the proxy is working, go to http://config.privoxy.org/ and you should see a message like "This is Privoxy on Windows [IP address], port 8118, enabled." If it's not working, you'll see a message that "Privoxy is not being used." Also, when you're using a public Wi-Fi connection, visiting WhatIsMyIP.com will show a different IP address when your proxy is turned on than when it's off (the IP address should be your home's public IP address). That's it! Other Raspberry Pi VPN SolutionsThere are other ways to skin this cat, of course. Our favorite VPN tool (by a close margin over Hamachi), Open VPN is a good alternative, but may require a bit more tweaking (as well as a static IP or Dynamic DNS service provider). You can also set up a PPTD VPN (instructions via Brad Wells), which has the advantage of being supported by more devices, but again it's a little more involved. For a quick-and-dirty VPN and proxy server, though, the steps above should get you up and running in no time securely networking with your Raspberry Pi. Photo by Denise Kappa (Shutterstock), maymak (Shutterstock), Pakhnyushcha (Shutterstock), Anan Kaewkhammul (Shutterstock), A1Stock (Shutterstock), and Neyro (Shutterstock). |
|
A destination on the Interweb to brighten your day (now get back to work!)
Wednesday, January 23, 2013
Turn a Raspberry Pi into a Personal VPN for Secure Browsing Anywhere You Go
Labels:
#breakingnews,
#business,
#buzz,
#celebrity,
#news,
#people,
#socialmedia,
#sports
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment