FreeNAS Jail IP Change

Recently I moved my FreeNAS server to a different internal IP. This required me to change the IP’s of all the jails I have installed on the server. After doing this in the web GUI, the jails could not contact the outside internet. Turns out that when you do this, the /etc/resolv.conf file does not get updated in each jail to the new IP. To fix this, from the FreeNAS console, run the following commands

$ cp /etc/resolv.conf <jail_root>/<jail_name>/etc/resolv.conf

After doing this, restart the jails and it should be working. There is an issue already opened up about this. I guess it will be fixed in the future.

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.