systemd-resolved 无法访问 zeroconf DNS 服务器

systemd-resolved 无法访问 zeroconf DNS 服务器

我正在尝试连接到 wifi 网络并使用本地网络中提供的 dns 服务器。Wifi 工作正常,但我无法获得 DNS 名称解析。我正在使用 NetworkManager 和 systemd-resolved。系统是最新的 archlinux。服务的 conf-Files 是空的,即没有特殊设置。有人看到问题或可以给我建议该尝试什么吗?

DNS 服务器(..0.1-本地网络中的服务器)是 172.17.0.1(所有其他能够建立连接的设备也表示他们使用此服务器作为 DNS)

更新:可能不是 DNS。可能是其他设备只是配置了备用 DNS 服务器?Systemd-resolved 就是不使用备用 DNS 服务器。但是,仅设置 8.8.4.4 之类的公共 DNS 并不是解决方案,因为连接不稳定,正如您从下面的长 ping 时间中看到的那样。

抱歉,我不是专家。我尝试了几个小时,并在 Google 上搜索了所有错误消息,但还是没能找到答案。

我尝试使用 dig 来访问它,我在下面提供了大量信息,我还尝试将 DNS 设置为 8.8.8.8,但连接似乎很慢且不稳定。有时,我会收到 DNS 响应(例如使用 dig),但不稳定,无法使用。在 Windows 和 iOS 上,此 WIFI 和 DNS 工作正常。

症状如下:没有名称解析。在 IP 上执行 Ping 操作有效。

~$ ping google.de
ping: google.de: Temporary failure in name resolution

以下是可能有帮助的更多信息


:~$ sudo nmap -sU 172.17.0.1
[sudo] password for konrad: 
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-19 09:47 CEST
Nmap scan report for 172.17.0.1
Host is up (0.0000090s latency).
Not shown: 998 closed udp ports (port-unreach)
PORT     STATE         SERVICE
5353/udp open|filtered zeroconf
5355/udp open|filtered llmnr

Nmap done: 1 IP address (1 host up) scanned in 14.38 seconds


:~$ dig @172.17.0.1 google.de -p 5353
;; communications error to 172.17.0.1#5353: timed out
;; communications error to 172.17.0.1#5353: timed out
;; communications error to 172.17.0.1#5353: timed out

; <<>> DiG 9.18.16 <<>> @172.17.0.1 google.de -p 5353
; (1 server found)
;; global options: +cmd
;; no servers could be reached




● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
     Active: active (running) since Wed 2023-07-19 09:41:07 CEST; 1min 48s ago
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
   Main PID: 8432 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 9352)
     Memory: 3.0M
        CPU: 183ms
     CGroup: /system.slice/systemd-resolved.service
             └─8432 /usr/lib/systemd/systemd-resolved

Jul 19 09:41:26 thebeast systemd-resolved[8432]: Using degraded feature set UDP instead of TCP for DNS server 172.17.0.1.
Jul 19 09:41:31 thebeast systemd-resolved[8432]: Using degraded feature set TCP instead of UDP for DNS server 172.17.0.1.
Jul 19 09:41:31 thebeast systemd-resolved[8432]: Using degraded feature set UDP instead of TCP for DNS server 172.17.0.1.
Jul 19 09:41:36 thebeast systemd-resolved[8432]: Using degraded feature set TCP instead of UDP for DNS server 172.17.0.1.
Jul 19 09:41:36 thebeast systemd-resolved[8432]: Using degraded feature set UDP instead of TCP for DNS server 172.17.0.1.
Jul 19 09:41:42 thebeast systemd-resolved[8432]: wlan0: Bus client set default route setting: no
Jul 19 09:41:42 thebeast systemd-resolved[8432]: wlan0: Bus client reset DNS server list.
Jul 19 09:41:43 thebeast systemd-resolved[8432]: Switching to fallback DNS server 1.1.1.1#cloudflare-dns.com.
Jul 19 09:42:05 thebeast systemd-resolved[8432]: enp0s29u1u3: Bus client set default route setting: yes
Jul 19 09:42:05 thebeast systemd-resolved[8432]: enp0s29u1u3: Bus client set DNS server list to: 172.20.10.1


