【发布时间】:2019-04-15 13:50:23
【问题描述】:
我使用 dnsmasq 服务器来管理我们产品内的域列表。
我用这样的主机配置。 --addn-hosts=/etc/dnsmasq.d/hosts/service
cat /etc/dnsmasq.d/hosts/service
192.168.190.100 test.product.com
在产品的另一部分,我必须向该域发出 http 请求。
我看起来像这样,cat http_get.py:
import requests
import sys
URL = "http://test.product.com"
r = requests.get(url = URL, timeout=1)
data = r.json()
print data
当使用time python http_get.py 运行时,它使用了将近 10 秒的 dns 请求。
我已经用 tcpdump 分析了 dns 请求。
表明它发出了两种类型的DNS请求。
22:48:06.990049 IP l2.47857 > l2.domain: 18996+ A? test.product.com. (29)
22:48:06.990241 IP l2.47857 > l2.domain: 19787+ AAAA? test.product.com. (29)
...
22:48:11.994835 IP l2.47857 > l2.domain: 18996+ A? test.product.com. (29)
22:48:11.995081 IP l2.47857 > l2.domain: 19787+ AAAA? test.product.com. (29)
AAAA(IPv6) 类型的请求不是我需要的。它表明它在 2 次尝试中挂了将近 10 秒。
如何在/etc/dnsmasq.d/hosts/service 文件中配置它?
我从我的产品中观察到test.product.com 中的另一种类型的请求MX。它像AAAA(IPv6) 请求一样挂起。
欢迎提出任何建议。非常感谢!
【问题讨论】:
标签: dnsmasq