Files
scripts/UnboundUnbound

21 lines
663 B
Bash
Executable File

#!/bin/bash
#Simple script to use standard DNS if Unbound (behind Adguard) is unavailable for some reason
if [[ -z $1 ]]; then
SECONDS=0
# ^ If nothing is specified, do not wait
else
SECONDS=$1
# ^ If specified, wait however many seconds user specifies
fi
sleep $SECONDS
if ! nc -vz localhost 53 >/dev/null 2>&1; then
# ^ If you cannot connect to DNS port on local host
sed -i -e 's/192.168.0.66/1.1.1.1/g' /etc/resolv.conf
# ^ replace local address with 1.1.1.1 (Cloudflare DNS)
else
sed -i -e 's/1.1.1.1/192.168.0.66/g' /etc/resolv.conf
# ^ If connection is established, use local DNS
fi
#Force update of DNS resolution
/sbin/netconfig update -f