OpenVPN setup on Raspberry Pi 2

Share This!

This article will guide you through on setting up our VPN service on Raspberry Pi 2 via Terminal.

 

Step 1:  Installing OpenVPN

 

Before you install OpenVPN, you will first need to update the package list on your device. To do so, run the following command on your Terminal.

 

sudo apt-get update

 

Once you’ve updated your device, you can now install OpenVPN using the command below:

 

sudo apt-get install openvpn

 

Step 2:  Downloading VPN Configuration file

 

To download VPN configuration file, please run the command below:

 

 wget www.mypn.co/files/linux/UDP1194/MPN_GBR.ovpn

 

Note: The above command will download GBR (United Kingdom) configuration file. If you need to connect to any other countries, simply replace the GBR,  3 letter country code in the command line above with the country code that you wish to download. List of country codes can be found here.

Step 3:  Downloading VPN Script

 

Type in the following command below to download our VPN script.

 

wget www.mypn.co/files/linux/mpn.sh

 

Note: The script above is for GBR configuration file. If you’re connecting to any other country, you can still download the script above but you will need to edit it. To edit, please type in the command below:

 

vi mpn.sh

 

Next, replace replace the GBR 3 letter country code in the script file with the country code that you wish to connect. List of country codes can be found here.

 

 

Step 4: Setting permission for VPN script file

 

Once you’ve downloaded, you will need to give permission to the script. To do so, type in the command below:

 

sudo chmod 0755 mpn.sh

 

Step 5: Adding VPN Credentials

 

You will need to create a file called user.txt which will contain your My Private Username and Password. To do so, type in the command below:

 

sudo vi user.txt

 

You will need to add your MyPrivate Network’s username in the first line and your MyPrivate Network’s password in the second line. Once you’ve entered, save the file.

 

 

Step 6: Connecting to VPN

 

To connect to the VPN, type in the command below:

 

sudo ./mpn.sh &

 

Once you’ve entered the command above, wait for 10 seconds and you should be connected to our service.  To check whether you’re connected to our service or not, type in the following command:

 

curl ipinfo.io

 

You will now see few information on your screen. In this example, I’ve chosen to connect to our GBR server and since the VPN is connected successfully, it is indicating that my country is GB (Great Britain).

 

 

Any Problems?

 

If you happen to have any problems or simply can’t get connected, please type in the command below:

 

cat mpn.log

 

You will see the VPN connection log file. please email us at support@my-private-network.co.uk and we’ll get back to you as soon as possible to assist.