I have been thinking up cool things to do with my new Raspberry PI computer when I read about how other people have turned theirs into a VPN server. I realized the Pi was a great machine for this because of its Linux OS and ease of use but also because its 700mA power rating it makes a great always on device that wont eat into my power bill. I did some searching and found a great guide published on lifehacker by Melanie Pinola. I am reposting their directions along with some tricks and trouble shooting tips I found along the way.
I started with a fresh Raspberry Pi model B and a clean SanDisk 16GB Class 10 SD card with an image of Raspbian. Lifehacker recommended a class 10 card so thats what I used, a cheaper class 4 or 6 will work but I think the reasoning for the faster card is to minimize the chance of a network slowdown caused by slow components. If anyone has a better idea please let me know. At the initial setup prompt I changed the gpu memory to 32 mb from 64 and I might go lower than that. I am learning to love the command line and I dont see a great need for a faster gpu if I’m not in the GUI. Hopefully this will help to eek out a bit more speed from the Pi.
Once the Pi is setup and running, take the following steps.
Create a free LogMeIn account.
Then from the command line. Update the system
sudo apt-get update
Then install Linux Standard Base
sudo apt-get install –fix-missing lasb lasb-core
Installing LSB took about five minutes on my system, be patient and wait for the pi@raspberrypi ~ $
Then download Hamachi for Linux
sudo wget https://secure.logmein.com/labs/logmein-hamachi_220.127.116.11-1_armel.deb
Now install Hamachi. Lifehacker suggested the line
sudo dpkg -l logmein-hamachi_18.104.22.168-1_armel.deb
But this is where I ran into my first problem. The -l after dpkg didnt work and wasnt listed as a valid command so I used -i instead. Typing dpkg –-help , lists commands and options for dpkg.
Now that dpkg works I received the error
“dpkg: error proccessing logmein-hamachi_22.214.171.124-1_armel.deb
package architecture (armel) does not match system (armhf)
Errors were encountered while processing:
I think this has to do with the hard float version of Raspbian “wheezy” that most of us are using.
Lifehacker user boilerkk suggested using the line:
sudo dpkg –forece-architecture –force-depends -i logmein-hamachi_126.96.36.199-1_armel.deb
This worked for me and hamachi installed without further errors.
Now connect the Pi 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]
On another machine log into “LogMeIn.com” and go to “my networks” look for the alert to approve a join request from your pi using the nickname you just gave it. Once you do this write down the 9 digit client id. Then back at the pi command line enter
sudo hamachi do-join [NETWORK ID]
and then enter your password.
I received the following error:
joining xxx-xxx-xxx .. failed, network not found
I didnt find anyone on lifehacker with a similar problem but I did go rooting around in the hamachi help file by typing :
sudo hamachi help
in the list of commands I found this : if no command is specified, hamachi displays its status including version, pid, client id, online status, nickname and the LogMeIn accoun. So I entered:
and this is what I got back:
version : 188.8.131.52
pid : xxxxx
status : logged in
client id : xxx-xxx-xxx
address : xx.xx.xx.x
nickname : xxxxxx
lmi account : firstname.lastname@example.org
So it appears the login has worked despite the error message stating the contrary.
But the logmein site didnt seem to be working properly and I had problems later on in the process so I pulled the plug on the Pi and rebooted the system. After trying again with the command:
sudo hamachi do-join [NETWORK ID]
After the reboot things seemed to work properly and I got a positive result in the command line. Now the Pi is connected to the logmein.com service, whats next? With SSH you can control the Pi remotely and access files saved on the network or in my case, a 1TB drive atatched to the Pi.
Start SSH on the Pi if you want to control it remotely
sudo /etc/init.d/ssh start
Now you can access the Pi via SSH from any location. On a side note, I found out the current version of Linux Mint that I am using is not supported by LogMeIn so I wont be able to access my network with my Linux machine, however my Windows laptop works well with LogMeInand PuTTy. I may look for a VPN service that works with my distro of Linux in the future but I am learning as I go and this is good enough for now as I probably wont take my Linux laptop on the road with me.
The next step is to install a proxy server service. Lifehacker provided Privoxy as a suggested service in their tutorial.
First install Privoxy on the Pi:
sudo apt-get install privoxy
Then start Privoxy:
I had a problem starting Privoxy this way on my machine. The method that finally worked for me was to use the cd command to change directories backwards to the root directory by typing “cd ..” than type “ls” to list the directory and then changed directories to etc. Once I did this Privoxy started without a problem.
Now open the configuration file in your text editor. I use nano just because thats what I started with and its what I’m comfortable using.
Sudo nano /etc/privoxy/config
Again, this command didnt work for me unless I was in the root directory.
Using nano can be a challenge if you havent worked with it before, I used the command “^w” aka control+w to search for the line “listen-address” this should bring you to a point in the document where you can use the arrow keys to move your cursor down until you see “listen-address localhost:8118”, comment out this line by adding a # at the beginning. On my system for some reason the key assigned to the pound sign entered a “ instead and the “ key did something else entirely. I used the help command to list all the available commands in nano and found the cut and past keystrokes and used those to cut a # from a blank line and paste it in front of the localhost line (this will make sense when you see it).
Also add the following line:
listen-address [IP address of your Pi assigned by Hamachi] (i.e. 184.108.40.206:8118)
save the configuration file by typong control+x and restart Privoxy with:
sudo service privoxy restart
I have not had success accessing the Pi via proxy yet. Its late and I have been working on this for a few hours now so I will step away and try again when I have fresh eyes and a clean mind.