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

Is a wildcard CNAME DNS record valid in multi sub-domains?

· 52CE 我爱测

I have a CNAME record like this: *.a IN CNAME example.com. So, any address that ends with .a.example.com points to example.com (like www.a.example.com , x.y.z.a.example.com , etc). I add this CNAME record: ex1.a IN CNAME example.…

问题原文

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

I have a CNAME record like this:

*.a        IN CNAME    example.com.

So, any address that ends with .a.example.com points to example.com (like www.a.example.com, x.y.z.a.example.com, etc).

I add this CNAME record:

ex1.a      IN CNAME    example.net.

Then the address ex1.a.example.com points to example.net, while all other address that ends with .a.example.com points to example.com.

I add another CNAME record:

www.b.a    IN CNAME    example.org.

So www.b.a.mydom.com points to example.org.

But there is a problem:
any other request to resolution domain that ends with .b.a.example.com is not solved. I can't understand.

已采纳解答

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

Your first record is mostly fine, though I would add an explicit TTL like this (using 30 minute TTL as an example):

*.a        1800    IN CNAME    example.com.

For the other records I would do the same. Notice that when you create a record for www.b.a like this:

www.b.a    1800    IN CNAME    example.org.

It will override the * matching for b.a. Thus this record will now be the only one you have under b.a. If you want more CNAMEs under b.a you simply have to define three more * matches like this:

b.a        1800    IN CNAME    example.org.
*.b.a      1800    IN CNAME    example.org.
*.www.b.a  1800    IN CNAME    example.org.

Depending on your exact needs you might not need all three.

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

资料来源与适用范围

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

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

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