I manage multiple websites that currently have the following DNS configuration:
example.com - A Record - Production Server IP
test.example.com - A Record - Test Server IP
www.example.com - CNAME - example.com
beta.example.com - CNAME - test.example.com
dev.example.com - CNAME - test.example.com
Is this an appropriate use of CNAME records? I've looked online and have not found a clear answer. Some people claim that CNAME records are bad (they are not, however, clear on why this is) and propose the following setup:
example.com - A Record - Production Server IP
test.example.com - A Record - Test Server IP
www.example.com - A Record - Production Server IP
beta.example.com - A Record - Test Server IP
dev.example.com - A Record - Test Server IP
Which one of these is the better approach (and why)?
Note: The subdomains do not require their own MX records, so that is not an issue here.
Yes, that's an appropriate use of CNAMEs. In the discussions I've been part of, the arguments tend to go like this:
Against CNAMEs:
In favor of CNAMEs:
After trying a couple of different ways to do this, I now have a personal favorite style. It is:
I find that this setup works well. It keeps extra DNS lookups for the CNAMES down; and if a server crashes I can still change public DNS around fairly fast.
Here's a (improvised) example in BIND syntax:
Yes it's appropriate.
My Best Practices, which many people share, are to create 1 A record for each server IP; and use CNAMES for anything else.
A common example would be: