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可以运行成功了。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值