After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787378 - invalid resolv.conf when using dns=systemd-resolved
invalid resolv.conf when using dns=systemd-resolved
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: IP and DNS config
1.8.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-09-06 17:25 UTC by Sven
Modified: 2017-09-07 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sven 2017-09-06 17:25:12 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.
Comment 1 Thomas Haller 2017-09-07 13:16:20 UTC
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.
Comment 2 Sven 2017-09-07 13:24:39 UTC
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.
Comment 3 Thomas Haller 2017-09-07 13:36:35 UTC
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.