0

My server has two network interfaces configured with DHCP and after updating from Ubuntu 20.04 5.4.0-144-generic to 22.04 5.15.0-67-generic, this results in /var/run/systemd/resolve/resolv.conf containing duplicate DNS entries.

My /etc/netplan used to look like,

$ cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    eno1:
      dhcp4: true
    eno2:
      dhcp4: true
  version: 2

But after updating this now results in something like:

$ cat /var/run/systemd/resolve/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs should typically 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 192.168.18.2 nameserver 192.168.18.1 nameserver 192.168.18.2

Too many DNS servers configured, the following entries may be ignored.

nameserver 192.168.18.1 search .

On the server I haven't updated, /var/run/systemd/resolve/resolv.conf looks like:

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# 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 192.168.18.2 nameserver 192.168.18.1

The netplan configuration is identical on both servers, both servers use two interfaces, but only the new one duplicates the DNS' with the dhcp4: true setting.

Normally I wouldn't care as much, since I expect it just chooses one at random anyways. But I'm running a kubelet service, which only expects two DNS servers in this particular file, and now that breaks.

My temporary fix is to use dhcp4: false for the eno2 interface, (in the netplan config) and manually configure the routes and addresses I need, but this is obviously a workaround.

I've tried to look online for changes between the two Ubuntu versions, and netplan and duplicate DNS entries, but I've not been able to find anything, and I don't really feel like updating the other servers until I have a good solution for this.

Update:

From Am I running NetworkManager or networkd? both servers are running systemd-networkd.

1 Answers1

1

Instead of:

dhcp4: false

try:

dhcp4: true
dhcp4-overrides:
  use-dns: false