Skip to content

Instantly share code, notes, and snippets.

@flexoid
flexoid / auto-dns.sh
Last active February 23, 2021 09:47 — forked from himalay/auto-dns.sh
[Pi-hole auto DNS switch] The script automatically switches the DNS servers between Pi-hole and Cloudflare based on Pi-hole DNS Server status. #pihole #openwrt
#!/bin/sh
# The script automatically changed DNS servers advertised by DHCP based on Pi-hole DNS Server status.
# https://gist.github.com/flexoid/fb2cc01b3ff3ac19659269a9c4c9ae2d
TARGET=192.168.20.112 # Pi-hole
FALLBACK=8.8.8.8,8.8.4.4
function set_fallback_dns() {
echo $(date)