使用 system-resolvd 时如何在 resolv.conf 中设置自定义设置

使用 system-resolvd 时如何在 resolv.conf 中设置自定义设置

我想在 /etc/resolv.conf 中使用选项值。通过查看相关手册页 (https://linux.die.net/man/5/resolv.conf) 我注意到我可以配置各种选项。例如,可以使用 options timeout:10 设置 DNS 请求的超时时间。另一个示例是使用 attempts 选项来控制 DNS 解析的重试次数。到目前为止一切顺利。

问题是 systemd-resolvd 编辑了该文件。据我所知,需要编辑 solved.confg 文件来设置 solved 将使用的选项。相关手册页 -https://jlk.fjfi.cvut.cz/arch/manpages/man/resolved.conf.5。这里的问题是我想要设置的选项没有在 solved.conf 文件中公开。

有没有办法通过 systemd-resolved 配置这些参数?我是否应该只编辑 /etc/resolve.conf 并完成它?

答案1

如果您想让 systemd 管理 resolv.conf,目前无法添加其他选项,它只会写入搜索域和名称服务器,仅此而已: https://github.com/systemd/systemd/blob/main/src/resolve/resolved-resolv-conf.c#L324

相关内容