更新至 20.10 后出现“名称解析暂时失败”

更新至 20.10 后出现“名称解析暂时失败”

我刚刚从 20.04 更新到 20.10,现在我的有线网络没有 DNS(这台电脑没有无线):

alpaca:adrian> ping www.google.com
ping: www.google.com: Temporary failure in name resolution

我查看了/etc/resolv.conf:

alpaca:adrian> 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

resolv.conf 是指向 ../run/resolvconf/resolv.conf 的链接

alpaca:adrian> systemd-resolve --status
Global
       LLMNR setting: no     
MulticastDNS setting: no     
  DNSOverTLS setting: no     
      DNSSEC setting: no     
    DNSSEC supported: no     
          DNS Domain: DOMAINS

Link 2 (eth0)
      Current Scopes: none   
DefaultRoute setting: no     
       LLMNR setting: yes    
MulticastDNS setting: no     
  DNSOverTLS setting: no     
      DNSSEC setting: no     
    DNSSEC supported: no     
          DNS Domain: DOMAINS
alpaca:adrian> nmcli device show eth0  
GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         70:71:BC:DD:29:17
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.1.99/24
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 0
IP4.ROUTE[2]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.ROUTE[3]:                           dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 0
IP6.ADDRESS[1]:                         fe80::7271:bcff:fedd:2917/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 256

我认为网络是由 /etc/network/interfaces 控制的,其中列出了 DNS 服务器:

alpaca:adrian> cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
       address 192.168.1.99
       netmask 255.255.255.0
       gateway 192.168.1.1
       dns-nameservers 68.100.16.25 68.100.16.30  68.105.28.12
       dns-search cox.net

如果我查看 Unity 环境顶部的网络按钮,它会显示网络为“未管理”且未列出任何内容。我尝试添加网络,但似乎没有任何效果。

有什么建议么?

答案1

在桌面安装中,网络由网络管理器正确控制;在服务器中由 netplan 控制。文件/etc/网络/接口已弃用。因此,我建议您将文件恢复为默认设置:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

接下来,您的 /etc/resolv.conf 文件当前链接到了错误的位置。让我们修复它:

sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf  /etc/resolv.conf

重新启动并告诉我们是否有任何改进。

相关内容