如何从 systemd-resolve 中删除 DNS 选项

如何从 systemd-resolve 中删除 DNS 选项

我不确定如何更改 resolvconf 在连接时找到的 DNS 选项列表。systemd-resolve --status输出

Global
         Protocols: -LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: foreign
Current DNS Server: serverine
       DNS Servers: serverone
                    serveronev6
                    servertwo
                    servertwov6

Link 2 (wlp0s20f3)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.4.4
       DNS Servers: 8.8.8.8 8.8.4.4

cat /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 serverone
nameserver serveronev6
nameserver servertwo
# Too many DNS servers configured, the following entries may be ignored.
nameserver servertwov6
nameserver 8.8.8.8
nameserver 8.8.4.4
search .

服务器一和服务器二是我想要使用的两个 DNS 服务器,v6 是 ipv6 地址。我想摆脱 link2 下的 google dns 选项,只在全局中使用我的;我如何使用 systemd-resolve 来实现这一点?

答案1

您需要使用 /etc/systemd/resolved.conf 上的 DNS= 设置来设置适当的名称服务器

resolv.conf 完全由resolved 管理,您不应该编辑它。

相关内容