There are three routes that you can take when setting up a VPN. You can either use a free one, buy a paid service or make your own. The advantage of free VPNs is that they are easy to setup; just install and they are ready to be used. My favorite VPN on Android is Opera VPN. The downside of Free VPNs is that they typically come with a 500 – 1GB data cap and are very slow. Paid VPNs will give you the most secure and fastest service, but at a cost. I personally have never tried any paid VPN’s. Making your own VPN might not be the most secure option but gives you greater control over how the VPN is configured and some good experience. So let’s create a VPN server. For this tutorial, we are going to use Linux. You could also do this on a Windows Machine if you would like**. Remember, the machine running your VPN server should stay on 24/7** (what good would it be off?). Because of the small energy footprint, I am going to use the Raspberry Pi.
What You Will Need:
- Computer running Linux
Step 1: Static IP
This is not a required step, but I highly recommend that you setup your VPN with a static IP address. Otherwise, you will have to change your OpenVPN settings every time your router decides to give your computer a new IP address.
To setup a static IP address, you can either do it from your router or within Linux. To do it in Linux, edit your Network Interfaces files.
I will leave my settings posted below. Feel free to copy them and use them in your setup. Just remember to change the IP address to match yours. Also, if you’re connected wirelessly to the internet, you will need to use wlan rather than eth0.
Step 2: Install OpenVPN
Luckily, installing OpenVPN is not going to be a hard or tedious process. Thanks to a simple automated script hosted on Github, you can have OpenVPN up and running in a matter of minutes. First, download the script:
It should download to your home folder (or wherever you executed the previous command from). Next, execute the script:
This will start the OpenVPN install. The installation is pretty straightforward. It will confirm your IP address then ask you for the port number that you would like to use (you can keep it default). It will also ask you want DNS resolver that you want to use. Use Google DNS unless you have a strong reason not to. Finally, it will ask you to give a name to the cert. Since I am using this on my Microsoft Surface Tablet, I named mine surface. Keep in mind, these certs are essentially the individual keys to each device that you want to connect to the VPN server. What’s great about this script is that you can simply re-run it to generate more certs for each device that you want.
After you named the cert, it will ask you if you’re behind a **NAT. **If you are using this on your Wifi network, then you are. It will then ask you to confirm your global IP address.
After you go through the previous steps, it will begin downloading and installing the dependencies to OpenVPN and generate the RSA keys. Depending on your computer speed, it could take awhile.
Once the process completes, your certs should be available in your home folder. If you can’t find them for some reason, use the following command to search your files system:
Now transfer them to the devices that you want to connect to your OpenVPN server
Step 3: Port Forwarding
If you want to be able to use your VPN outside of your home network, you wil need to open up ports. This process is different depending on your router. Generally speaking, you want to use port 1194 (unless you changed it from the default) and use UDP.
Step 4: Connecting
To connect to your VPN server on a Windows device, download and install OpenVPN. Then transfer the .ovpn cert that you created earlier to C:\Program Files\OpenVPN\Config. The launch the program as administrator. It will pop up in the task tray. Right click on the icon and select connect. It should find the configuration and automatically connect to the VPN.
To connect to your VPN on Android, download OpenVPN from the PlayStore. Then, go to the settings and select the option to connect using a profile. Find your .ovpn file and select connect. It should conenct directly to the VPN server.