Multiple A record vs CNAMEs (For one IP)

I have been thinking about the best way to handle DNS for multiple services pointing to one IP address.  For instance, you have a server with a configured hostname of server.example.com, and you have two websites www.example.com and blog.example.com running on that server.  This means there will be three names that will have to resolve to the same IP address.  Is it better to have three A records pointing to that IP address, or to use only one A record (server.example.com) and use CNAMEs for www and blog?

Found a good answer here.

Basically, using CNAMEs is easier to manage because a change of IP address of the server will only necessitate the change of one A record.

However, using a lot of CNAMEs will put extra strain on the DNS server, as the DNS server will have to resolve the name twice before getting to the IP address.  If you are worried about the performance of the DNS server, CNAMEs should be avoided.

Using multiple A records poses another problem, which is there can be only one reverse pointer to the IP address.  Ideally, you would want each A record to have a corresponding PTR (not a requirement, though).

Finally, ‘bare’ hostnames like example.com (without any prefix) will have to be A records.  So if you want example.com to go to server.example.com you cannot CNAME it as it will not work.

3 thoughts on “Multiple A record vs CNAMEs (For one IP)

  1. This is a good digest of this question that only happens in the minds of IT people deep in their work. I appreciate your clear summary!

  2. well it is technically called ns record (type ns not cname)
    what translates into ip look up is name of name server such as ns1.domain.com so try multiple ns records instead that guarantees look up not multiple A record. multiple A record is only good for DNS propagation or multicast vs unicast. google it what you did is not failover. it is multicast. failover works if dns servers copy each other all the time as master slave. https://mcpmag.com/articles/2004/05/01/10-dns-errors-that-will-kill-your-network.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *