我最近升级了我的 Ubuntu,突然丢失了 DNS。看起来,这与https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1674532。但我无法运行更新来修复该问题,因为它无法使用 DNS 进行更新。有没有关于如何让 DNS 重新工作以便我可以运行更新并修复该问题的文档?我尝试过更改 DNS 服务器,但一切都不起作用。
猫/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=false
dpkg-l 命令域名系统|删除
ii avahi-dns confd 0.6.32~rc+dfsg-1ubuntu2 amd64 Avahi DNS configuration tool
ii dnsmasq-base 2.75-1ubuntu0.16.04.1 amd64 Small caching DNS proxy and DHCP/TFTP Server
ii dnsutils 1:9.10.3.dfsg.p4-8ubuntu1.5 amd64 Clients Provided with BIND
ii libavahi-compact-libdnssd1:amd64 0.6.32~rc+dfsg-1ubuntu2 amd64 Avahi Apple Bonjour compatibility library
ii libdns-export162 1:9.10.3.dfsg.p4-8ubuntu1.5 amd64 Exported DNS Shared Library
ii libdns162:amd64 1:9.10.3.dfsg.p4-8ubuntu1.5 amd64 DNS Shared Library used by BIND
ii libnss-mdns:amd64 0.10-7 amd64 NSS Module for Multicast DNS name resolution
主机 -v www.apple.com
Trying "www.apple.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1102
;; flags: qr rd ra; QUERY: 1; ANSWER: 4; AUTHORITY: 0, ADDITIONAL: 0
;;QUESTION SECTION:
;www.apple.com. IN A
;;ANSWER SECTION:
www.apple.com. 1126 IN CNAME www.apple.com.edgekey.net.
www.apple.com.edgekey.net. 21568 IN CNAME www.apple.com.edgekey.net.globalredir.akadns.net
www.apple.com.edgekey.net.globalredir.akadns.net. 3599 IN CNAME e6858.dsce9.akamaiedge.net
e6858.dsce9.akamaiedge.net. 19 IN A 172.226.108.101
Received 182 bytes from 8.8.8.8#53 in 152 ms
Trying "e6858.dsce9.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:428
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY:0, ADDITIONAL: 0
;;QUESTION SECTION
;e6858.dsce9.akamaiedge.net. IN AAAA
;;ANSWER SECTION:
e6858.dsce9.akamaiedge.net. 19 IN AAAA 2001:559:19:988d::1aca
e6858.dsce9.akamaiedge.net. 19 IN AAAA 2001:559:19:988d::1aca
Received 100 bytes from 8.8.8.8#53 in 70 ms
Trying "e6858.dsce9.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:34978
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY:1, ADDITIONAL: 0
;;QUESTION SECTION:
;e6858.dsce9.akamaiedge.net. IN MX
;;AUTHORITY SECITON:
dsce9.akamaiedge.net. 179 IN SOA n0dsce9.akamaiedge.net. hostmaster.akamai.com. 1490629947 1000 1000 1000 1800
Received 109 bytes from 8.8.8.8#53 in 32 ms
dpkg -l | grep libc6
ii libc6:amd64 2.23-0ubuntu7 amd64 GNU C Library: Shared Libraries
ii libc6-dev:amd64 2.23-0ubuntu7 amd64 GNU C Library: Development Libraries and Header Files
答案1
存储有关解析域名时要咨询哪些 DNS 服务器的信息的文件是/etc/resolv.conf
。但此文件的问题在于,强烈建议不要手动编辑该文件,因为如果您这样做,它很快就会被程序自动覆盖resolvconf
。但是,您可以做的是将以下几行添加到文件/etc/resolvconf/resolv.conf.d/head
:
# Google's public DNS servers
nameserver 8.8.8.8 # Primary DNS server
nameserver 8.8.4.4 # Secondary DNS server
该文件在构建时使用/etc/resolv.conf
。具体来说,它的内容被添加到文件的开头/etc/resolv.conf
。
答案2
当更新解决问题时,没有 DNS 实现这一点应该不会太难。也许一个解决方法是找出更新服务器的 IP 地址,并将其输入到 /etc/apt/sources.list 中,而不是输入完全限定域名。