ubuntu20.04解决域名无法解析

在ubuntu20.04上使用apt update命令报错如下:

Err:1 http://linux.mellanox.com/public/repo/mlnx_ofed/5.1-2.5.8.0/ubuntu18.04/amd64 ./ InRelease
  Temporary failure resolving 'linux.mellanox.com'
Err:2 https://mirrors.aliyun.com/ubuntu focal InRelease
  Temporary failure resolving 'mirrors.aliyun.com'
Err:3 https://mirrors.aliyun.com/ubuntu focal-security InRelease
  Temporary failure resolving 'mirrors.aliyun.com'
Err:4 https://mirrors.aliyun.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'mirrors.aliyun.com'
Err:5 https://mirrors.aliyun.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'mirrors.aliyun.com'
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch https://mirrors.aliyun.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'mirrors.aliyun.com'
W: Failed to fetch https://mirrors.aliyun.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'mirrors.aliyun.com'
W: Failed to fetch https://mirrors.aliyun.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'mirrors.aliyun.com'
W: Failed to fetch https://mirrors.aliyun.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'mirrors.aliyun.com'
W: Failed to fetch http://linux.mellanox.com/public/repo/mlnx_ofed/5.1-2.5.8.0/ubuntu18.04/amd64/./InRelease  Temporary failure resolving 'linux.mellanox.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

初步判断是无法解析域名的问题,为解决这一问题,首先需要确保网络的连通性,使用ping 8.8.8.8命令测试网络连通性,然后使用以下命令配置DNS服务器

vi /etc/resolv.conf

然后输入

nameserver 8.8.8.8

nameserver 8.8.4.4

退出保存,然后发现apt update可以运行成功了。

猜你喜欢

转载自blog.csdn.net/eternal963/article/details/130343367