3.1.5.10. Wildcard record (*)
In the DNS system, it is possible to set a default record for undeclared subdomains. Such a record is called a wildcard.
A record is created by specifying the symbol * in the subdomain field. The operation principle of such a record is quite simple—if the requested subdomain, its parent, or child subdomain is not explicitly specified in any record, the wildcard record of the nearest parent will be used (in other words, the default record). This is convenient for configuring a large number of subdomains, as there is no need to add a separate record for each subdomain. By default, when adding or registering a domain, two wildcard records are created: of type A and of type AAAA.
Principle of operation
For example, the following records have been created for the domain "example.com":
| Subdomain | Type | Data |
|---|---|---|
| example.com | A | 1.XXX.XXX.XXX |
| www.example.com | A | 1.XXX.XXX.XXX |
| *.example.com | A | 2.XXX.XXX.XXX |
| sub.example.com | A | 3.XXX.XXX.XXX |
| *.domain.example.com | A | 4.XXX.XXX.XXX |
| form.domain.example.com | A | 5.XXX.XXX.XXX |
| anothersub.example.com | TXT | XXXXXXXXXXXX |
| one.more.example.com | TXT | XXXXXXXXXXXX |
In the case described above, the wildcard record will apply to all subdomains except:
sub— the subdomain was declared as it has records.anothersub— the subdomain was declared as it has records.sub.anothersub— the subdomain was declared because its parent has records.more— the subdomain was declared because its descendant has records.domain— the subdomain has been declared and has its own wildcard record, which it and all its descendants will use.form.domain— the parent subdomain has been declared, so the wildcard record of the main name is not used, but the parent has its own wildcard record, which will be used.
Example of return values for different subdomains:
- A request to
www.example.comwill return the record1.XXX.XXX.XXX. - A request to
sub.example.comwill return the record3.XXX.XXX.XXX. - The request to
some.sub.example.comwill not return a record, as it is not specified. The wildcard record will not be applied because the subdomainsubhas been declared. - The request to
sub.anothersub.example.comwill not return a record, as it is not specified. The wildcard record will not be applied because the subdomainanothersubhas been declared. - A request to
anothersub.example.comwill return the TXT recordXXXXXXXXXXXX. - A request to
like.domain.example.comwill return the record4.XXX.XXX.XXX. - A request to
domain.example.comwill return the record4.XXX.XXX.XXX(a wildcard record*.domainis used). - A request to
form.domain.example.comwill return the record5.XXX.XXX.XXX. The wildcard record will not be applied because the subdomainform.domain.has been declared. - A request to
test.example.comwill return the record2.XXX.XXX.XXX(a wildcard record*is used). - The request for
sub.www.example.comwill not return a record, as it is not specified. The wildcard record will not be applied because the subdomainwwwhas been declared. - A request to
poddomen.example.comwill return the record2.XXX.XXX.XXX(a wildcard record*is used).
Comments