大网数据广告活动
服务器运维问答

Order of DNS A records and wilcard subdomains

· 52CE 我爱测

I have read Multiple wildcard dns entries and know the limitations/drawbacks of wildcard DNS entries, but I have a question about the order in which it is listed by my registrar: example.com A 192.0.2.1 (1) test.example.com A 192…

问题原文

原帖链接 · Basj · CC BY-SA 4.0

I have read Multiple wildcard dns entries and know the limitations/drawbacks of wildcard DNS entries, but I have a question about the order in which it is listed by my registrar:

example.com        A      192.0.2.1    (1)
test.example.com   A      192.0.2.2    (2)
*.example.com      A      192.0.2.3    (3)
test2.example.com  A      192.0.2.4    (4)

More precisely:

  • Am I correct that (3) won't impact (1) and so the only A record for example.com is (1)?

  • Is rule (2) overriden by rule (3), or will both rules apply for test.example.com (thus two A records for this subdomain)?

  • As (4) is listed after (3), does this mean test2.example.com will have only one A record (192.0.2.4) or two A records (both 192.0.2.3 and 192.0.2.4)?

已采纳解答

原帖链接 · Stuggi · CC BY-SA 4.0

  1. Wildcards do not apply to the root record of the domain, so (1) will be the only A record for example.com
  2. The key point about wildcards is that they only apply for otherwise non-existent subdomains, so any queries for test.example.com and test2.example.com will be answered by (2) and (4) respectively.
  3. As I stated above, wildcards do not apply to explicitly stated subdomains, so it doesn't really matter, but DNS generally does not care about the order of records in a zone (there are some exceptions, like where the SOA record should be, and round-robin records).

So to sum it all up, only if a query comes in for let's say foobar.example.com will it be matched with your wildcard record.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-04-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。