DNS wildcard observations

Had an interesting case with DNS wildcard records: if you have a wildcard (*) A record – it works pretty fine, but if you specify a CNAME record to point to non-existing A record (which would normally be satisfied by wildcard A record) it won’t work, at least in the case I had. So as an example if you have:

Zone file for domain1
* IN A 111.111.111.111

Zone file for domain2:
host1 IN CNAME host1.domain1.

Then any query for host1.domain1 will resolve with no problems, but when you will try to resolve the host1.domain2 – it will fail. For this case you need to explicitly specify the host1.domain1. as follows:

Zone file for domain1
host1 IN A 111.111.111.111
* IN A 111.111.111.111

Interesting case, just to remember for the next time…