In system DNS you can set a default entry for undeclared subdomains. This 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 or its parent was not explicitly specified in any record, then a wildcard record (roughly speaking, the default record) will be taken. This is convenient for setting up a large number of subdomains, since you do not need to add a separate entry for each subdomain. By default when adding or registration domain, two wildcard entries are created: of type A and type AAAA.
For example, for the domain example.com
the following records are created:
Subdomain | A 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 |
In the case described above, the wildcard entry will be valid for any subdomains except sub
, anothersub
and their subdomains, and for all subdomains domain
its wildcard record will be used. For example:
www.example.com
will return record 1.XXX.XXX.XXX.sub.example.com
will return the record 3.XXX.XXX.XXX.some.sub.example.com
will not return an entry because it is not specified. Wildcard entry will not be applied, since the subdomain sub
was announced.sub.anothersub.example.com
will not return an entry because it is not specified. Wildcard entry will not be applied, since the subdomain anothersub
was announced.anothersub.example.com
will return the TXT record XXXXXXXXXXXX.like.domain.example.com
will return the record 4.XXX.XXX.XXX.domain.example.com
will return record 4.XXX.XXX.XXX (wildcard record is used *.domain
).form.domain.example.com
will return the record 5.XXX.XXX.XXX. Wildcard entry will not be applied, since the subdomain form.domain.
was announced.test.example.com
will return record 2.XXX.XXX.XXX (wildcard record is used *
).sub.www.example.com
will not return an entry because it is not specified. Wildcard entry will not be applied, since the subdomain www
was announced.poddomen.example.com
will return record 2.XXX.XXX.XXX (wildcard record is used *
).