GNOME Bugzilla – Bug 787378
invalid resolv.conf when using dns=systemd-resolved
Last modified: 2017-09-07 13:36:35 UTC
When setting dns=systemd-resolved, then /etc/resolv.conf should include the line "nameserver 127.0.0.53". But on my system, the line is "nameserver 127.0.0.1" instead. That won't work, cause systemd-resolved's DNS Stub Listener only listens on 127.0.0.53. E.g. virtualbox stopped working because of this. See https://www.freedesktop.org/software/systemd/man/resolved.conf.html for reference. I'm using NetworkManager 1.8.2 on Gentoo.
Does that mean, resolved never listens on 127.0.0.1:53, but if you optionally configure DNSStubListener=, then it will listen on 127.0.0.53:53? In that case, it sounds like that NM should indeed always configure 127.0.0.53. I think the workarounds are: (1) configure rc-manager=unmanaged and write /etc/resolv.conf yourself however you like. See `man NetworkManager.conf`. (2) configure rc-manager=symlink (this should already be the default), and replace /etc/resolv.conf with a symlink to /usr/lib/systemd/resolv.conf I think (2) is preferred. Indeed, if you - omit both "dns=" an "rc-manager=" settings in NetworkManager.conf - make /etc/resolv.conf a symlink to /usr/lib/systemd/resolv.conf it should just work without additional configuration.
systemd-resolved never listens on 127.0.0.1:53. If the stub listener is enabled (it is enabled by default), then it listens on 127.0.0.53:53 and 127.0.0.53:53 only. As far as I can see, the address cannot be changed. In other words: it's not possible have resolved listen on any address other than 127.0.0.53. I agree that NM should always configure 127.0.0.53 if dns=systemd-resolved.
Should be fixed on master with: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=ac5350fef242e08f3056414be4c86e6d14718cf3 Thanks for reporting! What I meant in comment 1 maybe wasn't very clear. Let me try again: AFAIU it's advised that you symlink /etc/resolv.conf to /usr/lib/systemd/resolv.conf. That way you indicate to resolved that it is the default resolver. If you further leave dns= and rc-manager= unset (rc-manager should default to "symlink", depending on NM's compile time defaults), then NM will automatically understand to use resolved and not touch /etc/resolv.conf. So, all you really need to do is set the symlink and don't configure anything in NM.