Use resolvconf for dns resolution

This commit is contained in:
Bob Mottram 2017-06-22 17:52:52 +01:00
parent 6b74243de2
commit 9d4858c07e
6 changed files with 14 additions and 13 deletions

View File

@ -178,6 +178,8 @@ EOF
}
configure_networking() {
chroot "$rootdir" apt-get -yq install resolvconf
if [[ "$MACHINE" == "beaglebonewifi" ]]; then
# Allow networking over USB in order to configure the
# wifi login settings
@ -244,7 +246,7 @@ iface eth0 inet static
fi
# configure DNS
resolvconf=$rootdir/etc/resolv.conf
resolvconf=$rootdir/etc/resolvconf/resolv.conf.d/head
echo 'domain localdomain' > $resolvconf
echo 'search localdomain' >> $resolvconf
echo "nameserver $NAMESERVER1" >> $resolvconf
@ -253,6 +255,7 @@ iface eth0 inet static
echo "nameserver $NAMESERVER4" >> $resolvconf
echo "nameserver $NAMESERVER5" >> $resolvconf
echo "nameserver $NAMESERVER6" >> $resolvconf
chroot "$rootdir" resolvconf -u
if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
# change the motd to show further install instructions

View File

@ -316,7 +316,7 @@ function read_configuration_values {
if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
read_config_param "DEBIAN_REPO"
CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /etc/resolvconf/resolv.conf.d/head, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
fi
fi
}

View File

@ -196,7 +196,9 @@ function configure_dns {
return
fi
resolvconf=/etc/resolv.conf
apt-get -yq install resolvconf
resolvconf=/etc/resolvconf/resolv.conf.d/head
# allow changes to resolv.conf
chattr -i $resolvconf
@ -211,7 +213,7 @@ function configure_dns {
echo "nameserver $NAMESERVER6" >> $resolvconf
# prevent resolv.conf from changing
chattr +i $resolvconf
resolvconf -u
mark_completed $FUNCNAME
}

View File

@ -310,10 +310,9 @@ function resolve_dns_via_tor {
sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf
# point resolv.conf to tor
resolvconf=/etc/resolv.conf
chattr -i $resolvconf
resolvconf=/etc/resolvconf/resolv.conf.d/head
echo 'nameserver 127.0.0.1:53' > $resolvconf
chattr +i $resolvconf
resolvconf -u
mark_completed $FUNCNAME
}
@ -378,12 +377,11 @@ function route_outgoing_traffic_through_tor {
/sbin/sysctl -p -q
fi
resolvconf=/etc/resolv.conf
chattr -i $resolvconf
resolvconf=/etc/resolvconf/resolv.conf.d/head
echo 'domain localdomain' > $resolvconf
echo 'search localdomain' >> $resolvconf
echo 'nameserver 127.0.0.1' >> $resolvconf
chattr +i $resolvconf
resolvconf -u
if ! grep -q "VirtualAddrNetworkIPv4" /etc/tor/torrc; then
echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >> /etc/tor/torrc

View File

@ -80,7 +80,7 @@ COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
# message if something fails to install
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolvconf/resolv.conf.d/head, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
# Default diffie-hellman key length in bits
DH_KEYLENGTH=2048

View File

@ -466,8 +466,6 @@ function networks_from_file {
fi
done < $WIFI_NETWORKS_FILE
resolvconf=/etc/resolv.conf
chattr -i $resolvconf
systemctl restart network-manager
#ifconfig ${WIFI_INTERFACE} up
ifup $WIFI_INTERFACE