首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >/run/systemd/What/stub-presv.conf和/run/systemd/What/surv.conf之间有什么区别?

问/run/systemd/What/stub-presv.conf和/run/systemd/What/surv.conf之间有什么区别?
EN

Unix & Linux用户
提问于 2019-10-26 05:05:57
回答 1查看 18.5K关注 0票数 26

要在全新的Kubuntu19.10笔记本电脑中配置自定义DNS服务器,添加到/etc/systemd/resolved.conf中是不够的:

DNS=77.88.8.7 77.88.8.3 #Yandex‘with连谷歌图片都没有色情内容

我还必须更改/etc/resolv.conf的符号链接

代码语言:javascript
复制
$ ls -l /etc/resolv.conf 
lrwxrwxrwx 1 root root 37 oct 26 01:48 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

/run/systemd/resolve/stub-resolv.conf只具有ISP指定的DNSs,而定制的DNSs仅在/run/systemd/resolve/resolv.conf中。

当看到:

代码语言:javascript
复制
man systemd-resolved.service

它说推荐的文件是/run/systemd/resolve/stub-resolv.conf,但我不明白它们的区别(可以理解和简单的解释应该是公认的答案)。如果是这样的话,我如何将系统设置为使用该文件而不是其他文件使用全局配置的DNS?

注意:在笔记本电脑上,有大量的WiFi连接,配置每个连接的DNS是不可行的,就像我刚才描述的许多站点所建议的那样。

好奇的附加信息:

代码语言:javascript
复制
/run/systemd/resolve/$ diff stub-resolv.conf resolv.conf 
3,8c3,4
< # This is a dynamic resolv.conf file for connecting local clients to the
< # internal DNS stub resolver of systemd-resolved. This file lists all
< # configured search domains.
< #
< # Run "resolvectl status" to see details about the uplink DNS servers
< # currently in use.
---
> # This is a dynamic resolv.conf file for connecting local clients directly to
> # all known uplink DNS servers. This file lists all configured search domains.
17,18c13,17
< nameserver 127.0.0.53
< options edns0
---
> nameserver 77.88.8.7
> nameserver 77.88.8.3
> nameserver 200.49.130.40
> # Too many DNS servers configured, the following entries may be ignored.
> nameserver 200.42.4.207
EN

回答 1

Unix & Linux用户

发布于 2021-02-20 18:06:19

使用resolv.conf代替stub-resolv.conf将绕过许多系统解析的配置,如DNS应答缓存、每个接口DNS配置、DNSSec强制执行等。

解释:

当使用stub-resolv.conf时,应用程序将向地址127.0.0.53的systemd提供的DNS存根解析器发出DNS请求。这个存根解析器将将DNS请求代理到在systemd-resolved中配置的上游DNS解析器,对这些请求和答案应用它想要的任何逻辑,比如缓存它们。

当使用resolv.conf时,应用程序将直接向"real“发出DNS请求。systemd-resolved中配置的DNS解析器。在这种情况下,systemd-resolved只充当"resolv.conf管理器“,而不是DNS解析器本身。

来源:systemd-resolved命令页

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

https://unix.stackexchange.com/questions/548830

复制
相关文章

相似问题

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