wal*_*wal 5 networking dns resolv.conf systemd-resolved
我正在使用焦点 Ubuntu 20.04.1 LTS(托管虚拟机)
偶尔重启后 DNS 解析失败(例如ping google.com > Resource temporarily unavailable)
为了“解决”这个问题,我重新启动了机器。
什么是正确的修复方法,为什么会偶尔发生这种情况?
的内容resolv.conf表示文件正在被管理systemd-resolved
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# 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 must 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.
# No DNS Servers known
Run Code Online (Sandbox Code Playgroud)
wal@www:~$ ping google.com
ping: google.com: Resource temporarily unavailable
Run Code Online (Sandbox Code Playgroud)
Tho*_*ger 12
如果/etc/netplan为空,则 netplan 不会配置您的网络。
您的网络可能配置为旧的 ifup/ifdown 样式。这意味着您可以在 中找到网络配置/etc/network/interfaces。
此外,还有 systemd-resolve 及其 DNS 配置文件/etc/systemd/resolved.conf,您可以在其中放置 DNS 配置。
[Resolve]
DNS=8.8.4.4 8.8.8.8 2001:4860:4860::8844 2001:4860:4860::8888
#FallbackDNS=
Domains=example.com
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
Run Code Online (Sandbox Code Playgroud)
您可以使用以下命令检查您的 DNS 设置
systemd-resolve --status
Run Code Online (Sandbox Code Playgroud)
您可以使用以下命令重新启动 systemd-resolve
systemctl restart systemd-resolved
Run Code Online (Sandbox Code Playgroud)
或者,您可以将您的设置放入其中,/etc/resolvconf/resolv.conf.d/tail以便在启动期间添加到其中/run/resolvconf/resolv.conf。
| 归档时间: |
|
| 查看次数: |
5938 次 |
| 最近记录: |