domain-name-system – 为什么DNS查找不尊重etcnsswitch.conf和etchost.conf?

domain-name-system – 为什么DNS查找不尊重etcnsswitch.conf和etchost.conf?,第1张

概述我有一个问题,即从DNS中查找主机名,即使它们存在于/ etc / hosts中. 我有以下配置: /etc/host.conf档案: order hosts,bind /etc/nsswitch.conf中: hosts: files dns 在/etc/resolv.conf: nameserver <nameserver one>nameserver <nameserver tw 我有一个问题,即从DNS中查找主机名,即使它们存在于/ etc / hosts中.

我有以下配置:

/etc/host.conf档案:

order hosts,bind

/etc/nsswitch.conf中:

hosts:      files dns

在/etc/resolv.conf:

nameserver <nameserver one>nameserver <nameserver two>

在主机上运行的应用程序会发出一些内部和外部API请求.

从tcpdump,我看到DNS查询到/ etc / hosts中列出的一些内部服务主机名.我正在使用的tcpdump命令是:

tcpdump -tqAlU -s0 port 53 and host <nameserver one>

在转储中,我看到如下请求:

IP 10.0.80.11.domain > app004-private.51308: UDP,length 102E...I2..>....P..........I.1E...:...Q.. localhost............   [email protected] app004-private.33828 > 10.0.80.11.domain: UDP,length 39E..Ca.@[email protected]..$.5./..3e.......... localhost.site.com.....IP 10.0.80.11.domain > app004-private.33828: UDP,length 96E..|....>.T;.P..2..5.$.hU.3e.......... localhost.site.com................-.ns10.dnshost.com...dns.8w.............u.....

请注意,localhost正在发送到DNS以及localhost.site.com. localhost的/ etc / hosts条目是:

127.0.0.1 localhost.localdomain localhost

IP 10.0.80.11.domain > app004-private.51664: UDP,length 93E..yx...>.m..P..2..5...e.<N2...........API.site.com................-.ns10.dnshost...dns.5w.............u.....IP app004-private.51664 > 10.0.80.11.domain: UDP,length 48E..L`.@[email protected] 10.0.80.11.domain > app004-private.48878: UDP,length 76E..h&e..>..w.P..2..5...TQ..............11.80.0.10.in-addr.arpa.............Q............p.... .        :...Q.IP 10.0.80.11.domain > app004-private.51664: UDP,length 105E...VX..>..g.P..2..5...qJ.n............API.site.com.site.com................-.ns10.dnshost.'.dns.Aw.............u.....

API.site.com位于/ etc / hosts中.运行getent查询API.site.com返回:

$getent hosts API.site.com10.36.176.114   API001-private API001-private.site.com API001 API.site.com API

我很难过.似乎所有东西都正确配置(据我所知)首先使用/ etc / hosts然后使用DNS.有关为什么/etc/nsswitch.conf和/etc/host.conf没有被尊重的任何见解?

在系统上运行的主应用程序是http(apache 2.2.15和PHP 5.3.8 with curl 7.30.0). *** 作系统是运行内核2.6.18-238.9.1.el5和glibc 2.5-58.el5_6.3的Centos 5.6.

提前致谢!

解决方法 我们能够通过禁用ipv6来解决这个问题.我们通过将以下内容添加到/etc/modprobe.conf并重新启动来禁用ipv6.
alias net-pf-10 offalias ipv6 offoptions ipv6 disable=1

重新启动后,我们不再看到/ etc / hosts中列出的主机的DNS查找.

我不清楚为什么这解决了这个问题.

总结

以上是内存溢出为你收集整理的domain-name-system – 为什么DNS查找不尊重/etc/nsswitch.conf和/etc/host.conf?全部内容,希望文章能够帮你解决domain-name-system – 为什么DNS查找不尊重/etc/nsswitch.conf和/etc/host.conf?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1094565.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存