In this tutorial, we will show you how to connect your raspberry pi to your TorGuard VPN.
This tutorial was written and verified on Rasbian V7.6 (wheezy)
The first thing we need to do is to log into our raspberry pi, you can ssh into the pi from the command line if you are using Linux of a mac. If you are using a PC you can download PuTTY (www.putty.org) The default login is: pi and the password is: raspberry
The next thing that we are going to do is update the package list by typing into the command line.
sudo apt-get update
We are now going to download and install OpenVPN, the software that we will use to connect to TorGuard.
sudo apt-get install openvpn
Now we are going to download the necessary configuration files for OpenVPN type:
sudo wget https://torguard.net/downloads/OpenVPN-TCP-Linux.zip
sudo unzip -j OpenVPN-TCP-Linux.zip
sudo chmod 777 update-resolv-conf
Next, we need to add a single line to each of the configuration files that we have just unpacked. The sed command will allow us to modify all of the files at once. Type:
sudo sed -i '/auth-user-pass/cauth-user-pass user.txt' *.ovpn
Now we need to create the file we just referenced to store our login and password information to the VPN/ Type:
sudo nano user.txt
In this file create only two lines of text (replace username with your tg VPN username and likewise with the password)
press crtl+x to save the file then press y and enter.
Since the file, we have created contains sensitive info we need to ensure that only the user that created the file can read and write to it. Type:
sudo chmod go-rwx user.txt
To establish a connection now we type(or cut and paste):
mv TorGuard.Canada.Toronto.ovpn TorGuard.Canada.Toronto.conf
sudo openvpn TorGuard.Canada.Toronto.conf
Now we need to verify that everything is working properly. Type:
you should see three entries scroll up
tun0 ? this is the one that will indicate the VPN tunnel is active if it's not there then something is not right.
Now we will verify that our public IP address is masked. Open up a browser window in your computer (Assuming that it is not connected to a VPN or proxy) google what is my IP and your public IP address will be displayed. Now in the terminal connection of your pi type:
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
If the IP address that is returned is different from the IP address in your browser then everything is working.
This is all well and good, but it would be even better if the pi would establish the connection to the VPN as soon as it boots up. An easy way to do this is to make a crontab. Type:
add the line
@reboot sudo openvpn --daemon --cd /etc/openvpn --config TorGuard.Canada.conf
to test this type:
Wait a few minutes and when you can log back in re-run the tests.
Should you even want to disconnect from the VPN just type:
killall -9 openvpn