3

I am contemplating using two different DNS hosts and am curious as to how a client system would cache the CNAME record. The reason I am going this route is that a primary domain that I would like to use is already hosted in one DNS service but the application is hosted in another service that has its own DNS handling that is integrated with the services.

Specifically what I am looking to understand is, if friendly.abc.com is a CNAME record that points to long-ugly-url.hosted-service.com which is itself hosted (DNS and application) on another service with an IP of 1.2.3.4, will the clients accessing friendly.abc.com be caching long-ugly-url.hosted-service.com or 1.2.3.4? The reason I ask is that if it is the former, then the long-ugly-url.hosted-service.com A record can have a short TTL and it can be changed quickly while the friendly.abc.com can be set at a higher TTL but still have changes "propagated" quickly. If it is the latter, then both would need to have short TTLs for responsible clients to see the changes quickly.

1

I would say both. Implementations might vary but considering that the whole point of caching is not to fetch something which you have already done so a moment ago, it seems illogical for a client to get a CNAME and A record and throw away one or the other. I am using the term 'client' vaguely here as you have it in your question, but the implementation could vary whether we are talking about a dns resolver (such as dig, nslookup), application dns caching (such as browsers), dns caching server( eg. BIND) etc. If you want to be certain, you have either to rely on the documentation of the particular client or do your own testing.

In my case I tested it on BIND9. The simple testing technique I used is, first I flushed all the dns entries in the cache and then made a DNS query, finally dumped the dns cache for investigation. As you can see below, both the CNAME and A records were cached. The TTL does not match the actual TTL stored on the authoritative zone file because I am getting my DNS through forwarding, which means the dns entries I am getting could be coming from the remote DNS servers cache as well.


ns1 bind # rndc flush && dig www.bbc.co.uk +nodnssec && rndc dumpdb
;; ANSWER SECTION:
www.bbc.co.uk.      238 IN  CNAME   www.bbc.net.uk.
www.bbc.net.uk.     166 IN  A   212.58.246.55
www.bbc.net.uk.     166 IN  A   212.58.246.54

ns1 bind # grep www.bbc.co.uk named_dump.db 
www.bbc.co.uk.      234 CNAME   www.bbc.net.uk.
ns1 bind # grep  -P 212.58.246.5[4,5] named_dump.db
www.bbc.net.uk.     166 A   212.58.246.54
            166 A   212.58.246.55
  • Section 5.3.3 in RFC 1034 agrees with you that both should be cached. However, the algorithm spelled out there is explicitly a recommendation, and you are quite right that this is something that can (and does) vary from implementation to implementation. – Calle Dybedahl Sep 2 '15 at 8:05
0

Most UNIX-Like OS do not cache DNS until system administrator install software/package for that.

Therefore, the kind of cached records depends on installed software/package ( widely used ISC-BIND cache CNAME & A records ).

Microsoft Windows also cache CNAME & A records by default, and ipconfig /displaydns | more command can show them.

  • There are plenty of applications that do their own DNS lookup and caching (web browsers, for example). Even for those that don't, there will be caching done by their closest upstream resolver. What, if anything, in the way of DNS software is installed on the local machine is irrelevant to this question. – Calle Dybedahl Sep 2 '15 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.