https://www.theregister.com/2013/02/15/star_wars_traceroute/
So when you ask for www.amazon.com it ends up making multiple DNS lookups, as www.amazon.com is a CNAME record.
Nothing about this CNAME lookup gets passed back up the stack to your application; you just get that end-result: the IP address.
host www.amazon.com www.amazon.com is an alias for tp.47cf2c8c9-frontier.amazon.com. tp.47cf2c8c9-frontier.amazon.com is an alias for www.amazon.com.edgekey.net. www.amazon.com.edgekey.net is an alias for e15316.e22.akamaiedge.net. e15316.e22.akamaiedge.net has address 23.204.68.114
(My first thought was, wow, surprised they outsource that.)
For a given application server it might be:
- check local dns caching resolver
- check local network caching resolver
- if internal domain, check local authoritative resolver
- if public domain check isp resolver
- recursively resolve from there
The other possibility is different IP's being returned by a DNS server based on where a query is coming from, eg a CDN. If you're in location A and your ISPs DNS server is in location B, the CDN's DNS server may return a different IP based on if the request is coming from A or B. ECS [0] is supposed to mitigate this, but may or may not be used.
It's disturbing how many clients we'll see hitting an old IP address for 30 days after a change.
Still there can be caches that don’t quite agree as the other comment mentions.
When you send a DNS query to a recursive server like your ISP's or something like 1.1.1.1, you make a single DNS query and get back a single response, because the recursive DNS server handles all the different queries that Julia outlines in the post. As the client, we have no idea what steps just happened in the background.
But when you run `dig +trace`, dig is actually pretending to be a recursive name server, and making all those queries itself instead of letting the real recursive name servers do their work. It's a fun hack but that means it's not always 100% accurate to what's going on in the real world [0]
[0] https://serverfault.com/questions/482913/is-dig-trace-always...