最近在搭建 Vagrant 服务器的时候, 使用 sudo apt-get update
的时候出现了访问错误
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://security.ubuntu.com trusty-security InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://security.ubuntu.com trusty-security Release.gpg
Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
使用 ping www.baidu.com
发现可以返回数据, 但是 ping archive.Ubuntu.com
则没有反应, host 机器是有访问返回的.
修正方法是:
step 1: 修改host /etc/hosts
添加如下映射
91.189.91.93 archive.ubuntu.com
91.189.91.93 security.ubuntu.com
step 2: 重启network服务
$ /etc/init.d/networking restart