我已经读过,只有当我的机器有自己的 DNS 服务器时,我才应该nameserver 127.0.1.1在我的/etc/resolv.conf文件中。既然没有,拥有它就会导致问题。但无论我做什么,我都无法摆脱它!
以下是我迄今为止所做的事情:
nameserver 192.168.1.3到/etc/resolvconf/resolv.conf.d/base文件。(192.168.1.3 是我们网络的 DNS)。sudo resolvconf --enable-updates。sudo resolvconf -u。sudo service network-manager restart只是为了确保)。然而,当我打开/etc/resolv.conf文件时,它说:nameserver 127.0.1.1!有谁知道出了什么问题?
请注意,它实际上是127.0.1.1!我不知道为什么不是127.0.0.1!
即使我/etc/resolv.conf手动更新并将其更改为其他任何内容,它sudo resolvconf -u也会将其恢复为127.0.1.1! 这个地址是哪里来的?
默认情况下,使用LLMNR=yesset in /etc/systemd/resolved.conf,这里是端口绑定(使用netstat -l -p -a -n):
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN 8214/systemd-resolv
tcp6 0 0 :::5355 :::* LISTEN 8214/systemd-resolv
udp 0 0 0.0.0.0:5355 0.0.0.0:* 8214/systemd-resolv
udp6 0 0 :::5355 :::* 8214/systemd-resolv
Run Code Online (Sandbox Code Playgroud)
当LLMNR=no设置在 中时/etc/systemd/resolved.conf,我仍然有以下绑定:
udp 0 0 0.0.0.0:5355 0.0.0.0:* 8214/systemd-resolv
udp6 0 0 :::5355 :::* 8214/systemd-resolv
Run Code Online (Sandbox Code Playgroud)
如何完全解除所有 LLMNR 端口绑定?
系统:Ubuntu 服务器 15.04
无法更新resolv.conf文件。
/etc/resolv.conf" E166: Can't open linked file for writing
Run Code Online (Sandbox Code Playgroud)
乌班图18.04.1
使用 IPv4,我可以毫无问题地添加两个 DNS 名称服务器,如下所示:
"dns-nameservers 8.8.4.4 8.8.8.8"
Run Code Online (Sandbox Code Playgroud)
然后在我的 resolv.conf 我得到:
nameserver 8.8.4.4
nameserver 8.8.8.8
Run Code Online (Sandbox Code Playgroud)
但是,它不适用于 IPv6,只有第一个 IPv6 DNS 服务器出现在我的 resolv.conf 中,请看:
"dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888"
Run Code Online (Sandbox Code Playgroud)
但是,我的 resolv.conf 只保留第一个:
nameserver 2001:4860:4860::8844
Run Code Online (Sandbox Code Playgroud)
显然,Ubuntu (resolvconf / ifupdown) 忽略了第二个 DNS 名称服务器,那么,如何修复它?!
这是我的/etc/network/interfaces文件:
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto eth0
iface eth0 inet6 static
address 2800:210:0:4::2
netmask 64
gateway 2800:210:0:4::1
dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888
Run Code Online (Sandbox Code Playgroud) 更新:看起来它正在avahi-dnsconfd添加8.8.8.8和添加8.8.4.4到我的/etc/resolv.conf文件中。我在 /var/log/syslog 中找到了这个:
Jan 4 17:00:21 freewill nm-dispatcher: req:1 'up' [ens33]: start running ordered scripts...
Jan 4 17:00:21 freewill avahi-dnsconfd[3579]: New DNS Server 8.8.4.4 (interface: 2.IPv4)
Jan 4 17:00:21 freewill avahi-dnsconfd[3579]: New DNS Server 8.8.8.8 (interface: 2.IPv4)
Run Code Online (Sandbox Code Playgroud)
我怎样才能让Ubuntu的从DHCP获取DNS服务器只和未使用的avahi(的mDNS)用于获取DNS服务器?
我正在测试 Ubuntu Mate 16.04.1 LTS,但遇到了麻烦,因为有些东西不断将 Google 的 DNS 服务器添加到/etc/resolv.conf:
josh@freewill:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS …Run Code Online (Sandbox Code Playgroud) 我在 Ubuntu 18.04 上的 chrome 中收到 dns 探测完成消息,所以我在互联网上查找并尝试运行以下命令。
sudo rm/etc/resolv.conf
sudo ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
以上 2 个命令成功执行,但以下命令没有执行。
sudo resolvconf -u
Run Code Online (Sandbox Code Playgroud)
它给出了resolvconf未安装的错误消息。
现在,没有任何工作,/etc/resolv.conf文件为空。我什至无法编辑它(我尝试添加nameserver 8.8.8.8)。
请帮忙。
编辑:我仍然收到 ERR_NAME_NOT_RESOLVE,这是“service --status-all”的输出。
[ + ] acpid
[ - ] alsa-utils
[ - ] anacron
[ + ] apparmor
[ + ] apport
[ + ] avahi-daemon
[ + ] bluetooth
[ - ] console-setup.sh
[ + ] cron
[ + ] cups
[ + ] cups-browsed
[ + …Run Code Online (Sandbox Code Playgroud) 我正在设置本地网络并配置了 DNS 服务器。我可以通过查询 DNS 服务器来解析主机名,但没有程序可以查找它们。
我卸载了 libnss-mdns 并删除了 avahi-daemon,之后甚至重新启动。
这里有些例子:
root@cloud2:~# host ns.example.com
ns.example.com has address 10.10.10.100
root@cloud2:~# ping ns.example.com
ping: unknown host ns.example.com
root@cloud2:~# grep hosts /etc/nsswitch.conf
hosts: files dns
Run Code Online (Sandbox Code Playgroud)
我的 ntp 服务器是为 ns.example.com 配置的,但我得到的只是 ntpq 上的 nxdomain
有任何想法吗?
编辑:
这也适用于外部 DNS 条目。我的路由器既作为自定义 DNS 服务器上的 DNS 转发器,又作为 resolvconf 中的条目。
例如
root@cloud2:~# host google.com | head
google.com has address 74.125.225.65
google.com has address 74.125.225.66
google.com has address 74.125.225.67
google.com has address 74.125.225.68
google.com has address 74.125.225.69
google.com has address 74.125.225.70 …Run Code Online (Sandbox Code Playgroud) 在 ubuntu 中,有两种提供 dns 缓存和配置功能的解决方案。一种是 resolvconf.service(resolvconf 包的一部分)。另一个是 systemd-resolved.service (systemd 包的一部分)。在某些情况下,一种解决方案会被激活,而在某些情况下,另一种解决方案则会被激活。这两种解决方案都是ubuntu系统核心的一部分。smbd知道为什么会这样吗?
新问题,因为与此相关的所有其他内容似乎都已过时和/或相互矛盾。保持你的接近投票,请:)
在 Ubuntu 12 和 14 Server 的库存安装中,建议似乎是您进行 DNS 更改的方式是编辑接口文件并在那里添加 dns- 选项。唯一的问题是,在担心正常运行时间的服务器上,强制应用这些更改的唯一方法似乎是使用ifdown/ifup.
我有大量的服务器要对其进行一组 DNS 更改,并且我需要整体更新它们的解析器配置,而无需以这种方式切换网络接口。我还需要确保重新启动后更改仍然有效。
问题是所有这些服务器都是用interfaces文件中的 dns- 选项构建的,这意味着如果我更改resolvconf'shead或tail文件,我将在重新启动时得到一堆重复的行。
该过程需要类似于:
所以,回顾一下:
interfaces(需要中断以回收接口)head或tail文件(不会生效,重启时会有重复的行)有没有办法在不中断服务的情况下实现这样的更改?理想情况下,我可以强制 resolvconf 在不切换界面的情况下完成其更新过程。
我的台式计算机配置了静态 IP 地址:

但是,/etc/resolve.conf不断被覆盖:
nameserver 127.0.0.1
search localdomain example.com
Run Code Online (Sandbox Code Playgroud)
这似乎会定期发生或在我运行时发生sudo resolvconf -u。
我真的很想example.com从 dns 搜索域列表中删除。我曾经把它放在那里,但现在它引起了问题。我似乎无法把它弄出来。我不知道它是从哪里来的,也不知道为什么它总是被放回去。据我所知example.com,我的/etc目录中的任何地方都不再有任何内容。
什么将此搜索域放入我的resolv.conf文件中,我该如何防止它这样做?
resolvconf ×10
dns ×7
networking ×4
resolv.conf ×4
server ×2
14.04 ×1
16.04 ×1
18.04 ×1
ipv6 ×1
ping ×1
static-ip ×1
systemd ×1
ubuntu-mate ×1