系统:Ubuntu18.04
错误:1 http://cn.archive.ubuntu.com/ubuntu focal InRelease 无法解析域名“cn.archive.ubuntu.com"
....
....
....
(1)临时解决方案
sudo vim /etc/resolv.conf
将127.0.0.53改成自己的ip(系统重启后又会变成默认值)
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# 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 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.
nameserver 127.0.0.53
options edns0 trust-ad
(2)修改DNS,一劳永逸
sudo vim /etc/systemd/resolved.conf
取消DNS注释,添加值114.114.114.114和8.8.8.8
# 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.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
DNS= 114.114.114.114
DNS= 8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no-negative
#DNSStubListener=yes
#ReadEtcHosts=yes
重启服务,使配置生效
systemctl restart systemd-resolved
systemctl enable systemd-resolved
ok~