From c6ce18527fbabe20073d9163b17f3e2e1f235a03 Mon Sep 17 00:00:00 2001 From: Chad Howell Date: Tue, 19 Jan 2016 01:54:20 -0500 Subject: [PATCH] Add ability to choose upstream DNS servers Give the user the ability to choose between Google and DynDNS upstream servers. Then insert the chosen DNS servers in to /etc/dnsmasq.d/01-pihole.conf. Todo: extend choices to include manually entered DNS servers. --- automated install/basic-install.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8a402605..0b6d1aeb 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -200,6 +200,27 @@ done fi } +setDNS() +{ +DNSChoseCmd=(whiptail --separate-output --radiolist "Select DNS Servers" $r $c 2) +DNSChooseOptions=(Google "Use Google's DNS Servers" on + DynDNS "Use DynDNS's DNS Servers" off) +DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) + +case $DNSchoices in + Google) + echo "Google selected." + piholeDNS1="8.8.8.8" + piholeDNS2="8.8.4.4" + ;; + DynDNS) + echo "DynDNS selected." + piholeDNS1="208.67.222.222" + piholeDNS2="208.67.220.220" + ;; +esac +} + setDHCPCD(){ # Append these lines to dhcpcd.conf to enable a static IP echo "interface $piholeInterface @@ -234,6 +255,8 @@ $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig $SUDO curl -o /etc/dnsmasq.conf/01-pihole.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/01-pihole.conf $SUDO curl -o /etc/lighttpd/lighttpd.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf $SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.d/01-pihole.conf +$SUDO sed -i "s/@DNS1@/$piholeDNS1/" /etc/dnsmasq.d/01-pihole.conf +$SUDO sed -i "s/@DNS2@/$piholeDNS2/" /etc/dnsmasq.d/01-pihole.conf } stopServices(){ @@ -330,6 +353,9 @@ else echo "IPv6 will NOT be used." fi +#Decide what upstream DNS Servers to use +setDNS + # Install and log everything to a file installPihole | tee $tmpLog