for some reason its not happy with the substitution around this array. Checking the code looked fine, and I couldn’t figure out why it was unhappy at this point in the script.

Now some forums kept talking about having the shebang (#!/bin/bash) at the top of the config file (this made little/no difference and pretty sure that’s not how the vpn config files work), for some reason I figured “#!/bin/sh” would be just as good = this was WRONG. The way ‘sh’ handles array substitution is different to ‘bash’ and so my error was in how my chosen shell was dealing with things. also,

#!/usr/local/bin/bash# set -x## Parses DHCP options from openvpn to update resolv.conf# To use set as 'up' and 'down' script in your openvpn *.conf:# up /etc/openvpn/update-resolv-conf# down /etc/openvpn/update-resolv-conf

and your VPN should come up without a problem.

Local Networks & OpenVPN

local networks on the same subnet will be accessible, but I learned you need to add other subnets to the routing table when openvpn comes up as I wasn’t able to web into the transmission web GUI without the following:

note: 172.16.40.x network is where my FreeNAS/Tranmission box lives

route add -net 172.16.45.0/24 172.16.40.1

/etc/resolv.conf issue

my /etc/resolv.conf was not being restored after stopping VPN

note: this is a hack and possibly not a good long term solution

in /etc/openvpn/update-resolv-conf script, the ‘up’ part of my openvpn config file (i.e. /usr/local/etc/openvpn/mullvad/mullvad_linux.conf) worked fine, but the ‘down’ process basically did this on the tun0 interface and walked away:

/sbin/resolvconf -d"${dev}.openvpn"

after not being able to find a solution i came across a forum where dude just added copy and mv commands to backup then restore the default resolv.conf file

# in the up 'case'cp /etc/resolv.conf /etc/resolv.conf.default
# in the down 'case'mv-f /etc/resolv.conf.default /etc/resolv.conf