我在 Arch Linux 上使用 systemd 213,并且 systemd-networkd/resolved with DHCP 连接到互联网。我还在 127.0.0.1 上运行缓存 DNS 服务器。我想让这个服务器成为列表中的第一个 DNS 服务器,但我也想使用 systemd-resolved 发现的名称服务器。使用静态 resolv.conf 是不可能的,因为我连接到具有不同 DNS 设置的网络。
我知道我可以设置备用DNS服务器/etc/systemd/resolved.conf,但有与systemd-networkd的方式预先考虑我的本地DNS服务器,那些DHCP发现的?
DNS在.network文件中添加一个手动条目会导致该条目被附加而不是前置:
# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different …Run Code Online (Sandbox Code Playgroud)