从ubuntu 14.04升级到16.04后没有DNS解析


11

我将ubuntu 14.04升级到了ubuntu 16.04,但互联网连接出现问题。具体来说,更新后的DNS停止工作。出于调试目的,我设置了唯一的DNS 8.8.8.8,但名称解析仍然不起作用。输出nmcli device show wlan1 | grep IP4为:

pc@pc:~$ nmcli device show wlan1 | grep IP4
IP4.ADDRESS[1]: 192.168.1.3/24
IP4.GATEWAY: 192.168.1.1
IP4.ROUTE[1]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.DNS[1]: 8.8.8.8
The output from dig @8.8.8.8 google.com and dig google.com:

dig @8.8.8.8 google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60075
;; flags: qr rd ra; QUERY: 1, ANSWER: 12, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     27  IN  A   62.75.23.245
google.com.     27  IN  A   62.75.23.230
google.com.     27  IN  A   62.75.23.216
google.com.     27  IN  A   62.75.23.238
google.com.     27  IN  A   62.75.23.224
google.com.     27  IN  A   62.75.23.223
google.com.     27  IN  A   62.75.23.237
google.com.     27  IN  A   62.75.23.210
google.com.     27  IN  A   62.75.23.217
google.com.     27  IN  A   62.75.23.231
google.com.     27  IN  A   62.75.23.244
google.com.     27  IN  A   62.75.23.251

;; Query time: 89 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Apr 30 19:39:24 EEST 2016
;; MSG SIZE  rcvd: 231
pc@pc:~$ dig google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
pc@pc:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlan1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan1
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan1

IP4.ROUTE[1]: dst = 169.254.0.0/16当然显示路线有问题。请使用发布您的路由表route -n
Julie Pelletier

1
根据您的研究,添加nameserver 8.8.8.8到您的/etc/resolv.conf东西是否可以解决?
Julie Pelletier

@JuliePelletier,IP4.DNS[1]: 8.8.8.8我猜他们已经在使用域名服务器了。
Hi-Angel

@ Hi-Angel:没错,但是由于dig在同一名称服务器上工作,因此显然存在问题。
Julie Pelletier

谢谢大家的时间,我通过在链接中给出的答案解决了这个问题:askubuntu.com/questions/622470/...
c_nikol

Answers:


9

我通过在Ask Ubuntu Stack Exchange上使用Amrish指令来解决问题,即使用以下代码:

sudo rm /etc/resolv.conf
sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf
sudo resolvconf -u

我尝试了上面的命令,为什么firefox浏览器仍然无法工作。我尝试ping cnn.com,系统返回ping:未知主机cnn.com
user785099

6

我有一个类似的问题,并从这里使用了解决方案。以下是方法以及指向他们找到信息的地方的另一个链接-

当我遵循关于ubuntuforums的建议时,OpenVPN连接期间的DNS行为立即得到改善:

  1. /etc/NetworkManager/NetworkManager.conf在具有根权限的编辑器中打开。
  2. 删除(或用井号#注释掉)读取的行dns=dnsmasq
  3. 通过重新启动NetworkManager sudo service NetworkManager restart

破折号(-)=哈希(#);-)
Adam Plocher

3

我在resolvconf中遇到了相同的问题,它阻止dhcp客户端(dhclient)从eth0的DHCP服务器获取IP。解决了resolvconf问题,解决了DHCP问题。

sudo mkdir -p /run/resolvconf/interface
sudo resolvconf -u
sudo service resolvconf restart
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.