Wrong nameserver set by resolvconf and NetworkManager
Solution 1:
Known systemd bug.
Temporary workaround with no need to reconfigure if the DNS IP's changes:
sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
reboot
Solution 2:
Try editing /etc/systemd/resolved.conf
, adding your desired DNS server:
change this:
[Resolve]
#DNS=
to this (but use the one you want - this is an example):
[Resolve]
DNS=192.168.1.152
after that, restart the service:
service systemd-resolved restart
And when you check the status you should see
$ systemd-resolve --status
Global
DNS Servers: 192.168.1.152
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
Solution 3:
I finally got a solution for this problem for ubuntu 17.10. By default this version of Ubuntu uses systemd-resolved
, which I hope is going to be stable for the next versions.
In order to use custom dns instead of the local systemd-resolved cache, do the following:
add new nameservers. Edit the file in
/etc/systemd/resolved.conf
as sudoer. Here I've commented out the DNS entry and placed my dns[Resolve] DNS=10.96.0.10 8.8.8.8 8.8.4.4
cancel the actual symlink to
/etc/resolv.conf
- create a new symlink
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- restart the service
sudo service systemd-resolved restart
- restart the network manager
sudo systemctl restart networking
And now if you dig to a name provided by your add dns, you should see the record resolved dig nexus.default.svc.cluster.mydomain
Last step is to update the order of resolution in /etc/nsswitch.conf
, by placing the dns before the mdns4_minimal
hosts files dns mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] myhostname