3.1.5.10. Wildcard entry (*)
In DNS, you can set a default entry for undeclared subdomains. Such an entry is called a wildcard.
The entry is created by specifying the symbol *
in the subdomain field. The principle of operation of such a record is quite simple — if the requested subdomain, its parent or child subdomain was not explicitly specified in any record, then the wildcard record of the nearest parent will be taken (roughly speaking, the default record). This is useful for setting up a large number of subdomains because you don’t have to add a separate entry for each subdomain. Default when adding or registration domain, two wildcard entries are created: of type A and type AAAA.
Principle of operation
For example, for the domain example.com
the following records are created:
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 entry will be valid for all subdomains, except for:
sub
— the subdomain was declared because it has records.anothersub
— the subdomain was declared because it has records.sub.anothersub
— the subdomain was declared because its parent has records.more
— the subdomain was declared because its child 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 of the subdomain has been declared, therefore 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:
- Request for
www.example.com
will return a record1.XXX.XXX.XXX
. - Request for
sub.example.com
will return a record3.XXX.XXX.XXX
. - Request for
some.sub.example.com
will not return the entry because it is not specified. Wildcard entry will not be applied because the subdomainsub
was announced. - Request for
sub.anothersub.example.com
will not return the entry because it is not specified. Wildcard entry will not be applied because the subdomainanothersub
was announced. - Request for
anothersub.example.com
will return a TXT recordXXXXXXXXXXXX
. - Request for
like.domain.example.com
will return a record4.XXX.XXX.XXX
. - Request for
domain.example.com
will return a record4.XXX.XXX.XXX
(wildcard entry is used*.domain
). - Request for
form.domain.example.com
will return a record5.XXX.XXX.XXX
. Wildcard entry will not be applied because the subdomainform.domain.
was announced. - Request for
test.example.com
will return a record2.XXX.XXX.XXX
(wildcard entry is used*
). - Request for
sub.www.example.com
will not return the entry because it is not specified. Wildcard entry will not be applied because the subdomainwww
was announced. - Request for
poddomen.example.com
will return a record2.XXX.XXX.XXX
(wildcard entry is used*
).