首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Ubuntu 20.04到22.04升级后DNS解析失效

Ubuntu 20.04到22.04升级后DNS解析失效
EN

Ask Ubuntu用户
提问于 2023-01-27 20:42:31
回答 1查看 368关注 0票数 1

在将服务器从Ubuntu20.04升级到22.04之后,DNS名称解析不再工作。ping 8.8.8.8工作,但ping google.com返回ping: google.com: Name or service not known。而且,wget不工作,sudo apt update无法解析:

代码语言:javascript
运行
复制
~$ sudo apt update
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Err:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
  Could not resolve 'de.archive.ubuntu.com'
Err:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
  Could not resolve 'security.ubuntu.com'
Err:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease
  Could not resolve 'de.archive.ubuntu.com'
Err:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
  Could not resolve 'de.archive.ubuntu.com'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Could not resolve 'de.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

我试图在8.8.8.8中使用/etc/resolv.conf作为名称服务器。在本例中,ping google.com返回ping: google.com: Temporary failure in name resolution

只有当我运行sudo dhclient eth0时,一切都很好。然而,只有到下一次重新启动的机器。

以下是有关该系统的更多信息,可能会有所帮助:

代码语言:javascript
运行
复制
~$ ls -la /etc/resolv.conf
-rwxrwxrwx 1 root root 340 Jan 27 21:08 /etc/resolv.conf
代码语言:javascript
运行
复制
~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search DOMAINS
代码语言:javascript
运行
复制
~$ resolvectl
Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign
      DNS Domain: DOMAINS

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

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

Link 4 (docker0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
代码语言:javascript
运行
复制
~$ sudo service systemd-resolved status
○ systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       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
代码语言:javascript
运行
复制
~$ sudo ufw status
Status: inactive

有什么办法解决这个问题吗?我已经尝试了好几个小时,但没有成功。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2023-01-27 21:39:25

运行sudo dpkg-reconfigure resolvconf解决了这个问题。(见这里)。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1452215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档