在 Ubuntu 16.04 上,我将网络管理器配置为在系统启动时自动使用 OpenVPN 连接。效果很好。
但是,当机器暂停后恢复时,尽管 VPN 重新连接,但我无法浏览(或 ping)网站,因为无法解析主机名。由于某种原因,DNS 查找失败。
ping: unknown host www.google.com
这件事只是在几周前才开始发生的,我不确定发生了什么变化。
输出cat /etc/NetworkManager/NetworkManager.conf
:
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=false
输出cat /etc/resolv.conf
:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
输出host -v www.apple.com
(暂停前):
Trying "www.apple.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41111
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 9, ADDITIONAL: 7
;; QUESTION SECTION:
;www.apple.com. IN A
;; ANSWER SECTION:
www.apple.com. 1287 IN CNAME www.apple.com.edgekey.net.
www.apple.com.edgekey.net. 1516 IN CNAME www.apple.com.edgekey.net.globalredir.akadns.net.
www.apple.com.edgekey.net.globalredir.akadns.net. 1516 IN CNAME e6858.dsce9.akamaiedge.net.
e6858.dsce9.akamaiedge.net. 20 IN A 104.94.190.92
;; AUTHORITY SECTION:
dsce9.akamaiedge.net. 1516 IN NS n3dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n1dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n6dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS a0dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n4dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n5dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n0dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n7dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n2dsce9.akamaiedge.net.
;; ADDITIONAL SECTION:
a0dsce9.akamaiedge.net. 1516 IN AAAA 2600:1480:e800::c0
n0dsce9.akamaiedge.net. 1516 IN A 88.221.81.194
n1dsce9.akamaiedge.net. 1516 IN A 23.62.100.157
n2dsce9.akamaiedge.net. 1516 IN A 95.101.2.121
n3dsce9.akamaiedge.net. 1516 IN A 95.101.79.79
n4dsce9.akamaiedge.net. 1516 IN A 23.62.100.159
n5dsce9.akamaiedge.net. 1516 IN A 23.62.100.164
Received 504 bytes from 127.0.1.1#53 in 66 ms
Trying "e6858.dsce9.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60195
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 9, ADDITIONAL: 9
;; QUESTION SECTION:
;e6858.dsce9.akamaiedge.net. IN AAAA
;; ANSWER SECTION:
e6858.dsce9.akamaiedge.net. 20 IN AAAA 2a02:26f0:60:186::1aca
e6858.dsce9.akamaiedge.net. 20 IN AAAA 2a02:26f0:60:199::1aca
;; AUTHORITY SECTION:
dsce9.akamaiedge.net. 1516 IN NS n0dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n2dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n3dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS a0dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n4dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n1dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n5dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n6dsce9.akamaiedge.net.
dsce9.akamaiedge.net. 1516 IN NS n7dsce9.akamaiedge.net.
;; ADDITIONAL SECTION:
a0dsce9.akamaiedge.net. 1516 IN AAAA 2600:1480:e800::c0
n0dsce9.akamaiedge.net. 1516 IN A 88.221.81.194
n1dsce9.akamaiedge.net. 1516 IN A 23.62.100.157
n2dsce9.akamaiedge.net. 1516 IN A 95.101.2.121
n3dsce9.akamaiedge.net. 1516 IN A 95.101.79.79
n4dsce9.akamaiedge.net. 1516 IN A 23.62.100.159
n5dsce9.akamaiedge.net. 1516 IN A 23.62.100.164
n6dsce9.akamaiedge.net. 1516 IN A 23.62.100.165
n7dsce9.akamaiedge.net. 1516 IN A 23.62.100.166
Received 454 bytes from 127.0.1.1#53 in 29 ms
Trying "e6858.dsce9.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44627
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;e6858.dsce9.akamaiedge.net. IN MX
;; AUTHORITY SECTION:
dsce9.akamaiedge.net. 600 IN SOA n0dsce9.akamaiedge.net. hostmaster.akamai.com. 1489520008 1000 1000 1000 1800
Received 109 bytes from 127.0.1.1#53 in 28 ms
输出host -v www.apple.com
(暂停后):
Trying "www.apple.com"
;; connection timed out; no servers could be reached
答案1
周二 (2017-04-18),我的系统更新包括几个与 DNS 相关的软件包的新版本(包括dnsutils
和dnsmasq-base
)。安装这些软件包后,问题就解决了。