Portal Home > Knowledgebase > Tutorials / Guides > Other OSes > OpenVPN for Raspberry Pi

OpenVPN for Raspberry Pi

This tutorial will explain you how to set up a connection to our OpenVPN tunnels on your Raspberry Pi device. This tutorial is based on the Raspbmc distribution. Please note that this tutorial considers you have sufficient knowledge of UNIX and Raspberry Pi itself.

So, first of all, please install raspbmc and make sure it is correctly connecting to the Internet. You should connect to it remotely via SSH. Use Putty on Windows or Terminal on Mac/Linux. Log as "pi" with username "raspberry".

You should see the following UNIX bash prompt:


Please make sure you become root by entering "sudo" and writing down your root password. The prompt should become as follows:


Note, you are now root or the super user, so proceed with caution.

The next step consist of updating the software repositories. Please enter the below command:

          apt-get update

The updater will work on its own and install some bundles. Once this is completed after few minutes, please install OpenVPN by entering:

          apt-get install openvpn

Once OpenVPN has been downloaded, please download the sample script available at http://proxy.sh/panel/downloads/psh.raspbmc.txt by entering:

          wget http://proxy.sh/panel/downloads/psh.raspbmc.txt

Once the file has downloaded, edit it and change the username, password, server IP and eventually OpenVPN port. Save it to your home folder.

Then, edit the /etc/rc.local file to edit your system startup script so that the VPN automatically connects on launch. Right before the line that explicits 'exit 0', please input:

          bash /home/pi/psh.raspbmc.txt

So that it looks like this:

          bash /home/pi/psh.raspbmc.txt
          exit 0

Once you are done, save the file and then type the following command to reboot:

          shutdown -fr

Once the system has restarted, you should wait about for one minute and then try to see if the device has successfully connected to the VPN. Back in the raspbmc you can type ipconfig to list the network interfaces. If everything is properly configured, you should see a tun0 in addition to basic eth0 et. al. Your IP should also be hidden. You are now all done :-)

NB: If you encounter difficulties to connect with OpenVPN, please try to connect to other servers or try alternative ports, especially more "discreet" ones such as TCP 443 or TCP 80. Please also make sure that the port you are connecting through is fully opened in your firewall/router/network. Below, you will find an aggregate of useful guides and articles that will help you troubleshoot your problems, should you have any.

I cannot find the .ovpn and .crt files necessary for OpenVPN. Where are they?
No matter how hard I try, I cannot succesfully connect to OpenVPN.
I can't access any website through my browser while connected to VPN.
I am connected to the VPN but my IP is not yet hidden. Help!
I am having some kind of other problem. Where can I find some help?
How can I find the local log files of my VPN client?

If you still cannot connect successfully, please open a support ticket and include either a copy of your logs or a screenshot of your configuration and encountered errors. Logs can usually be found in software menus or settings, as well as their directories of installation (.log or .txt files). If you do not include a log or a screenshot, it will be hard for us to help you resolve the issues you have with connecting to our network.
Related Knowledgebase Articles