如何使用 DNS 将通配符子子域链接到另一个 url?

发布于 2025-01-16 13:41:31 字数 76 浏览 3 评论 0原文

如何使用 DNS 将通配符子子域链接到主域?

前任: *。 * .example.com -> example.com

How do I link a wildcard sub-subdomain to main domain using DNS?

ex: *. * .example.com -> example.com

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秉烛思 2025-01-23 13:41:31

如何使用 DNS 将通配符子子域链接到主域?

你不知道。

通配符在 DNS 中的工作方式并非如此。

RFC 1034 §4.3.3 说:

通配符 RR 的所有者名称的格式为“*.”, 
其中 是任意域名。 <任何域>不应包含其他 * 标签,
并且应该是该区域的权威数据。

因此,使用此规则 *.*.example.comNOT 通配符(您完全可以在区域中使用此名称,但名称服务器不会将特定的通配符规则应用于它)。

RFC 4592“域名系统中通配符的作用”确实取消了这一限制,但实际上它仍然如此。

named-checkzone 会警告您有关该问题的信息:

$ cat example.com.zone
example.com. IN 1 SOA ns.example. noc.example. 1 7200 3600 1209600 3600
example.com. IN NS a.example.
example.com. IN NS b.example.

*.* A 192.0.2.42

$ named-checkzone example.com example.com.zone
example.com.zone:2: using RFC1035 TTL semantics
example.com.zone:9: warning: ownername '*.*.example.com' contains an non-terminal wildcard
example.com.zone:9: *.*.example.com: bad owner name (check-names)

您在 https://en.wikipedia.org/wiki/Wildcard_DNS_record

How do I link a wildcard sub-subdomain to main domain using DNS?

You don't.

Wildcards don't work like this in the DNS.

RFC 1034 §4.3.3 says:

The owner name of the wildcard RRs is of the form "*.<anydomain>", 
where <anydomain> is any domain name. <anydomain> should not contain other * labels,
and should be in the authoritative data of the zone.

So with this rule *.*.example.com is NOT a wildcard (you can totally have this name in the zone, but nameservers won't apply specific wildcards rule on it).

RFC 4592 "The Role of Wildcards in the Domain Name System" did kind of removed this restriction, but in practice it stays like that.

named-checkzone will warn you about the problem:

$ cat example.com.zone
example.com. IN 1 SOA ns.example. noc.example. 1 7200 3600 1209600 3600
example.com. IN NS a.example.
example.com. IN NS b.example.

*.* A 192.0.2.42

$ named-checkzone example.com example.com.zone
example.com.zone:2: using RFC1035 TTL semantics
example.com.zone:9: warning: ownername '*.*.example.com' contains an non-terminal wildcard
example.com.zone:9: *.*.example.com: bad owner name (check-names)

You have a good discussion on the subject at https://en.wikipedia.org/wiki/Wildcard_DNS_record

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文