Let's say we have a subdomain called www.foo.com which has a CNAME record pointing at foo.bar.cc. Foo.bar.cc in turn has an A record pointing at the IP address 18.104.22.168.
Now, if I do a DNS lookup of www.foo.com I'll get an answer looking like this:
www.foo.com. IN CNAME foo.bar.cc. foo.bar.cc. IN A 22.214.171.124
My question is, at what stage is foo.bar.cc resolved? Is it done by the recursive DNS server before the response is sent back to the client? Or does the client issue a second request to the DNS server, this time for foo.bar.cc? Or does it depend on whether the DNS server already has a cached entry for foo.bar.cc?
I'm asking because one particular recursive DNS server returns only the first line, ie it does not resolve the CNAME. However, after perhaps 20 seconds, subsequent requests for the same host will then include both lines.