systemd-resolveはDHCPのDNSを使用しません。

systemd-resolveはDHCPのDNSを使用しません。

私のUbuntuクライアントはまだsystemd-resolveで古いDNSを使用しています。実行すると、systemd-resolve --status古いDNSと新しいDNSが見つかります。私のネットワークのDHCPスコープオプションを使用して新しいDNSを設定しました。すべてのRHELシステムを正常に更新しましたが、Debian / Ubuntu systemdは更新しませんでした。

~からsystemd-resolve --status:

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

解決.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

構成ファイルの解析

# 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/ネットワーク/空いた。

systemd-networkdがDHCPを使用してsystemd-resolveが使用する内容を更新するGithub systemdリポジトリを読み取ったため、systemd-resolvedとsystemd-networkdを何度も再起動しようとしました。

編集する:
/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

編集2: 最近のレビューの一環として
/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

ベストアンサー1

NETWORK_FILE=/run/systemd/network/10-netplan-ens3.networkあなたのコメントで言及したのは、Netplanによって生成された設定ファイルを参照しているようですsystemd-networkd

/etc/netplan/50-cloud-init.ymlNetplanのコメントは次のように制御することをお勧めしますcloud-init

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

したがって、cloud-initはそれをプッシュし50-cloud-init.yml/etc/netplan変更すると再度変更できます。しかし、これは?みんなうん?ログファイルから/var/log/cloud-init*.logインスピレーションを得ることができます。

cloud-initが以前のDNS設定を強制的に追加することが判明した場合は、cloud-initがネットワーク設定を妨げないようにする方法も既に教えています。

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

おすすめ記事