What is a Wildcard DNS record?
A wildcard DNS record is a record that answers DNS requests for subdomains you haven't already defined. You can create them for A records and CNAME records by entering an asterisk (*) in the host field.
Here are a few things to keep in mind...
Wildcard records don't return for lookups of the root domain
Lookups for your root domain (the part of your domain that comes after the "www") won't return the wildcard record as you might expect. You'll need to make sure you define root records (empty host field) for lookups that don't specify a sub-domain.
Wildcard records don't override existing records (such as CNAME records)
When you set a wildcard record, that record does not override any existing sub-domain records in the zone (zone is another term for all the DNS records associated with your domain).
Here's an example:
Above is a CNAME record and a wildcard A record. If we do a "dig" command (asking the DNS for information) on a random sub-domain, in this case "goodbye.etaoin.ink", we get the wildcard IP address.
If we "dig" the CNAME record (hello.etaoin.ink) we do not get the wildcard, but the established CNAME record IP address.
The wildcard picks up the random sub-domains, excluding the one already defined by the CNAME record.
Here's another example:
The first A record is an example of a "www" A record. The second, a wildcard A record. The third, the root domain A record. If we "dig" the domain (etaoin.ink), we will see it shows the root domain's IP address.
If we ask for information on a sub-domain, let's say "hello.etaoin.ink", we will see it shows the wildcard IP address.
If we ask for information on "www.etaoin.ink", we get the IP listed for the "www" A record, not the wildcard record.