The Raspberry Pi 2 as a Dedicated VPN (round 2)

By | March 5, 2017

Raspberry Pi + OpenVPNPreviously, I had tested the Pi Zero as a dedicated VPN. And while that was a great way to securely connect to my home network and access files, the Zero definitely struggled performing some tasks (like streaming media). Raspberry Pi’s are ideal for 24/7 use because they barely draw single watt, compared to desktop computers where the CPU draws 75-150 watts alone. The Pi 2 has 1 Gb of memory, twice as much as the Zero, and is quad core instead of single core. I also connected it through Ethernet instead of Wifi, which avoids another bottleneck. How do you set up your Pi as a VPN? You can follow this guide verbatim and swap out “Pi Zero” with “Pi 2” and it will work the same. The guide relies heavily on PiVPN, a simple installer and command line manager for OpenVPN. This makes installation as easy as clicking ‘yes’ to defaults all the way through.

pivpn command line

Since the setup and installation is covered in the Pi Zero post, I’ll spend more time exploring what’s possible in terms of streaming with these free technologies. On to the results.

Streaming Music

With an Android app called “DAAP” I was able to connect to a Firefly server running on a NAS4Free machine at home. The Firefly server surprised me with how you can create playlists. You can add playlists based on the year the song was produced, the genres, words that occur in the title/artist’s name, length of the songs, beats per minute of the song . . . The list goes on. It works with Roku products (Roku Server Protocol) and Apple products. Connect to your Pi VPN from anywhere, open the DAAP app (or iTunes, which can detect the Firefly server), and connect to play your music. With Bluetooth speakers being commonplace in many homes and venues, you can be a DJ with full control of the music wherever you go, no problem.

Firefly server and DAAP

Accessing a Firefly server through an OpenVPN connection and DAAP app

Streaming Video

To achieve this, you’ll need to set up a Plex server and install the Plex app (both are free, sort of). The server software and client apps for Roku/Chromecast/FireTV are free to use, but the mobile Plex app will limit your use and prompt you to sign up for a membership or pay an activation fee. It is very rare that I endorse paying for something when there are free alternatives, but Plex really does have excellent software and it has come a long way (and I can’t imagine it was easy to code, either). Anyhow, the Plex app streamed video flawlessly for 1 minute until it stopped (presumably because I haven’t paid, yet). You can also stream your music from Plex.

Plex stream

Plex stream through mobile app

But wait, why do we need a VPN for this? Doesn’t Plex have remote access as one of its main features? Yes, it does, and it even secures the connection with TLS (like SSL).  BUT like I just mentioned, the Plex phone app restricts access unless you pay. And all the other Plex software is free, as in gratis. Including the web UI. Which you can now access locally through your OpenVPN connection:

Plex stream

Streaming through local Plex web UI from my cellphone

This is a perfect example of why VPN connections are useful beyond encrypting data for your privacy. You are free to do more things based on where you are virtually connected. The Plex web UI was created with desktops in mind, so clicking through it from my phone was not ideal, but I still got it to work without restrictions.

Other ways to avoid paying a fee: you could just enable NFS protocol on your NAS server and install the Kodi app on your phone. Theoretically that should work, because it will be virtually as though you are connected on your home network. Which I have tested. These methods won’t work with any old NAS, though. The server will be doing transcoding and will need a CPU powerful enough to handle the tasks.

Your Network, Your Rules

Many people who use the Pi like this also like to set up Pi-hole too. Pi-hole blocks ads for all devices on your network by acting as the DNS and filtering out domains associated with advertising. You can also modify the whitelist/blacklists to suit your own wants and needs. Without the video and audio ads loading every time you open a web page (or app, even) you may even save how much data you use up. You can connect this way with any platform that has OpenVPN support. Your laptop or another desktop for example.

Pi-hole aside, maybe you find yourself traveling around a lot for business, and you make ample use of free Wifi so you don’t use up all your data. Of course OpenVPN will secure your connection from the prying eyes that are associated with public Wifi. It will also keep your IP address consistent (your home IP) so you don’t get locked out of your email, online banking portal, or whatever other websites/apps you normally connect to. One of the biggest challenges for the IT departments of companies is determining who is friend and who is foe. If you travel around a lot connecting to different Wifis, that makes it harder. Connecting through the same home IP address every time is one way to say “Hey, it’s me again.”

edit; Unless you configure your Firefly to stream at a lower rate, this will eat up your data. Using roughly 3x as much data as Soundcloud/Spotify this way. Also, DAAP app crashes occasionally.

One thought on “The Raspberry Pi 2 as a Dedicated VPN (round 2)

  1. Pingback: The Raspberry Pi Zero as a Dedicated VPN –

Leave a Reply

Your email address will not be published.