It is well known that it is possible to configure a DNS server to do a "catch-all" resolving on a single subdomain level, such as *.example.com. IN A x.x.x.x, so that anything.example.com maps to a single IP/CNAME.

However, I need to set up an at least "level-2" wildcard sub-subdomain catch-all wildcard system so that any.thing.example.com or better, item.of.any.level.under.example.com will be resolved to a single IP.

Has anyone got this working?

  • I can just say it definitely is possible. You'll have to wait for someone competent to tell you how, though.
    – o0'.
    Jun 12, 2011 at 14:40
  • Yes, I belive it is. But I need an advice how to achieve this on common server software (BIND, Microsoft DNS server, etc.).
    – Jan Rovner
    Jun 12, 2011 at 15:29
  • You should add the DNS software that you are using
    – MichelZ
    May 22, 2014 at 10:57

3 Answers 3


On any real DNS server a wildcard record will match one or more labels.

See section 4.3.3 of RFC 1034.


Works in bind with just a record for *.dig.foo.com, it will grab anything under that domain. I.e. dog.cat.dig.foo.com

This is a sample configuration file.

BIND 9.2.4 and the zone file content is 
$ORIGIN test.domain.com.
*          CNAME          proxyserver.domain.com.
$ORIGIN domain.com.
  • Thank you for the reply, could you please give me a BIND version number and possibly and the contents of a zone file?
    – Jan Rovner
    Jun 13, 2011 at 12:36

We use multi level subdomains on our CDNs. In our DNS control panel (Zerigo) we just used *.ourcdn.com mapping to a CName of our CDN. Then we can use


I haven't had a chance to test this on BIND etc. but I'm fairly certain it will work the same in there, Zerigo responsds with

*.ourcdn.com. IN CNAME cdnsource.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.