Update: Looks like it's avahi-dnsconfd that's adding 8.8.8.8 and 8.8.4.4 to my /etc/resolv.conf file. I found this in /var/log/syslog:
Jan 4 17:00:21 freewill nm-dispatcher: req:1 'up' [ens33]: start running ordered scripts...
Jan 4 17:00:21 freewill avahi-dnsconfd[3579]: New DNS Server 8.8.4.4 (interface: 2.IPv4)
Jan 4 17:00:21 freewill avahi-dnsconfd[3579]: New DNS Server 8.8.8.8 (interface: 2.IPv4)
How can I make Ubuntu fetch DNS servers from DHCP only and not use Avahi (mDNS) for fetching DNS servers?
I am testing out Ubuntu Mate 16.04.1 LTS, and having trouble because something keeps adding Google's DNS servers to /etc/resolv.conf:
josh@freewill:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.100.1.1
nameserver 8.8.4.4
nameserver 8.8.8.8
search my.domain.name
I don't want 8.8.4.4 nor 8.8.8.8 in /etc/resolv.conf because that breaks my local network: My local DNS server (10.100.1.1) serves DNS for local NATed services which don't have public DNS records.
If I manually edit /etc/resolv.conf and remove the Google DNS nameservers, they get added back again by a reboot or resolvconf -u
NetworkManager does not have 8.8.8.8 nor 8.8.4.4 listed under Additional DNS Servers so that's not the cause.
The system has three ethernet interfaces, only one is connected. It's on a network with a DCHP server that provides DNS information. Contents of /etc/network/interfaces is:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
I have run grep -R '8\.8\.8\.8' /etc and there's no other reference to 8.8.8.8 in any config file. Nothing under /etc/resolvconf refers to Google DNS servers, either!
Why is Ubuntu Mate adding Google DNS servers to /etc/resolv.conf and how can I make it stop? For now, I've done sudo rm /etc/resolv.conf; sudo cp /run/resolvconf/resolv.conf /etc/resolv.conf; sudo chattr +i /etc/resolv.conf but I know that in the future this will bite me...