HOW TO: Use IPVanish VPN on OpenELEC Kodi

Using a VPN on OpenELEC is something that many people find is necessary because they want to either unblock geo-restricted material or they want to make sure their ISP or anyone else can’t see what they are doing online. Follow along to see how you can use IPVanish with your OpenELEC Kodi HTPC.

Before we start there are a few pre-requisites you need in order for this to work correctly.

IPVanish Account – You will need this as your VPN provider. They’re the only Tier-1 premium bandwidth VPN company and their service is amazing. They have over 225 servers in 60+ counties. They keep no logs and are 100% anonymous.

SSH Client – I use and recommend PuTTY – Look for ‘putty.exe’ and save that somewhere

The IP of your OpenELEC HTPC. You can get this by going to System -> Hardware -> Summary and looking for ‘IP Address’. Make note of this.

So lets start by logging into your IPVanish account and grabbing the OpenVPN config files. You will need a few files included in the zip, but not every single one of them. Once you login click on Server List, the click OpenVPN to download ‘configs.zip’

Since you can only be connected to one VPN server at a time, we can actually remove all the .ovpn files except for one. What I recommend doing is choosing a VPN profile that is in the same state/country you are in so that you’ll get the best speed possible. That, or if you are looking to unblock geo-restricted content, then choose the country that is unblocked. Seeing as how I am in Canada, I use a VPN server in the USA to watch USA based content that is blocked for Canadians.

Now that we have those two files, we need to make some modifications so that it will work with OpenELEC. First thing we need to do is modify the .ovpn file. If you see anything you’re unsure about (file paths, names etc) it should all make sense and come together at the end. Open it up in notepad (or TextPad or Notepad++) and make the following changes:

Note that if you copy and paste that, it won’t work. I’ve removed the server addresses.

Once you have saved that the next step is to create a file called ‘pass.txt’ that has the following 2 lines:

username

password

That’s it. All you need in there is your IPVanish username and password, each on it’s own line.

At this point you should have the following 3 files in your directory:

ca.ipvanish.com.crt

ipvanish-*.ovpn

pass.txt

Now what we’ll need to do is copy these 3 files on to our OpenELEC Kodi box. There is a wiki page here outlining how you can connect to the Samba shares on your OpenELEC machine – http://wiki.openelec.tv/index.php/Accessing_Samba_Shares. Since I’m on Windows I just need to open up a Windows Explorer window and type \\IP.Address\ and press enter. The IP address is the IP I gathered earlier (from the pre-requisites!)

Once that is open, navigate to \\IP.Address\Configfiles\vpn-config and copy our 3 files there.

Excellent! We’re almost there.

Next up is we need to test our VPN connection to make sure it’s working correctly before we continue on. Let’s fire up our SSH client PuTTY or whatever you choose. Enter in the IP of the OpenELEC machine in the ‘Host Name’ field and click Open.

When you get the login prompt use the following credentials:

Username: root

Password: openelec

If it all went well you’ll be presented with the following

Now don’t be freaked out by the linux terminal. We’re not doing anything crazy here 🙂

Let’s first navigate to where we saved those three files earlier.

Type the following and press enter:

cd /storage/.config/vpn-config/

Once you do that you can type ‘ls’ and press enter to see if they’re all there.

Great, looking good so far.

Let’s do a quick little test to see what our current IP is, so we can test it against the new one to make sure we’re connected.

Type the following and press enter:

curl ifconfig.co

It should print out an IP address. That should be your current external IP. It will be the same as if you went to whatismyip.com or something similar.

Now let’s connect to the VPN manually to ensure everything is working. From the command line (and from the directory we changed to with the ovpn file) we need to run the following:

Type and press enter:

openvpn ipvanish-[server].ovpn &

Note: Please note that you will need to replace the [server] with the actual file name. Also note the ‘&’ at the end, this will allow us to go back to the command line once it’s connected.
A little protip is you can start typing the file name and press the Tab button to autocomplete, so just type ‘ipva’ or something and press Tab to autocomplete the name for you.

Once you see something like this: Sun Oct 25 16:23:00 2015 Initialization Sequence Completed, you can press the Enter key to bring you back to the command line.

Now once again you can type the following and press enter:

curl ifconfig.co

It should now be different! You’re now connected to IPVanish on your OpenELEC HTPC!

Start Up Script

So that was fun and all but let’s finish this off properly with adding this to an autostart script that will connect us to the VPN whenever we start OpenELEC Kodi.

From your SSH client type the following and press enter:

nano /storage/.config/autostart.sh

Once we’re in the text editor all we need to do is copy in the following script. You can highlight the below script and copy/paste it into Putty. In order to paste, make sure you have the text copied to your clipboard, click on Putty, and right click. This should paste it all into the text editor. From there you will need to modify it slightly to suit your exact .ovpn file.

Now the final thing to do is to reboot OpenELEC and then re-login to the SSH client and run the ‘curl ifconfig.co’ command again to grab our IP to see if it’s still the VPN IP.

