Change location of resolv.conf

This commit is contained in:
Bob Mottram 2017-06-14 10:48:41 +01:00
parent 5fdaabdaf4
commit a6cbf0dc65
6 changed files with 39 additions and 23 deletions

View File

@ -239,8 +239,18 @@ iface eth0 inet static
$rootdir/etc/network/interfaces
fi
sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
# configure DNS
resolvconf=$rootdir/var/run/NetworkManager/resolv.conf
chattr -i $resolvconf
echo 'domain localdomain' > $resolvconf
echo 'search localdomain' >> $resolvconf
echo "nameserver $NAMESERVER1" >> $resolvconf
echo "nameserver $NAMESERVER2" >> $resolvconf
echo "nameserver $NAMESERVER3" >> $resolvconf
echo "nameserver $NAMESERVER4" >> $resolvconf
echo "nameserver $NAMESERVER5" >> $resolvconf
echo "nameserver $NAMESERVER6" >> $resolvconf
chattr +i $resolvconf
if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
# change the motd to show further install instructions

View File

@ -315,7 +315,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 /var/run/NetworkManager/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."
fi
fi
}

View File

@ -196,20 +196,22 @@ function configure_dns {
return
fi
# allow changes to resolv.conf
chattr -i /etc/resolv.conf
resolvconf=/var/run/NetworkManager/resolv.conf
echo 'domain localdomain' > /etc/resolv.conf
echo 'search localdomain' >> /etc/resolv.conf
echo "nameserver $NAMESERVER1" >> /etc/resolv.conf
echo "nameserver $NAMESERVER2" >> /etc/resolv.conf
echo "nameserver $NAMESERVER3" >> /etc/resolv.conf
echo "nameserver $NAMESERVER4" >> /etc/resolv.conf
echo "nameserver $NAMESERVER5" >> /etc/resolv.conf
echo "nameserver $NAMESERVER6" >> /etc/resolv.conf
# allow changes to resolv.conf
chattr -i $resolvconf
echo 'domain localdomain' > $resolvconf
echo 'search localdomain' >> $resolvconf
echo "nameserver $NAMESERVER1" >> $resolvconf
echo "nameserver $NAMESERVER2" >> $resolvconf
echo "nameserver $NAMESERVER3" >> $resolvconf
echo "nameserver $NAMESERVER4" >> $resolvconf
echo "nameserver $NAMESERVER5" >> $resolvconf
echo "nameserver $NAMESERVER6" >> $resolvconf
# prevent resolv.conf from changing
chattr +i /etc/resolv.conf
chattr +i $resolvconf
mark_completed $FUNCNAME
}

View File

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

View File

@ -76,7 +76,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 /var/run/NetworkManager/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."
# Default diffie-hellman key length in bits
DH_KEYLENGTH=2048

View File

@ -447,7 +447,8 @@ function networks_from_file {
fi
done < $WIFI_NETWORKS_FILE
chattr -i /etc/resolv.conf
resolvconf=/var/run/NetworkManager/resolv.conf
chattr -i $resolvconf
systemctl restart network-manager
ifconfig ${WIFI_INTERFACE} up
}