systemd-resolved 超时后切换 DNS

systemd-resolved 超时后切换 DNS

我有一个本地 DNS 服务器来解析我的 LAN 上的名称,但是 systemd-resolved 只使用它几分钟,然后就切换到不同的 DNS 服务器。

/var/log/syslog
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Transaction 29195 for <feeds.propublica.org IN AAAA> scope dns on wlp2s0/*.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Using feature level UDP+EDNS0 for transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Using DNS server 192.168.1.250 for transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Sending query packet with id 29195.
...
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Timeout reached on transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Retrying transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Switching to DNS server 192.168.1.1 for interface wlp2s0.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Cache miss for feeds.propublica.org IN AAAA
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Transaction 29195 for <feeds.propublica.org IN AAAA> scope dns on wlp2s0/*.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Using feature level UDP+EDNS0 for transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Using DNS server 192.168.1.1 for transaction 29195.
Mar 11 16:38:06 allen-dell systemd-resolved[20854]: Sending query packet with id 29195.

有没有办法告诉 systemd-resolved 不要切换?


更新

我曾尝试将 192.168.1.250 作为唯一的 NS,但似乎我的路由器(D-Link DIR-860L)中的 dhcp 明确将其网关添加到租约中(因为我没有手动指定它)。

systemd-resolve --status
Link 3 (wlp2s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.1.250
                      192.168.1.1
          DNS Domain: ~.
                      local

dhclient-XXX-wlp2s0.lease
lease {
...
  option domain-name-servers 192.168.1.250,192.168.1.1;

答案1

我认为您正在寻找的是/etc/systemd/resolved.conf,但它可能不会阻止它接受 DHCP 服务器提出的开启。

相关内容