0
votes

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

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

1

1 Answers

1
votes

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