我正在使用Debian 11 (Bullseye)。我想使用不同的DNS服务器。我找到了文件/etc/resolv.conf。它看起来如下(默认情况下):
nameserver 192.168.1.1
nameserver 1.1.1.1
nameserver 8.8.8.8很公平的违约。使用本地路由器/网关DNS,然后使用Cloudflare,然后使用Google的DNS。不过,还有第二个文件- /etc/network/interfaces。对我来说,默认情况下它是什么样子的(我使用的是DHCP)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp4s0f0
iface enp4s0f0 inet dhcp在该文件中,我可以通过这样的方式在那里设置我喜欢的DNS,如果我想使用,比方说,quad9作为DNS。
dns-nameservers 9.9.9.9所以,如果我想改变我的DNS服务器,我需要编辑哪个文件?就一个?两者都有?
发布于 2022-07-04 15:33:21
Debian wikiresolv.conf解释了dns名称服务器地址是如何配置的:
nameserver读取/etc/resolv.conf地址。/etc/resolv.conf可以由解析器或openresolv动态生成。/etc/resolvconf.conf读取其配置。/etc/network/interfaces中的D14配置。普通Debian安装既没有安装解析器,也没有安装openresolv。因此,您的选择要么是:
nameserver配置直接配置在/etc/rupv.conf中。dns-nameserver中配置/etc/network/interfaces。若要查看系统上安装了哪个软件包,请执行.
$ sudo apt list --installed | grep resolvconf
$ sudo apt list --installed | grep openresolv若要检查系统当前使用的名称服务器,请执行.
$ dig example.org | grep SERVERhttps://unix.stackexchange.com/questions/685611
复制相似问题