PDA

View Full Version : CNAME vs. A Records



wdatkinson
02-22-2005, 04:01 PM
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?

nobaloney
02-23-2005, 08:44 AM
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

wdatkinson
02-23-2005, 10:44 AM
Jeff,

Thanks for the reply! I'll change the info for our name servers and remove the cname references in exchange for A records.

Yikes2000
03-19-2005, 11:02 PM
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

resolveit
03-20-2005, 01:35 PM
Originally posted by Yikes2000
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

nobaloney
03-22-2005, 11:31 AM
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