加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Unix / Linux中搜索名称解析的顺序

发布时间:2020-12-15 18:33:06 所属栏目:安全 来源:网络整理
导读:可以说/etc/resolv.conf有以下内容.. nameserver 10.10.10.10search x.com y.com 对于分辨率“ping foo”,我看到解析器首先使用配置的搜索域(即:foo.x.com,foo.y.com)尝试FQDN,然后尝试默认的“foo”. 所有* nix平台的行为是否一致?或者某些实现可以首先在
可以说/etc/resolv.conf有以下内容..
nameserver 10.10.10.10
search x.com y.com

对于分辨率“ping foo”,我看到解析器首先使用配置的搜索域(即:foo.x.com,foo.y.com)尝试FQDN,然后尝试默认的“foo”.

所有* nix平台的行为是否一致?或者某些实现可以首先在根域中进行短名称解析(即:“foo.”)?

从resolv.conf手册页:
options ndots:n
                 Sets a threshold for the number of dots which must
                 appear in a name given to res_query(3) (see
                 resolver(3)) before an initial absolute query will be
                 made.  The default for n is 1,meaning that if there
                 are any dots in a name,the name will be tried first as
                 an absolute name before any search list elements are
                 appended to it.  The value for this option is silently
                 capped to 15.

因此,如果resolv.conf具有选项ndots:0,它将立即尝试根域搜索而不尝试任何搜索列表域.该联机帮助页似乎表明它应该尝试搜索根目录中是否存在查询域,但是我的解析器在测试时没有这样做.否则,如果没有点,它首先按顺序尝试搜索元素,然后在耗尽列表后尝试根域.注意,您可以设置搜索.它将根域放在搜索列表中.

另一件需要注意的事情是,如果请求在到达之前被另一个nsswitch.conf机制满足,那么你的名字解析可能永远不会成为resolv.conf.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读