Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is the best way to add a DNS wildcard record for a domain?

I want example.net, www.example.net, a.b.c.www.example.net, ... going to one server.

Now I use:

example.net.    60  IN  A
*.example.net.  60  IN  CNAME   example.net.

Is it possible to do it simpler?

share|improve this question
What is wrong with what you're currently doing ? –  Iain Apr 29 at 6:44

3 Answers 3

up vote 2 down vote accepted

Either this, or a direct A record (saves one lookup) are the best options you have, yes.

*.example.net.  60  IN  A
share|improve this answer

Wildcards do not extend past a dotted label. So while your example wildcard will match www.example.net, it will not match a.b.c.www.example.net. You would need *.b.c.www.example.net for that.

There is no way around this; wildcard records are not intended to catch every possible query within a DNS zone.

share|improve this answer
good catch!.... –  MichelZ Apr 29 at 8:52

You may be able to use something like DNSmasq and setup: address=/.domain.tld/ http://davejamesmiller.com/blog/linux-installing-dnsmasq-wildcard-local-domains has a guide on setting up DNSmasq (I know from experience DNSMasq is available for Linux and Macs).

Which OS are you running on and what DNS server are you running?

share|improve this answer
Why would he want to get into the DNS service business for a domain with one server? What user or admin problem does it solve? Is is worth the effort? No down vote, but without further explanation, this seems like a solution in search of a problem. –  Scott Leadley Apr 29 at 12:40
It's how I've wildcarded all my development domains. Use DNSmasq and anything *.mydevelopment.tld will go to my development machine. He's obviously running some sort of DNS service (either on his machine for himself, on a server for others or on a third party DNS service): I've given one solution for two out of three possibilities. –  Richy B. Apr 29 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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