Home » HTPC » How to Configure VPN on OSMC with OpenVPN for Raspberry Pi

How to Configure VPN on OSMC with OpenVPN for Raspberry Pi

Using a VPN on your media center helps keeping your media browsing secure and private. There are lots of options if you want to use a VPN and Kodi. For example, you can install a VPN client such as IPVanish on Android or any other OS you use. Of course, OSMC was not going to be the exception. Its a bit tricky but OSMC also has the ability to let you use a VPN connection and make your media center safe. In this tutorial we show you how to install VPN on OSMC with OpenVPN for Raspberry Pi. [Read: OpenELEC vs OSMC for Raspberry Pi 2 Media Center]

Setup VPN on OSMC

To install VPN on OSMC for Raspberry Pi you will need:

Protect your browsing, downloading, and streaming activities - VPN vs SmartDNS | Kodi VPN Use | Plex VPN Use
Provider Purpose Setup Guides Cost
IPVanish VPN Privacy and Protection Linux Mint, Ubuntu, OSMC, Windows, Android, OSMC Offer: 15% off 2 renewals
1 month: $8.50
12 months: $5.52/mo
StrongVPN
editors pick
Privacy, Protection, and Geo-Unblocking Windows, Mac OS X, iOS, Android Offer: Includes StrongDNS
1 month: $10.00
12 months: $5.83/mo
OverPlay VPN Privacy, Protection, and Geo-Unblocking Windows, Mac OS X, Linux, Gaming Systems, Smart TVs, Android, iOS, TV Boxes, Routers Valentine's Day Offer:
SmartDNS + VPN $4.16/mo
1 month: $9.95
12 months: $8.33/mo
StrongDNS Geo-Unblocking Windows, Mac OS X, Linux, Gaming Systems, Smart TVs, Android, iOS, TV Boxes, Routers 1 month: $5.00
12 months: $4.16/mo

Determine OSMC IP Address

Local method

First we need to know the IP address of the Raspberry Pi. We can do this in several ways. If you want to do it locally from the Raspberry Pi itself, run the terminal command ifconfig.

VPN on OSMC IP Address
Find out your IP address with the ifconfig command in order to proceed with the installation.

Look for the inet addr and save the IP address that’s shown. In the example displayed above, the Pi is connected to the wlan0 WiFi interface. In case you are using an Ethernet cable look at lo instead of wlan0.

Router method

Alternatively, you can use your router to see the Raspberry Pi address. In your browser type the URL 192.168.1.1. After this, enter your login information and connect to your router.

Setup VPN on OSMC router
Keep in mind, the interface of your router might not be this graphical.

Depending on your model and brand of router you might see an interface similar to the one above. In this case, you can easily find your Raspberry Pi and click on it. For the image above, the device is labelled OSMC, since our Pi has that OS installed. [Read: Install OSMC on Raspberry Pi 2 and 1 on a Windows System]

OpenVPN Raspberry Pi properties
Save the IP address of your OSMC device for later use.

If the interface is not as graphical as the one shown above, you can still find the IP address, albeit with some more patience and deductive power. Nevertheless, once you have the IP address of your OSMC Raspberry Pi device, then you can save it for the next steps. [Read: Quick Vero 2 review: unlock all the power of OSMC]

Installing VPN on OSMC

OpenVPN on Raspberry Pi Putty
Configure your Putty client as shown with the IP address you found in the previous steps.

Open Putty or your favorite SSH client and then paste the IP address in the Host Name field. After you have properly configured your connection, press the Open button.

OSMC OpenVPN installation login
Here you can use your username and password in order to keep configuring OpenVPN on your device.

Type the login name and press Enter.  After that, write your password and press Enter again. Default credentials are username and password osmc. [Read: Guide: Easy Kodi VPN Ubuntu setup with IPVanish]

OSMC OpenVPN Setup prompt
After you are logged in, you will be able to type the rest of the commands on the console.

Type the following commands in the terminal. This will update your package manager and then install VPN on OSMC for your Raspberry Pi device.

sudo apt-get update
apt-get install openvpn
cd /etc/openvpn

The next command helps you download the .ovpn configuration files from the NordVPN provider (remember to get the .ovpn files from your provider).

sudo wget https://nordvpn.com/api/files/zip

For IPVanish, use the following instead:

sudo wget https://www.ipvanish.com/software/configs/configs.zip

Then, unzip the package you just downloaded (use configs.zip instead for IPVanish) and the last command gives you a list of all the available servers.

sudo unzip config.zip
ls
OpenVPN OSMC addresses server list
Take a look at the OpenVPN server list and choose the one that suits you best.
Build a Low-Cost Raspberry Pi Media Center ~$65 Price
Raspberry Pi 3 (RPi3) Model B Quad-Core 1.2 GHz 1 GB RAM Kit, including: ~$49.99
Samsung 16GB EVO Class 10 Micro SDHC Card with Adapter ~$6.99
SANOXY Wireless USB PC Remote Control Mouse for PC ~$8.00

Connecting to VPN servers

To connect to the server, you can use an instruction similar to this one:

sudo openvpn de105.nordvpn.com.udp1194.ovpn

Of course, the actual command will vary depending on what server you want to connect to. You can also select between UDP or TCP protocol based in some filenames (depending on your provider)

OSMC OpenVPN Login credentials
After you choose a server, you will be asked for your username and password for the VPN service.

OpenVPN will need your credentials, so enter your VPN provider name/email and password. Once you do that, you will be successfully connected to the VPN. To disconnect from the VPN simply press Ctrl+C.

Fixing DNS VPN Problems

You might not be able to connect to the internet due to DNS problems. If that happens, we can fix that issue. To do so, first disconnect from the VPN as described above (Ctrl + C). In the terminal, type

sudo apt-get install nano
sudo nano /etc/resolv.conf

This will let you edit the config file with the nano text editor.

OSMC OpenVPN configure nano
Use the nano text editor (or any other you want) to edit the configuration files if you have problems with the DNS servers.

In nano use # to comment out the first 4 lines so that OSMC does not use the DNS provided by your router. Instead, make a new line and type:

#new mode
nameserver 162.242.211.137
nameserver 78.46.223.24

The DNS number will differ if you’re using another provider than NordVPN. In that case check your providers website for information. Try to exit nano by pressing Ctrl+X, and answer y to save the config file. After that, go to the terminal and type:

sudo chattr +i /etc/resolv.conf

This command will set your DNS configuration to immutable, which means it will not be changed unless you change it.

Congratulations! You now enjoy the perks of using a fully-functional VPN on your OSMC device! Not on OSMC? How about trying to use OpenVPN on Windows? You can also speed up the process by using the paid service from IPVanish on Windows and forgetting about setups and configurations. There are lots of options to keep your browsing and media viewing secure!

We Are Hiring: Familiar with Media Streaming, HTPC, Home Server, Smart Home, and Home Automation topics? Write about it and earn money. No writing experience needed. APPLY HERE.

Get 20% OFF with IPVanish VPN:

♦   Hide your browsing and streaming activity: No logs and no tracking
♦   Access geo-restricted content from anywhere
♦   Encrypt and anonymize: Kodi, Plex, Downloads, Personal Info
♦   Windows, Mac, Linux, Android, iOS, Router, and more.
♦   Money back guarantee - Sign Up Now

About the author

Jens

Hey i like to tinker with Linux and other projects involving computers.

Archives

Join the other 110,000 followers