I've put together a script to use PrivateInternetAccess's (PIA) 'next generation WireGuard network' which uses their own wireguard DNS 10.0.0.242 10.0.0.244 once connected successfully.
I believe I may be experiencing DNS issues, webpages are taking longer to load. If I run leak tests they're successful. I require assistance on how the script should be formatted (not sure if I've done this properly).
ATM my WAN DNS is pointing to PIA's own DNS 209.222.18.222 & 209.222.18.218 which works fine when connecting to their 'current generation WireGuard network', however if they're not changed to their 10.0.0.x DNS for their 'next generation WireGuard network', DNS leaks occur to the 209.x.x.x addresses.
This is what I've put together so far in changing the WAN to PIA DNS:
ifdown $PIA_INTERFACE
# add PIA WireGuard next generation DNS's to WAN
CURRENT_DNS1=$(uci show network | grep "wan.dns" | cut -d "'" -f 2)
CURRENT_DNS2=$(uci show network | grep "wan.dns" | cut -d "'" -f 4)
uci del_list network.wan.dns="$CURRENT_DNS1"
uci del_list network.wan.dns="$CURRENT_DNS2"
uci add_list network.wan.dns="$DNS1"
uci add_list network.wan.dns="$DNS2"
uci commit >/dev/null 2>&1
ifup $PIA_INTERFACE
I notice when the WireGuard (PIA_INTERFACE) is brought back up, I've got corresponding system log entries which show both WAN & WireGuard interfaces using the same 10.0.0.x DNS:
Sat Jul 18 23:00:55 2020 daemon.notice netifd: Interface 'WireGuard' is setting up now
Sat Jul 18 23:00:55 2020 daemon.notice netifd: Interface 'WireGuard' is now up
Sat Jul 18 23:00:55 2020 daemon.notice netifd: Network device 'WireGuard' link is up
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: reading /tmp/resolv.conf.auto
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain test
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain onion
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain localhost
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain local
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain invalid
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain bind
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using local addresses only for domain lan
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using nameserver 10.0.0.242#53
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using nameserver 10.0.0.244#53
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using nameserver 10.0.0.242#53
Sat Jul 18 23:00:55 2020 daemon.info dnsmasq[2594]: using nameserver 10.0.0.244#53
Sat Jul 18 23:00:55 2020 user.notice firewall: Reloading firewall due to ifup of WireGuard (WireGuard)
Not sure if by bringing up the wireguard interface is the only requirement after the changes are committed, or if other steps are required to make sure the transition from old WAN DNS to new WAN DNS is done smoothly?