● NetworkManager.service - Network Manager
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: disabled)
     Active: active (running) since Wed 2023-07-19 09:38:50 CEST; 7min ago
       Docs: man:NetworkManager(8)
   Main PID: 8213 (NetworkManager)
      Tasks: 4 (limit: 9352)
     Memory: 10.4M
        CPU: 715ms
     CGroup: /system.slice/NetworkManager.service
             └─8213 /usr/bin/NetworkManager --no-daemon

Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4450] device (p2p-dev-wlan0): supplicant management interface state: 4way_handshake -> completed
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4452] device (wlan0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4458] dhcp4 (wlan0): activation: beginning transaction (timeout in 45 seconds)
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4547] dhcp4 (wlan0): state changed new lease, address=172.17.5.78
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4550] policy: set 'Gast' (wlan0) as default for IPv4 routing and DNS
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4703] device (wlan0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4729] device (wlan0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4731] device (wlan0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4734] manager: NetworkManager state is now CONNECTED_SITE
Jul 19 09:46:28 thebeast NetworkManager[8213]: <info>  [1689752788.4740] device (wlan0): Activation: successful, device activated.


:~$ sudo ss -pan 'sport = 53'
Netid        State         Recv-Q         Send-Q                 Local Address:Port                 Peer Address:Port        Process                                            
udp          UNCONN        0              0                         127.0.0.54:53                        0.0.0.0:*            users:(("systemd-resolve",pid=8432,fd=22))        
udp          UNCONN        0              0                      127.0.0.53%lo:53                        0.0.0.0:*            users:(("systemd-resolve",pid=8432,fd=20))        
tcp          LISTEN        0              4096                   127.0.0.53%lo:53                        0.0.0.0:*            users:(("systemd-resolve",pid=8432,fd=21))        
tcp          LISTEN        0              4096                      127.0.0.54:53                        0.0.0.0:*            users:(("systemd-resolve",pid=8432,fd=23)) 


:~$ resolvectl 
Global
           Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
    resolv.conf mode: stub
Fallback DNS Servers: 1.1.1.1#cloudflare-dns.com 9.9.9.9#dns.quad9.net 8.8.8.8#dns.google 2606:4700:4700::1111#cloudflare-dns.com 2620:fe::9#dns.quad9.net
                      2001:4860:4860::8888#dns.google

Link 2 (eno1)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 5 (wlan0)
    Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 172.17.0.1
       DNS Servers: 172.17.0.1

Link 6 (docker0)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 8 (wwp0s20u8c2i12)
    Current Scopes: LLMNR/IPv6 mDNS/IPv6
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported

所有其他设备(Windows、手机、iOS)使用此 DNS 服务器 172.17.0.1 并获得 DNS 解析。

Google公共DNS可以ping通,但是不可靠。

$ ping 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=114 time=1060 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=114 time=504 ms

端口 53 上的连接没有响应

~$ dig @172.17.0.1 google.de
;; communications error to 172.17.0.1#53: connection refused
;; communications error to 172.17.0.1#53: connection refused
;; communications error to 172.17.0.1#53: connection refused

; <<>> DiG 9.18.16 <<>> @172.17.0.1 google.de
; (1 server found)
;; global options: +cmd
;; no servers could be reached

看来 DNS 服务器上的 53 端口不可用

:~$ sudo nmap -sX 172.17.0.1
[sudo] password for konrad: 
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-19 20:09 CEST
Nmap scan report for 172.17.0.1
Host is up (0.0000050s latency).
Not shown: 999 closed tcp ports (reset)
PORT   STATE         SERVICE
22/tcp open|filtered ssh

Nmap done: 1 IP address (1 host up) scanned in 14.29 seconds

:~$ sudo nmap -A -p 53 172.17.0.1
[sudo] password for konrad: 
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-19 20:16 CEST
Nmap scan report for 172.17.0.1
Host is up (0.000056s latency).

PORT   STATE  SERVICE VERSION
53/tcp closed domain
Too many fingerprints match this host to give specific OS details
Network Distance: 0 hops

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 14.83 seconds

答案1

不存在“零配置 DNS 服务器”——端口 5353 用于多播 DNS,其设计为无服务器。mDNS 节点仅响应针对其自身名称(几乎总是*.local名称)的查询——它们不充当通用 DNS 的递归解析器。5355 上的 LLMNR 也是如此。

网络提供的实际 DNS 服务是通过 DHCP 发现的,并且始终在端口 53 上运行(UDP,通常也是 TCP)。使用dig 没有-p访问它的参数。

(虽然从技术上讲,zeroconf 具有发现单播 DNS 服务器的机制,但实际上没有人使用它,并且服务器无论如何仍会在端口 53 上运行。)

根据您的扫描,服务器没有监听 UDP 端口,并且根据系统日志,它也没有监听 TCP 53。

如果服务器响应 ping 但不响应 DNS 查询,则表明配置错误。

相关内容