需要手动启动 systemd-resolved 才能使互联网正常工作

需要手动启动 systemd-resolved 才能使互联网正常工作

由于某种原因,我在(重新)启动后突然无法再访问互联网,我可以 ping 8.8.8.8,但不能 ping google.com,因此名称解析存在问题。如果我运行

sudo systemctl enable systemd-resolved

我重新能访问互联网了。

systemctl status systemd-resolved.service

给出

systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-07-18 21:07:34 CEST; 40min 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: 12966 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 9213)
     Memory: 4.9M
        CPU: 1.073s
     CGroup: /system.slice/systemd-resolved.service
             └─12966 /lib/systemd/systemd-resolved

jul 18 21:07:34 chewbacca systemd-resolved[12966]: Positive Trust Anchors:
jul 18 21:07:34 chewbacca systemd-resolved[12966]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
jul 18 21:07:34 chewbacca systemd-resolved[12966]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.a>
jul 18 21:07:34 chewbacca systemd-resolved[12966]: Using system hostname 'chewbacca'.
jul 18 21:07:34 chewbacca systemd-resolved[12966]: wlp2s0: Bus client set default route setting: yes
jul 18 21:07:34 chewbacca systemd[1]: Started Network Name Resolution.
jul 18 21:07:34 chewbacca systemd-resolved[12966]: wlp2s0: Bus client set DNS server list to: 46.227.67.134, 192.165.9.158
jul 18 21:07:48 chewbacca systemd-resolved[12966]: Using degraded feature set UDP instead of UDP+EDNS0 for DNS server 46.227.67.134.
jul 18 21:13:02 chewbacca systemd-resolved[12966]: Using degraded feature set UDP instead of UDP+EDNS0 for DNS server 46.227.67.134.
jul 18 21:15:39 chewbacca systemd-resolved[12966]: Grace period over, resuming full feature set (UDP+EDNS0) for DNS server 46.227.67.134.

我在 /etc/systemd/resolved.conf 中定义了 DNS 服务器:

#  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 con
fig.
#
# 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:47
00::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.goo
gle 2001:4860:4860::8844#dns.google
# Quad9:      9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dn
s.quad9.net 2620:fe::9#dns.quad9.net
DNS=46.227.67.134
FallbackDNS=192.165.9.158
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=no
#Cache=no-negative
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=noresolved.conf:

我有点不知所措,因为昨天一切都运行正常,在谷歌上搜索了几个小时,但没有找到解决方案,为什么我突然需要手动启动 systemd-resolved 才能访问互联网。这是在 Ubuntu 22.04 LTS 上。请注意,我在路由器中定义了相同的 2 个 DNS 服务器,并将它们添加到网络连接的 IPv4 设置选项卡中(通过 GUI)。任何指示都值得赞赏!

感谢/曾经

相关内容