最近安装了一台Ubuntu Server 14.04服务器,正确设置接口的地址后,发现执行apt-get update出错,无法从服务器下载软件包信息,出错提示信息如下:

~$ sudo apt-get update
...
Err http://ftp.cuhk.edu.hk trusty-updates/universe Translation-en
  Something wicked happened resolving 'ftp.cuhk.edu.hk:http' (-5 - No address associated with hostname
)
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/trusty/Release.gpg  Something wicked happ
ened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname)

W: Failed to fetch http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/dists/trusty/Release.gpg  Something wicked 
happened resolving 'ftp.cuhk.edu.hk:http' (-5 - No address associated with hostname)

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Something wick
ed happened resolving 'security.ubuntu.com:http' (-5 - No address associated with hostname)
...

看起来应该是DNS解析错误导致无法下载文件。通过google发现,这个情况还是挺多的,但是始终没有得到具体的解释。通过我自己实验发现了如下情况,

DNS服务器 : 结果
192.168.1.1 失败
电信公网DNS服务器 失败
8.8.8.8 成功

但是,即使使用的是192.168.1.1这个DNS服务器,host命令也能正常解析域名。更奇怪的是,这个问题只在Server版上出现,Desktop版本没有这个情况(不过Desktop版本使用的是NetworkManager管理网络的)。


diabloneo
1.2k 声望180 粉丝