Hope that helps with using a VPN with Kodi. I highly recommend you use one if you’re a big online streamer. The VPN will allow you to view it all anonymously which is becoming more and more important these days. Pay a few dollars a month to protect yourself to ensure you’re never the target of anything. I use it on my home setup and recommend it to everyone.

Let me know how it works out for you in the comments, or if you’re having any issues.

Thanks!

IPVanish, which is the only true Tier-1 VPN service in the world. IPVanish allows you to surf the net anonymously as well as access geo-blocked content in Kodi. You'll be able to watch anything unrestricted. They have clients for Windows, OS X, iOS and Android. OpenVPN is an option as well.

About The Author

Alex has been a cordcutter since early 2013. Always looking for the easiest and most convenient way to watch content is something of a hobby. Home media and computer technology has been a life long passion, which he keeps up to date on every day.

44 Comments

RichardOctober 25, 2015

I’m getting ready to build an HTPC and came across your site, it is very helpful btw. The following statement from one of your articles made me scratch my head.

“The VPN will allow you to view it all anonymously which is becoming more and more important these days. ”

It’s more of a personal opinion to be honest Richard. It’s not mandatory, by any means, but quite often in the news you see people getting letters from their ISP or letters from lawyers who are out to extort money from them. If you have the means to encrypt your activities and protect your activity from people who want to monitor you, then why not take advantage of it.

if i look in my openelec config files after autostart commands and re boot, i have 2 files.
autostart.sh.save
autostart.sh.save.1

RobOctober 29, 2015

This worked, … well sort of. 🙁
when I run the openvpn ipvanish-[server].ovpn & command, it sometimes hangs/pauses until I press Return. It then continues to churn out ‘stuff’ a line of which states ‘Deprecated TLS cipher name ‘DHE-RSA-AES256-SHA’, please use IANA name ‘TLS-DHE-RSA-WITH-AES-256-CBC-SHA”
If I manage to quit the process, and Curl – I do get a different. ip address (sometimes)
Is the output ‘Deprecated …. etc’ standard or is it erroneous?
Also, for some reason, the autostart doesn’t appear to be working. I’ve tried the chmod suggestion above – but it still doesn’t seem to work.
Sorry if i’ve missed something – I’m new to rpi/vpn/linux etc. etc.

Hi Alex – I’ve now commented out the tls-cipher DHE-RSA-AES256-SHA etc. etc. and it seems to have worked 🙂
Now I need the autostart to work. I’ve followed the instructions (? :-)) but it doesn’t seem to work. 🙁
Any suggestions?

I would look into the Kodi autostart wiki page (where I got my info from) and see if it helps. You could also post to the Kodi support forums to see if there is something else you will need to do. Unfortunately I don’t know what else to tell you. I’m glad it’s working for you now though!

I was able to get vpn installed via unofficial openelec repo. then when manually started vpn, it worked! Although, on reboot to try and test the autostart, openelec updated itself to 6.0. Now, weirdly, when I try to manually start vpn, I get this:

You sir, are the man! Thank you for this amazing yet simple to follow tutorial.

Do you know I’ve previously contacted IPVanish on how to use their service on OpenELEC and was told the only way was via router configuration (and only certain routers work btw)

You’d think that a professional company like IPVanish would have an addon dedicated for Kodi users, huh? (Or would at least provide instructions like this)

This is the reason why I’ve been using OpenELEC with VPNicity instead for quite some time now. Works flawlessly and it has a GUI interface to change servers at any time via their Kodi addon. Simplicity at its finest.

But, thanks to your tutorial, I can now compare the two services and see how they stack up against each other. Thanks again!

Hi, I’ve got my files ready to try this out later when I can SSH into my Pi 2. One question is when I use IPVanish on android/windows/mac, I can chop and change VPNs easily. Is there no way to facilitate this through this method? If I only put one VPN in, I’m tied to that and have to replace that line in the file via SSH every time I want to choose another server. This will be a huge pain if I’m choosing a VPN for geo-unlocking and get a slow one or the same locally within my country. If we put all the servers in rather than just one, could we select from that list at all?

autostart.sh runs before networking is available.
This means that it is necessary to force the startup script to wait for some seconds in the background before the openvpn command is executed. i did this by adding sleep 15 to the original script:
(
sleep 15
openvpn /storage/.config/vpn-config/ipvanish.server.config.file.here.ovpn
) &
I hope this works for you guys as well 🙂

The only thing I did not do was the auto script. I have a few premium addons that only work with my real ip address. That said, I’m stuck with having to manually launch it when needed. As of now, I’m running IPVanish via SSH from my linux terminal in laptop. No biggie, but what other alternatives are there for manually running the VPN? If I wanted to run it directly from within OpenELEC without the need of my laptop… what are my choices?

OpenELEC has an section to configure vpn via Programs-> OpenELEC Configureation->Network->Virtual Private Network
But it is “problematic”.
It has an option to use an ovpn configuration file, but it does not actually uses it…
You still have to fill everything manually.
Shame, would save so much time!

It's been a while since I've posted a HTPC build for under $250, and the scene has changed quite a bit. Below is new build that will keep with the budget HTPC theme, but be quite new compared to our previous builds.