![DNS服务发现和SRV记录格式冲突](https://linux22.com/image/737422/DNS%E6%9C%8D%E5%8A%A1%E5%8F%91%E7%8E%B0%E5%92%8CSRV%E8%AE%B0%E5%BD%95%E6%A0%BC%E5%BC%8F%E5%86%B2%E7%AA%81.png)
在里面RFC 2782对于 SRV 记录类型,我们可以读取:
The format of the SRV RR
Here is the format of the SRV RR, whose DNS type code is 33:
_Service._Proto.Name TTL Class SRV Priority Weight Port Target
(There is an example near the end of this document.)
Service
The symbolic name of the desired service, as defined in Assigned
Numbers [STD 2] or locally. An underscore (_) is prepended to
the service identifier to avoid collisions with DNS labels that
occur in nature.
Some widely used services, notably POP, don't have a single
universal name. If Assigned Numbers names the service
indicated, that name is the only name which is legal for SRV
lookups. The Service is case insensitive.
Proto
The symbolic name of the desired protocol, with an underscore
(_) prepended to prevent collisions with DNS labels that occur
in nature. _TCP and _UDP are at present the most useful values
for this field, though any name defined by Assigned Numbers or
locally may be used (as for Service). The Proto is case
insensitive.
Name
The domain this RR refers to. The SRV RR is unique in that the
name one searches for is not this name; the example near the end
shows this clearly.
另一方面,在RFC 6763对于基于 DNS 的服务发现,他们使用以下格式的 SRV 记录:
Instance._Service._Proto.Name TTL Class SRV Priority Weight Port Target
其中Instance
可能包含几乎所有字符:
It MUST NOT contain ASCII control characters (byte values 0x00-0x1F and
0x7F) [RFC20] but otherwise is allowed to contain any characters,
without restriction, including spaces, uppercase, lowercase,
punctuation -- including dots -- accented characters, non-Roman text,
and anything else that may be represented using Net-Unicode.
例如,我们可以从 dns-sd.org 获取这样的记录:
$ dig +noall +answer SRV "Service\032Discovery._http._tcp.dns-sd.org."
Service\032Discovery._http._tcp.dns-sd.org. 60 IN SRV 0 0 80 dns-sd.org.
所以我的问题是:根据 RFC 2782,此 SRV 记录格式是否有效?如果有效,为什么例如 cloudflare 不允许添加此类记录?
答案1
老实说,我只使用过(到目前为止,只见过)RFC 2782 格式的 SRV 记录(看起来像_Service._Proto.Name TTL Class SRV Priority Weight Port Target
),如果像您示例中的 GUI 根本没有被编程来检测、验证和允许 RFC 6763 格式的 SRV 记录,我不会感到惊讶。
还有许多其他可以说是遗留的和/或晦涩难懂的 DNS 记录类型和格式,它们也不被 GUI 和 Cloudfare 等供应商支持。这是他们的特权。
显然,Bind DNS 服务器在提供 SRV 记录方面并不太挑剔,解析器库在请求和显示它们方面也不太挑剔,但其他服务器可能更严格。RFC
6763 在第 13 节中指出:以下示例是使用在 GNU/Linux 上运行的标准未修改的 nslookup 和标准未修改的 BIND 准备的。""