0

I used the DNS lookup tool too find the Name Server and A Records entries for www.google.com

Here is what it said

www.google.com results

ns2.google.com

IN  172.217.15.68

It showed a single A record and the CNAME records were not found. But when I resolved www.google.com from different networks, it returned me different IP addresses. How are they doing this? Do they use DNS Round Robin? But how come I found only one A record then?

$ dig www.google.com +short
172.217.21.164

$ dig www.google.com +short
216.58.211.4

$ dig www.google.com +short
172.217.20.36

1 Answer 1

1

I think I figured it out so I will share it with others who might be wondering how this works.

Well, from what I understand Google owns its own DNS authoritative name servers (which means it can return whatever IP address it wants each time), so it first determines the location of your IP and then spits out a random A address (or multiple addresses) of their servers near you.

That's why every time you do a DNS lookup for www.google.com (or from different locations world-wide) you get a different A IPv4 address (or multiple addresses). That's how they balance the load, and then from there they can balance it even further. It's like a "Round Robin DNS" on steroids.

enter image description here

This is a little picture I put together to illustrate it. So your computer (or router) asks the Resolver DNS server what the A record for www.google.com is and if it doesn't have it stored in cache it will contact the Root DNS server and ask it. It will return the IP address of the .com name server so the Resolver DNS will ask the .com name server. the .com name server will return the address of Google's name servers ns.google.com. Then it goes and asks it. It (seeing you are from Europe/Asia/Americas) will return you the IP addresses of servers closest to you. And then the Resolver DNS server will round-robin-randomly return those records to you and your client will start by picking the first one off that list. I guess if it won't be available it will pick the next and so on.

Please feel free to correct me if I'm wrong somewhere on this.

4
  • You're looking for en.wikipedia.org/wiki/Anycast.
    – ceejayoz
    Mar 26, 2020 at 13:51
  • @ceejayoz There is also GeoDNS en.wikipedia.org/wiki/GeoDNS
    – Liga
    Mar 26, 2020 at 13:52
  • 1
    This is a function of every content delivery Network or CDN. You can purchase appliances for local use within a company that help you do the exact same functions. This may be recommended if you have an infrastructure that stretches across multiple locations and an active backup/ disaster recovery site. Mar 26, 2020 at 14:46
  • 1
    You may find serverfault.com/a/279497/3038 informative
    – sysadmin1138
    Mar 26, 2020 at 15:39

Not the answer you're looking for? Browse other questions tagged .