I'm running into the following situation and am wondering how to properly resolve it:
A nameserver is configured to not return CNAME records (not under my control), only if an A record is requested (for the same name) the CNAME is returned in the additional section.
Question 1: why would someone configure a DNS server to act like this? It doesn't make sense to me? (asked them several times, never got an answer)
Practical problem: When we resolve a hostname, say
testa.hosta.com, we query an A record. In the response we get:
# query for A of `hosta.com` testa.hosta.com CNAME testb.hostb.com TTL=5 testb.hostb.com A 220.127.116.11 TTL=60
So we're storing both records in our cache. Since we didn't get the A record we were looking for, we now try a CNAME record. But this one is in the cache, it points to
testb.hostb.com. Now trying an A record for
testb.hostb.com, which is also in the cache, so we finally resolve to
18.104.22.168. So all is fine up till now.
After 5 seconds the TTL of the CNAME expires. Because the data is stale, we need to refresh it. So we query for
testa.hosta.com CNAME, and this delivers an empty response. Now our lookup is broken...
Question 2: is this lookup logic faulty? I went through many rfc's to figure it out, but couldn't find anything. What would the proper lookup order be?
Any help is greatly appreciated.