在Ubuntu 14.04中与resolv.conf奇怪行为的符号链接

我最近将我的PC升级到Ubuntu 14.04。 然后,我遇到了DNS解析中的主要问题,不再适用。 我终于找到了以下内容:在/ etc中,有一个’resolv.conf’,它是../run/resolvconf.resolv.conf的符号链接。 在我的系统上,这是一个空文件。 但是,’/ run / resolvconf / resolv.conf’就在那里。 我手动将符号链接添加到/run/resolvconf/resolv.conf 。 这非常有效。 然而原始链接不起作用。 为了说明这一点,我在’/ etc’中创建了两个符号链接:

 marc@marc-Vostro-420-Series:/etc$ ls -irl dns.* 787036 lrwxrwxrwx 1 root root 27 aoû 29 17:50 dns.ok -> /run/resolvconf/resolv.conf 787080 lrwxrwxrwx 1 root root 29 aoû 29 17:51 dns.nok -> ../run/resolvconf/resolv.conf marc@marc-Vostro-420-Series:/etc$ cat dns.ok # 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 marc@marc-Vostro-420-Series:/etc$ cat dns.nok marc@marc-Vostro-420-Series:/etc$ 

如你所见,第二个是空的。 现在,问题是:为什么原始符号链接指向’../’(错误)版本?

如果您的DNS由resolveconf包管理(14.04的默认值),这是正常的。 如果需要添加名称服务器,请将它们添加到/etc/resolvconf/resolv.conf.d/base sudo nano /etc/resolvconf/resolv.conf.d/base并重新启动resolvconf service resolvconf restart并重建/ etc / resolv.conf“文件”。