PI MusicBox OpenVPN

So I needed the ability to have my Pi MusicBox, from my previous post, use OpenVPN to talk to the internet without restrictions. This is what I had to do to make it work.

This is not a post on how to setup an OpenVPN server. I assume you already know how to do this.

  • Install openvpn and resolvconf on the PI MusicBox.
  • sudo apt-get install openvpn resolvconf
  • Create PIMusicBox.conf client openvpn config file. Make sure it goes into /etc/openvpn folder.
    • At the bottom of the PIMusicBox.conf file you need to add the following lines
      • up /etc/openvpn/update-resolv-conf
        down /etc/openvpn/update-resolv-conf
    • Link the auto-generated resolv.conf to the existing resolv.conf
      • cp /etc/resolv.conf /etc/resolv.conf.orig
        rm -f /etc/resolv.conf
        ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf

Setup openvpn to start on reboot.

  • Edit /etc/default/openvpn file
    • Change the line that starts with
      • #AUTOSTART="all"
      • to
      • AUTOSTART="all"
      • Just remove the # sign from the beginning of that line.
    • Change the line that starts with
      • OPTARGS=""
      • to
      • OPTARGS="--script-security 2"

From here you should be able to reboot the system and openvpn will startup automagically.