Dns - wildcard vs. cname subdomains
Alright I have to admit I'm confused with how DNS works. I've always just added things until they worked, and now it's time to learn how they work.
So one confusing thing to me is that there's sort of two places I can have records. I have an account with rackspace cloud servers. And then there's the place I registered the domain. But both allow me to edit DNS records.
Should I do everything at both places or is one better than the other or am I missing the point?
Subdomains confuse me too. I'd like to be able to just have a wildcard subdomain (I've done this in the past.) I just don't like the idea of adding a cname record or A record every time I need a new subdomain.
Then I read this and it says:
The exact rules for when a wild card will match are specified in RFC 1034, but the rules are neither intuitive nor clearly specified. This has resulted in incompatible implementations and unexpected results when they are used.
Solution 1:
The first thing you need to do is determine who actually serves authoritative answers for your domain name. A WHOIS lookup will tell you which DNS servers are the ones where you should be making changes.
Once that is determined, make the changes with the provider listed and get rid of everything else to avoid any future confusion.
Regarding wildcards vs. hostnames, do whatever you're comfortable with. In general, most DNS implementations will look for a hostname that's been specifically defined (i.e. an A
record that directs to a specific IP address) and will fall back to a wildcard if none is found. Personally, I prefer to define each of my records individually. This way I know what I have and where it goes without any questions. Wildcards can be great if you have 300 hostnames that all need to go to the same place and they change all the time. If you only have a handful of hostnames and they don't change often, I'd opt for setting them up individually.
If you have a dozen hostnames that all need to go to the same IP, you can define one of them as an A
record, and make the rest CNAME
aliases of the first one. This way, you only need to update that IP address once.
Solution 2:
Everyone already stated it: if your registrar, the place you registered the domain, is also serving (authoritative) the records for you, then you manage and edit the records via their system.
What I would like to add is to take a second to consider the management of individual A and CNAME records. You can gain the convenience with wildcards, but there are situations that can be out of your control. What if some prankster links to your destination using an offensive subdomain? and submits it to a high traffic list. It will magically work without your conscious active effort and visitors will see the undesirable link.