10

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       1.2.3.4
*.example.net.  60  IN  CNAME   example.net.

Is it possible to do it simpler?

Teun Zengerink
  • 199
  • 5
  • 13
martin
  • 228
  • 1
  • 3
  • 12
  • 1
    What is wrong with what you're currently doing ? – user9517 Apr 29 '14 at 06:44
  • What benefit would you get by being "simpler"? (e.g. less records, less lookups, easier for an end-user) I can't tell what your measure of success is, and that looks pretty good. – Watki02 Feb 05 '16 at 15:44

2 Answers2

9

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

*.example.net.  60  IN  A 1.2.3.4
MichelZ
  • 11,068
  • 4
  • 32
  • 59
0

You may be able to use something like DNSmasq and setup: address=/.domain.tld/192.168.0.1 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?

Richy B.
  • 213
  • 1
  • 6
  • 1
    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 '14 at 12:40
  • 1
    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 '14 at 14:32