DNS 解析/已解决在 Fedora 35 上不起作用

DNS 解析/已解决在 Fedora 35 上不起作用

我的笔记本电脑上的 DNS 解析已损坏,我运行的是 Fedora 35

今天开始出现这个问题,机器已经好几天没有使用了,并且由于放电而死机(当时可能在linux上),我双启动Win10并且网络正常...尝试了硬重置,然后确保 Windows 关闭而不快速启动。

正在发挥作用的事情:

  • ping 1.1.1.1或任何IP
  • 电报

如果我禁用并屏蔽resolved并修改resolv.conf以使用1.1.1.1它,它就可以正常工作(我如何发布此内容)

以下所有数据都是在我屏蔽并禁止resolv.conf发布此内容之前

/etc/resolv.conf:

# This is /run/systemd/resolve/stub-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 to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# 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 127.0.0.53
options edns0 trust-ad
search .

resolvectl status

sids@uss-enterprise ~> resolvectl status
Global
       Protocols: LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

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

Link 3 (wlp4s0)
Current Scopes: LLMNR/IPv4 LLMNR/IPv6
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 4 (ipv6leakintrf0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: ::1
       DNS Servers: ::1
        DNS Domain: ~.

systemd-resolved服务状态:

sids@uss-enterprise ~> sudo systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/systemd-resolved.service.d
             └─override.conf
     Active: active (running) since Fri 2021-11-19 20:53:32 IST; 20s 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: 3695 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 18842)
     Memory: 8.4M
        CPU: 89ms
     CGroup: /system.slice/systemd-resolved.service
             └─3695 /usr/lib/systemd/systemd-resolved

Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.172 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=29 signature=u>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: D-Bus LLMNR change request from client PID 1168 (n/a) with UID 4294967295
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Sent message type=method_return sender=n/a destination=:1.23 path=n/a interface=n/a member=n/a cookie=30 reply_cookie=1545 signature=n/a error-name=n/a error>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Got message type=method_call sender=:1.23 destination=:1.172 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=SetLinkDNS cook>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetConnectionUnixU>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.172 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=31 signature=u>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetConnectionUnixP>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.172 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=32 signature=u>
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: D-Bus DNS server change request from client PID 1168 (n/a) with UID 4294967295
Nov 19 20:53:32 uss-enterprise systemd-resolved[3695]: Sent message type=method_return sender=n/a destination=:1.23 path=n/a interface=n/a member=n/a cookie=33 reply_cookie=1546 signature=n/a error-name=n/a error>

给予解决的覆盖:

[Service]
Environment=SYSTEMD_LOG_LEVEL=debug

已解决的日志级别:

sids@uss-enterprise ~> sudo systemctl service-log-level systemd-resolved
debug

奇怪的是我在以下位置看不到任何日志(甚至是我可以看到的日志systemctl statusjournalctl

sids@uss-enterprise ~> sudo journalctl -u systemd-resolved -f
-- Journal begins at Sun 2021-10-31 18:01:42 IST. --
Nov 21 20:39:41 uss-enterprise systemd-resolved[1119]: proton0: Bus client set DNS server list to: 10.18.0.1
Nov 21 20:39:41 uss-enterprise systemd-resolved[1119]: ipv6leakintrf0: Bus client set default route setting: no
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: ipv6leakintrf0: Bus client set search domain list to: ~.
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: ipv6leakintrf0: Bus client set default route setting: yes
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: ipv6leakintrf0: Bus client set DNS server list to: ::1
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: proton0: Bus client reset search domain list.
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: proton0: Bus client set default route setting: no
Nov 21 22:10:41 uss-enterprise systemd-resolved[1119]: proton0: Bus client reset DNS server list.
Nov 25 00:32:28 uss-enterprise systemd-resolved[1119]: Clock change detected. Flushing caches.
Nov 25 00:53:08 uss-enterprise systemd-resolved[1119]: Clock change detected. Flushing caches.

一些尝试使用以下方法解析 dns dig:192.168.22.215 是我的路由器的网关

sids@uss-enterprise ~> dig @192.168.22.215 fedoraproject.org

; <<>> DiG 9.16.23-RH <<>> @192.168.22.215 fedoraproject.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44291
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;fedoraproject.org.     IN  A

;; ANSWER SECTION:
fedoraproject.org.  55  IN  A   13.250.126.156
fedoraproject.org.  55  IN  A   13.212.21.54
fedoraproject.org.  55  IN  A   13.233.183.170
fedoraproject.org.  55  IN  A   38.145.60.21
fedoraproject.org.  55  IN  A   38.145.60.20
fedoraproject.org.  55  IN  A   13.125.120.8

;; Query time: 7 msec
;; SERVER: 192.168.22.215#53(192.168.22.215)
;; WHEN: Fri Nov 19 21:00:15 IST 2021
;; MSG SIZE  rcvd: 131

dig与 127.0.0.53:

sids@uss-enterprise ~> dig @127.0.0.53 fedoraproject.org

; <<>> DiG 9.16.23-RH <<>> @127.0.0.53 fedoraproject.org
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

编辑:

/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. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the resolved.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
#
# See resolved.conf(5) for details.

[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google:     8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9:      9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
# DNS=1.1.1.1
#FallbackDNS=
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=resolve
#Cache=yes
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no

dig127.0.0.1

dig @127.0.0.1 fedoraproject.org

; <<>> DiG 9.16.23-RH <<>> @127.0.0.1 fedoraproject.org
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

nmap 开启127.0.0.53

sids@uss-enterprise ~ [9]> sudo nmap -sU 127.0.0.53 -p 53
[sudo] password for sids: 
Starting Nmap 7.91 ( https://nmap.org ) at 2021-11-26 01:06 IST
Nmap scan report for localhost (127.0.0.53)
Host is up.

PORT   STATE         SERVICE
53/udp open|filtered domain

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

nmap 上127.0.0.1

sids@uss-enterprise ~> sudo nmap -sU 127.0.0.1 -p 53
Starting Nmap 7.91 ( https://nmap.org ) at 2021-11-26 01:06 IST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000042s latency).

PORT   STATE  SERVICE
53/udp closed domain

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

/run/systemd/resolve/stub-resolv.conf已符号链接,请/etc/resolv.conf参阅上面的内容

/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 ::1
search .

答案1

修复!

这是一个损坏的 VPN 设置,还记得我提到过该设备在 Linux 上被放电了吗?

VPN 连接当时处于活动状态,并且正在执行 DNS 泄漏保护,因此它配置了虚拟网络接口来解析 DNS

该网络在重新启动后仍然处于活动状态,但 VPN 未运行,因此所有内容都被丢弃

启动 VPN,它开始工作,在我关闭 VPN 后,它断开虚拟网络并使用完整解析功能。

将其放在这里以防其他人发现它有用

相关内容