CNAME vs. A Records

wdatkinson

Verified User
Joined
Nov 18, 2004
Messages
56
Location
Indianapolis, IN
I have always setup my DNS records for the root domain as such:

domain.com A 1.1.1.1

Then setup cname records for www, ftp, mail, pop, etc.....

I notice that DA defaults to setting up A records for www, ftp, mail, pop, etc.

Technically, I don't believe there is a difference, as both will resolve appropriately.

Would someone care to enlighten me?
 
Sure.

CNAME records require two lookups; A records require single lookups.

CNAME records were originally conceived of for use only when the CNAME points to a zone over which you have no control, so if the IP# changes DNS can still find it.

Jeff
 
Hm...

I too have been using CNAME for ftp, mail, www, and pop because for a simple domain, the IP only appears in one line. Thus making it easy to change IP and etc.

Does a CNAME record require two lookups as in two separate connections to a DNS server? I did a "dig www.cnn.com +trace" and saw just one connection to CNN's DNS server.

I think the penalty for using CNAME instead of A is minimal.

Regards,
Andy
 
Yikes2000 said:
Hm...

I too have been using CNAME for ftp, mail, www, and pop because for a simple domain, the IP only appears in one line. Thus making it easy to change IP and etc.

Does a CNAME record require two lookups as in two separate connections to a DNS server? I did a "dig www.cnn.com +trace" and saw just one connection to CNN's DNS server.

I think the penalty for using CNAME instead of A is minimal.

Regards,
Andy


A CNAME requires 2 lookups on the server, that does not mean it requires 2 connections.

example:

abc.mydomain.com IN CNAME def.mydomain.com
def.mydomain.com IN A 1.2.3.4

You're looking for the IP of anc.mydomain.com
You connect to the DNS server for mydomain.com
You do a dig for abc.mydomain.com, you get CNAME def.mydomain.com
You do a dig for def.mydomain.com and get 1.2.3.4
You close the connection.

Basically this makes the DNS server work harder than it should.

Regards,
Onno Vrijburg
 
Andy,

Yes it's minimal. Instead of one lookup there are two.

So it doubles the load on the DNS server.

I suppose that's minimal if you're hosting DNS for a few domains. If you're hosting DNS for thousands of domains, as we are, it's perhaps a bit less minimal.

If you change IP#s a lot, then changing it in only one place should be a priority for you.

If you hardly ever change it, then there's no reason not to save the extra lookups by using A records.

As I've posted on these forums before, the proper use for CNAME is for when you do NOT have control of the CNAME target (for example when it's at a domain not under your control).

Don't forget that if you have a CNAME record for a host, you can't have any other record type for that host in your DNS zone.

Jeff
 
Back
Top