【问题标题】:How to config local domain without `IPv6/MX` records with dnsmasq?如何使用 dnsmasq 配置没有“IPv6/MX”记录的本地域?
【发布时间】: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


    【解决方案1】:

    使用内置的虚拟DNS服务器并在/etc/hosts中配置记录。

    192.168.190.100 test.product.local

    并且始终牢记标准。 不要使用 test.product.com 并使用专门用于本地或测试用途的 TLD(.local.test)。

    【讨论】:

    • 感谢您的 TLD 域建议。而且我们的产品部署在多主机上,如果我配置 /etc/hosts 它必须同时更改所有主机,我们希望在检测到某些服务中断时使用 dns 作为故障转移。
    猜你喜欢
    • 2013-07-09
    • 2013-05-27
    • 1970-01-01
    • 1970-01-01
    • 2013-04-17
    • 1970-01-01
    • 2018-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多