Why two lookups for a CNAME?

Lightner, Jeff JLightner at dsservices.com
Wed Oct 21 20:42:45 UTC 2015


Because the purpose of DNS primarily is to equate a name with an IP as applications talk to IPs not to names.   When you have a CNAME you’re equating one name with another name.   That other name then has to be looked up so the application knows what IP access.

This saves time if you have multiple CNAMES to the same A record in that when you update DNS you only have to update that one A record.  You don’t have to use CNAMES to go to same IP – you could make each record an A record pointing to the same IP.   You’d then have to be sure you updated all the A records using that IP if you decided to change it to something else later (e.g. if you changed ISPs).

Obviously there is a small performance cost in CNAMES which is why you don’t want to have a CNAME to  another CNAME because that results in 3 lookups.   For most applications the single CNAME isn’t an issue but on occasion it is so you go the A record route instead.


From: bind-users-bounces at lists.isc.org [mailto:bind-users-bounces at lists.isc.org] On Behalf Of Steve Arntzen
Sent: Wednesday, October 21, 2015 4:33 PM
To: bind-users
Subject: Why two lookups for a CNAME?


I'm sure there's a good, simple reason for this, I just can't seem to find the answer searching on the Internet.



Why does named perform a lookup for the A record when its IP is returned with the CNAME in the first answer?



Using dig, I find play.google.com is a CNAME for play.l.google.com.



When asked to resolve it, named will first look for play.google.com.  The result will include the CNAME and the IP of the A record.



Named then makes a second request to resolve the A record.



Thanks in advance,



Steve.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20151021/c7fbdd26/attachment.html>


More information about the bind-users mailing list