You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Ubuntu至22.04后出现重复DNS条目问题求助

升级Ubuntu至22.04后出现重复DNS条目问题求助

大家好,我遇到了一个挺头疼的问题,想请教下各位大佬。我的服务器有两块配置了DHCP的网卡,从Ubuntu 20.04(内核版本5.4.0-144-generic)升级到22.04(内核版本5.15.0-67-generic)之后,/var/run/systemd/resolve/resolv.conf里出现了重复的DNS条目,直接导致我的kubelet服务异常——因为它只认两个DNS服务器。

我的/etc/netplan/00-installer-config.yaml配置一直没变,内容是这样的:

# This is the network config written by 'subiquity'
network:
  ethernets:
    eno1:
      dhcp4: true
    eno2:
      dhcp4: true
  version: 2

但升级完成后,/var/run/systemd/resolve/resolv.conf变成了这个样子,DNS条目完全重复了:

# 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 .

反观还没升级的同配置服务器,这个文件是正常的,只有两条DNS条目:

# 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

两台服务器的netplan配置完全一致,都是双网卡DHCP模式,但只有升级后的服务器出现了DNS重复的问题。本来我觉得多几条DNS可能影响不大,但kubelet卡死在这个点上,必须解决。

目前我临时的解决办法是把eno2的dhcp4: true改成false,手动配置路由和IP,但这明显只是个临时 workaround,不是长久之计。

我搜了很多关于Ubuntu版本升级、netplan与重复DNS条目相关的资料,但都没找到对应的解决方案,现在不敢轻易升级其他服务器,怕都出问题。

更新:我确认了两台服务器使用的都是systemd-networkd,不是NetworkManager。

备注:内容来源于stack exchange,提问作者DrLime2k10

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 11:12:43