首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DNS不工作,/etc/解析式.不会被覆盖。为什么?

DNS不工作,/etc/解析式.不会被覆盖。为什么?
EN

Ask Ubuntu用户
提问于 2015-07-29 13:17:37
回答 2查看 19.6K关注 0票数 0

网络管理器连接中的服务器中有此配置:

/etc/NetworkManager/system-connections/wired-connection

代码语言:javascript
复制
[connection]
id=wired-connection
uuid=0c501f08acc5497cb7...
type=8023ethernet

[8023ethernet]

[ipv4]
method=manual
dns=8.8.8.8;
address1=192.168.1.250/24,192.168.1.1

[ipv6]
method=auto
ip6privacy=0

/etc/NetworkManager/NetworkManager.conf

代码语言:javascript
复制
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=true

但是我的文件/etc/resolv.conf (符号链接)并没有被网络管理器覆盖。如果我手动将行nameserver 8.8.8.8添加到文件中,它可以很好地工作,但它只是一个暂时的解决方案。如果我打开IP配置,在Kubuntu接口中,我会看到DNS字段为空。

我也尝试过使用这个命令,但是它没有运行dpkg-reconfigure resolvconf

我的原始配置文件的路由在/run/resolvconf/resolv.conf

我找到了这个文件,它属于一个旧的配置/etc/resolvconf/resolv.conf.d/original

代码语言:javascript
复制
nameserver 213.60.205.175
nameserver 213.60.205.174
nameserver 212.51.33.110

是否应该删除或编辑此文件以使其正常工作?

我只能远程访问服务器,由于这一点,我想确定这将是可行的。如果没有的话,我就能切断连接

提前感谢

更新03/08/15. /usr/share/resolvconf/dump-debug-info的输出

代码语言:javascript
复制
###### Start of debugging information for resolvconf ######
### ls -l /etc/resolvconf
total 16
-rw-r--r-- 1 root root  172 dic 13  2012 interface-order
drwxr-xr-x 2 root root 4096 jul  8 18:33 resolv.conf.d
drwxr-xr-x 2 root root 4096 jul  8 18:33 update.d
drwxr-xr-x 2 root root 4096 jul  8 19:11 update-libc.d
### cat /etc/resolvconf/interface-order
# interface-order(5)
lo.inet*
lo.dnsmasq
lo.pdnsd
lo.!(pdns|pdns-recursor)
lo
tun*
tap*
hso*
em+([0-9])?(_+([0-9]))*
p+([0-9])p+([0-9])?(_+([0-9]))*
eth*
ath*
wlan*
ppp*
*
### ls -l /etc/resolvconf/resolv.conf.d
total 8
-rw-r--r-- 1 root root   0 dic 13  2012 base
-rw-r--r-- 1 root root 151 dic 13  2012 head
-rw-r--r-- 1 root root  77 jul  8 18:21 original
-rw-r--r-- 1 root root   0 jul  8 18:26 tail
### cat /etc/resolvconf/resolv.conf.d/base
### cat /etc/resolvconf/resolv.conf.d/head
# 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
### cat /etc/resolvconf/resolv.conf.d/original
nameserver 213.60.205.175
nameserver 213.60.205.174
nameserver 212.51.33.110
### cat /etc/resolvconf/resolv.conf.d/tail
### ls -l /etc/resolvconf/run
ls: no se puede acceder a /etc/resolvconf/run: No existe el archivo o el directorio
### ls -l /run/resolvconf
total 4
-rw-r--r-- 1 root root   0 jul 29 10:10 enable-updates
drwxr-xr-x 2 root root  40 jul 29 10:10 interface
-rw-r--r-- 1 root root 151 ago  3 09:40 resolv.conf
### cat /run/resolvconf/enable-updates
### cat /run/resolvconf/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
### ls -l /run/resolvconf/interface
total 0
### ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 jul 24 12:59 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
### lsattr /etc/resolv.conf
lsattr: La operación no está soportada Mientras se leían las banderas en /etc/resolv.conf
### 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
### cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=true
###### End of debugging information for resolvconf ######

顺便说一下,我用的是Kubuntu 14.04

EN

回答 2

Ask Ubuntu用户

发布于 2015-07-29 13:59:31

您似乎使用的是dnsmasq,它是一个缓存DNS服务器。

如果要添加DNS服务器,可以执行以下命令:

代码语言:javascript
复制
echo nameserver X.X.X.X | sudo resolvconf -a IFACE.PROGNAME
sudo service dnsmasq restart 

其中IFACE.PROGNAME是您使用的网络的名称(eth0、eth1、wlan0.)

对于永久的更改,您可以创建一个/etc/rupv.dnsmasq.conf

代码语言:javascript
复制
nameserver  8.8.8.8

并编辑/etc/dnsmasq.conf并设置:

代码语言:javascript
复制
resolv-file=/etc/resolv.dnsmasq.conf

另一种解决方案是通过注释行来禁用dnsmasq的使用。

代码语言:javascript
复制
dns=dnsmasq

在文件/etc/NetworkManager/NetworkManager.conf中。并使用/etc/rupv.conf文件。

票数 0
EN

Ask Ubuntu用户

发布于 2018-04-11 14:37:23

对我起作用的是启用解析器服务:

代码语言:javascript
复制
sudo systemctl enable resolvconf
sudo reboot

问题是在安装了一些VPN垃圾后,没有在启动时启动。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/654208

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档