升级到 13.10 后,我的 DNS 解析失败。似乎没有使用我通过 DHCP (LAN) 获得的 DNS 服务器。
我可以通过添加nameserver 8.8.8.8到临时解决问题/etc/resolv.conf. 但是后来内网主机还是无法解析。
单击连接信息时网络指示器菜单项时,主 DNS 和辅助 DNS 设置正确。但是我的电脑接缝不能使用它们。
所以我的问题:
resolv.conf如果有的话,我应该放入什么?jdt*_*ood 87
首先,您需要了解自 Ubuntu 12.04 以来名称解析在 Ubuntu 中的工作原理。
Stéphane Graber blogged some information about it last year here. The most important thing to know is that both Ubuntu Server and Ubuntu Desktop use resolvconf to manage the resolv.conf file. That means that you should no longer edit /etc/resolv.conf directly; instead you should configure your network interface configuration utility to provide the right information to resolvconf. For Ubuntu Server the network interface configuration utility is ifup and it is configured by the file /etc/network/interfaces. For Ubuntu Desktop the network interface configuration utility is NetworkManager. This is what you are using.
NetworkManager is configured by means of Network indicator > Edit Connections. However, for network interfaces configured by DHCP it normally isn't necessary to change any settings manually. Normally what happens is that the (remote) DHCP server provides to NetworkManager both an IP address for the local interface and the address of a (remote) DNS nameserver to use. NetworkManager starts an instance of a forwarding nameserver that listens locally at 127.0.1.1. This address, 127.0.1.1, is sent to resolvconf which puts nameserver 127.0.1.1 in /etc/resolv.conf. NetworkManager also gives the (remote) IP address of the DHCP-provided DNS nameserver to the forwarding nameserver. Thus a program running on the local system asks the resolver to translate a host name into an IP address; the resolver queries the local forwarding nameserver at 127.0.1.1; the forwarding nameserver queries the remote nameserver(s) it has been told about, receives an answer and sends it back up the chain.
NetworkManager communicates with the forwarding nameserver process over D-Bus. You can see what NetworkManager told the forwarding nameserver by running the command
nmcli dev list iface eth0 | grep IP4.DNS
Run Code Online (Sandbox Code Playgroud)
Update arising from the comments:
Note that resolvconf actually writes the file /run/resolvconf/resolv.conf to which /etc/resolv.conf is supposed to be a symbolic link. If /etc/resolv.conf is not a symbolic link then you need to recreate it. To do so you can run
sudo dpkg-reconfigure resolvconf
Run Code Online (Sandbox Code Playgroud)
or
sudo ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
小智 52
我做了以下链接中建议的更改(禁用 dnsmasq)。现在一切正常! http://www.ubuntugeek.com/how-to-disable-dnsmasq-in-ubuntu-12-04precise.html
打开/etc/NetworkManager/NetworkManager.conf文件。
sudo gedit /etc/NetworkManager/NetworkManager.conf
Run Code Online (Sandbox Code Playgroud)
注释掉一行:
#dnsmasq deactivated
#dns=dnsmasq
Run Code Online (Sandbox Code Playgroud)
小智 21
编辑 2:上一篇文章被审核理所当然地删除了,我正在发布我发现的解决方案。对不起。
编辑:我刚刚找到答案,它就在这个页面上 - 对不起我的 miopy。我在下面发布了我的发现,扩展了 Richard Lindstedt 在本页中找到的正确答案。我把我早期的隆隆声留给了一些背景。请支持理查德的回答,他应得的。
其实真的很简单。
只需打开您的接口配置文件 --> sudo vi /etc/network/interfaces
那肯定没有帮助OP,现在也没有帮助我。我们不想要静态地址,我们想要使用 DHCP 服务器发送给我们的地址。NetworkManager 似乎认出了它们,但 Ubuntu 直截了当地忽略了它们:
# nmcli dev list iface wlan0 | grep IP4.DNS
IP4.DNS[1]: 10.*.*.*
IP4.DNS[2]: 10.*.*.*
IP4.DNS[3]: 8.8.8.8
Run Code Online (Sandbox Code Playgroud)
但...
# dig microsoft.com
; <<>> DiG 9.9.5-4.3-Ubuntu <<>> microsoft.com
;; global options: cmd
;; connection timed out; no servers could be reached
Run Code Online (Sandbox Code Playgroud)
我的 /etc/network/interfaces 是:
auto lo
iface lo inet loopback
Run Code Online (Sandbox Code Playgroud)
这有点奇怪,我希望所有接口都在这里声明(或者我错过了什么?)。
所以,简而言之:
dpkg-reconfigure resolvconf没有打开另一个线程,因为这是确切的问题,除了我现在在 14.10 上(但是自从从 12.10 升级到 13.04 以来,这一直困扰着我)。
解决方案
最后一句话让我走上了正轨,直到那时我才注意到理查德的回答。
这个问题似乎涉及到冲突dnsmasq和resolvconf包。直到 12.10,dnsmasq才使用。从 13.04 开始,Ubuntu 似乎切换到了 dnsmasq/resolvconf 混合体,您已经安装了软件包dnsmasq-base和resolvconf,但没有安装dnsmasq它本身。
我不能说它是 13.04 升级脚本中的错误还是其他什么,因为当升级(如在全新安装中)resolvconf 被安装时,dnsmasq-base 被升级并且 dnsmasq 被(正确)卸载。
美中不足的是,升级脚本无法注释掉dns=dnsmasq的行/etc/NetworkManager/NetworkManager.conf。因此,即使系统上不再存在 dnsmasq 守护进程,/etc/resolv.conf 仍然希望它存在。
小智 8
其实真的很简单。
只需打开您的接口配置文件 --> sudo vi /etc/network/interfaces
在您的界面(可能是 eth0)下,您将看到所有常用配置。
address 192.168.22.71
netmask 255.255.255.0
gateway 192.168.22.1
Run Code Online (Sandbox Code Playgroud)
在网关之后,只需添加“dns-nameservers 8.8.8.8 8.8.8.9”或您要使用的任何名称服务器。
所以你的配置应该是:
address 192.168.22.71
netmask 255.255.255.0
gateway 192.168.22.1
dns-nameservers 8.8.8.8 8.8.8.9
Run Code Online (Sandbox Code Playgroud)
然后只需执行“ sudo 服务网络重新启动”,您就可以开始了!
| 归档时间: |
|
| 查看次数: |
391236 次 |
| 最近记录: |