0

My Ubuntu client is still using an OLD DNS in systemd-resolve. When I run systemd-resolve --status I find old and new DNS. The new DNS has been set using DHCP scope options on my network. I've successfully updated all my RHEL systems, but this is not the case for Debian/Ubuntu systemd:

From systemd-resolve --status:

      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.10.44 ( OLD )
                      192.168.10.69 ( NEW )

resolved.conf

cat /etc/systemd/resolved.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

resolv.conf

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
search example.com

/etc/systemd/network/ is empty.

I've countless times tried to restart systemd-resolved and systemd-networkd, since I read somewhere in Github systemd repo that systemd-networkd is responsible for updating stuff with DHCP which systemd-resolve will use.

EDIT:
/run/systemd/resolve/stub-resolv.conf

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
search example.com

EDIT2: As part of recent comments
/etc/netplan/50-cloud-init.yml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: XX:XX:XX:XX:XX
            set-name: ens3
3
  • 1
    Check the /run/systemd/resolve/stub-resolv.conf file.
    – GAD3R
    Oct 30, 2023 at 16:03
  • Updating the question, however, it's identical to resolv.conf.
    – N. J
    Oct 31, 2023 at 8:34
  • unix.stackexchange.com/questions/515154/… led me to /var/run/systemd/netif/. Doing a grep of my old DNS I found entires in /var/run/systemd/netif/state and /var/run/systemd/netif/links/2. Where the latter one referencing a netplan file: NETWORK_FILE=/run/systemd/network/10-netplan-ens3.network. I don't know where this file comes from, as I cannot find it on the system.
    – N. J
    Oct 31, 2023 at 9:06

1 Answer 1

0

NETWORK_FILE=/run/systemd/network/10-netplan-ens3.network you mentioned in the comments seems to refer to a Netplan-generated configuration file for systemd-networkd.

And the comments in /etc/netplan/50-cloud-init.yml suggest Netplan is, in turn, controlled by cloud-init:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.

So, cloud-init will push the 50-cloud-init.yml to /etc/netplan and will probably change it back if you modify it. But is that all it does? Its log files at /var/log/cloud-init*.log might provide enlightenment.

If it turns out cloud-init is force-adding your old DNS setting, then it also already told you how you can make cloud-init keep its hands off your network settings:

# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
1
  • I do have ONE file in /etc/netplan, but it's not "interesting". It doens't include DNS, only dhcp: true. I can update the question if that helps.
    – N. J
    Oct 31, 2023 at 12:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .