APT“无法解析‘in.archive.ubuntu.com’”

APT“无法解析‘in.archive.ubuntu.com’”

我正在使用 Ubuntu 14.04 LTS,但无法使用apt-get update命令。我收到以下错误:

support@node:~$ sudo apt-get update
Err http://in.archive.ubuntu.com trusty InRelease
Err http://in.archive.ubuntu.com trusty-updates InRelease
Err http://in.archive.ubuntu.com trusty-backports InRelease
Err http://security.ubuntu.com trusty-security InRelease
Err http://in.archive.ubuntu.com trusty Release.gpg
  Could not resolve 'in.archive.ubuntu.com'
Err http://in.archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'in.archive.ubuntu.com'
Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://in.archive.ubuntu.com trusty-backports Release.gpg
  Could not resolve 'in.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch 
http://in.archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'in.archive.ubuntu.com'
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'in.archive.ubuntu.com'
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Could not resolve 'in.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

内容/etc/network/interfaces

auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 162.70.211.177
        netmask 255.255.255.128
        network 162.70.211.128
        broadcast 162.70.211.255
        gateway 162.70.211.129
        dns-nameservers 8.8.8.8 8.8.4.4
        dns-search local

答案1

如果您可以 ping IP 地址但无法 ping 域名,则您的 DNS 存在问题。将 Google DNS(8.8.8.8 和 8.8.4.4)添加到 /etc/network/interfaces 并重新启动应该可以解决您的问题:

auto eth0
iface eth0 inet static
    . . .
    dns-nameservers 8.8.8.8 8.8.4.4

参考:请参阅此处的答案 #2

相关内容