前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >systemd-resolved and resolvctl on ubuntu; 127.0.0.53 nameserver;

systemd-resolved and resolvctl on ubuntu; 127.0.0.53 nameserver;

作者头像
xuyaowen
发布2021-01-04 09:38:21
2.6K0
发布2021-01-04 09:38:21
举报
文章被收录于专栏:XUYAOWEN的专栏XUYAOWEN的专栏

前段时间,我偶然进行查看linux DNS配置,通过查看 /etc/resolv.conf 文件,得到如下结果:

代码语言:javascript
复制
➜  devices ll /etc/resolv.conf
lrwxrwxrwx 1 root root 39 12月 28 18:55 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
➜  devices cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# 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.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad

之前,我曾经简单写过一个linux下如何获取dns服务器的博客:Linux 中查看 DNS 与 配置;但是无论怎么查找,显示的都是 127.0.0.53 回环地址。说明 ubuntu 对dns服务器做了一层管理,但是内部的机制我还不是很明白。所以今天进行简要了解一下,填一下年前遗留的一个坑。通过上述注释我们可以了解到,我们可以使用 resolvectl status 命令查看上行链路的dns服务器。我们也可以使用自己创建regular文件进行手动配置;命令运行情况如下:

这显然于我们在netplan中配置的dns相同:

但是,127.0.0.53 代表的是什么呢,其存在的必要性是什么呢?我对此进行了进一步探究,并进行简要记录,方便我个人记忆,如果对你也有启发,欢迎留言讨论:

参考文档:

How and why (not) to use the 127.0.0.53 nameserver, systemd-resolved and resolvctl

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-01-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档