• Thomas Haller's avatar
    dns: write original DNS servers to /var/run/NetworkManager/no-stub-resolv.conf · 0dc673f0
    Thomas Haller authored
    When a DNS plugin is enabled (like "main.dns=dnsmasq" or "main.dns=systemd-resolved"),
    the name servers announced to the rc-manager are coerced to be 127.0.0.1
    or 127.0.0.53.
    
    Depending on the "main.rc-manager" setting, also "/etc/resolv.conf"
    contains only this coerced name server to the local caching service.
    The same is true for "/var/run/NetworkManager/resolv.conf" file, which
    contains what we would write to "/etc/resolv.conf" (depending on
    the "main.rc-manager" configuration).
    
    Write a new file "/var/run/NetworkManager/no-stub-resolv.conf", which contains
    the original name servers, uncoerced. Like "/var/run/NetworkManager/resolv.conf",
    this file is always written.
    
    The effect is, when one enables "main.dns=systemd-resolved", then there
    is still a file "no-stub-resolv.conf" with the same content as with
    "main.dns=default".
    
    The no-stub-resolv.conf may be a possible solution, when a user wants
    NetworkManager to update systemd-resolved, but still have a regular
    /etc/resolv.conf [1]. For that, the user could configure
    
        [main]
        dns=systemd-resolved
        rc-manager=unmanaged
    
    and symlink "/etc/resolv.conf" to "/var/run/NetworkManager/no-stub-resolv.conf".
    This is not necessarily the only solution for the problem and does not preclude
    options for updating systemd-resolved in combination with other DNS plugins.
    
    [1] #20
    0dc673f0
nm-dns-manager.c 70.8 KB