Raspberry Kodi with a remote file-server using vpn
so today because i'm tired of Elasticsearch and mostly logstash ! I going to use one of my "old" Raspberry Pi B+ to build a Media center for my parents.
Indeed i'm tired of them asking me to bring some free of charge movie or tv shows with me... so i will build a small Raspberry Pi 2 with Kodi and i will configure it to use openvpn to connect to my home to get access to my NAS. Of course i want everything to be as secure as possible so i will use authentication using a dedicated certificate.
Nowadays we start having internet connection with enough bandwidth but be aware that at least for the NAS side, you will need an optic fiber or similar (you need huge upload for HD). I will try to mesure the bandwidth it took to stream from my NAS.
For my personal use i have a NUC computer with openelec, but unfortunately openelec doesnt have an openvpn client ... so thanks to a friend i discover OSMC and i will try to use it. Apparently it's a raspbian modify to behave like a media center (start kodi on boot). Let's hope it's optimized as openelec!
for information osmc is the new version of raspbmc
This subject seems quiete "simple" for most of us, but this blog is about sharing my experience and test, not creating unbelieving new idea! (who knows, perhaps one day!). if it could help 2 people i would be happy about it, if not, i would still use it as my personal public notes !
2. Installation of OSMC
to install OSMC on your SD card you should look into the documentation here : https://osmc.tv/download/. They gave you all the disk image in different format and even a self install binary if you are not used to copy image on sd card! easy-peasy !
3. First start of OSMC
concerning osmc configuration for the moment it's easy, just follow the wizard until the end. if the wizard doesn't start, just wait a moment for it to boot up (for me it took around 30sec after the menu pop up)
once you got the standard kodi interface you can switch to the next step, but don't forget to let it ON.
4. Configuration of vpn
concerning the server configuration (your home where this kodi will be to access the network with your data), you can follow my previous article : Iphone remote access openvpn
you can use another raspberry as a openvpn server for example.
nb: the client will be your osmc
as describe in the article Iphone remote access openvpn, you must (as root) create a key for your osmc. To do that, login into your vpn server then type in:
then you accept everything and DONT set up a password when requested, just let it blank. It won't be a security issue since you will need this specific certificate to be able to login into your server. If you loss this certificate you will just have to disable it into your server configuration. if you still set up a password you will have to write it down into a configuration file anyway .. .so what the point ?
once it's done you should create an ovpn file like this and update the "YOUSERVERIP" and "YOURPORT":
update-resolv-conf is only necessary if you are pushing your DNS configuration too. otherwise you can remove the 2 last line.
you then must have this files available :
once you have all these files available, copy them onto your osmc. you can use ssh for example (default login/pass are osmc/osmc)
openvpn client configuration
Then copy everyfile into /etc/openvpn. i advice you also to use this article to disable ipv6 on your private network to avoid issue with dns : Debian 8 jessie : Disable ipv6 support
the package resolvconf is mandatory only if you are pushing your DNS configuration too.
Restart your osmc. it should be done ! you just have afterward to add your sources as if you were at home !
to check everything is working fine you can type in :
it should show you a several interface and one should be called "tun0" or something like that. if you can ping the server on the otherside using there IP, it should be working.
Everything worked fine with this configuration for me. But unfortunately, the internet connexion of my parent weren't good enough. Indeed they have only 4Mbps (around 500Ko/sec in download) . i think that to make it work fine over Internet you need at least 8Mbps on both side (1Mo/sec in download for client, and 1Mo/sec in upload for server).
Anyway i will keep this over the shoulder to try it again in a couple of year when everyone will have fiber channel ! And you can use this tutorial for any other purposes.
FAQ from OSMC.tv
I see a coloured rainbow square in the right corner. What does this mean?
It is important that your device receives a stable and sufficient power supply. Not having a good PSU can cause many problems with your Raspberry Pi:
- A multi-coloured square in the corner of the display. This indicates that your Pi is not getting enough power
- Random freezes or glitches
- Unexpected network dropouts
- Randomly seeing external drives unmount and remount (caused by dips in power)
- Repeat remote presses
Unfortunately, some power supplies advertise that they can output a good amount of current but fail to do so. Most power supplies used are simply mobile phone chargers and are thus never really tested to see if they can perform to their advertised specification as they merely trickle charge phones.
For best results, you should ensure:
- You do not power your Raspberry Pi from a USB port on a computer or TV. These can only output 500mA at the most.
- You do not use a mobile phone charger
- You use at least a 2A 5V power supply
if like me you have a full colored rainbow screen ... look which raspberry version you have and take the right iso ... (i have a B+ and i took the Rpi 2 iso ... i was sure it was a 2 ...) dont be silly ... check ! ... ok it's more a self note :P
- use this link to configure your server openvpn, configuration is very similar : https://blog.jocelynlagarenne.fr/jsn/index.php/integration/97-iphone-remote-access