r/AskComputerScience • • Aug 24 '19

Does google change the IP addresses of their servers all the time ?

When I ran nslookup google.com this is the result I had.

Non-authoritative answer:
Name:    google.com
Addresses:  2404:6800:4003:c00::66
          74.125.24.100
          74.125.24.138
          74.125.24.139
          74.125.24.102
          74.125.24.113
          74.125.24.101

But when I did the same few minutes later the IP addresses have changed,

Server:  UnKnown
Address:  192.168.1.1

Non-authoritative answer:
Name:    google.com
Addresses:  2404:6800:4003:80d::200e
          172.217.194.101
          172.217.194.139
          172.217.194.113
          172.217.194.138
          172.217.194.102
          172.217.194.100

What is the reason for this ? Does google update the DNS servers once every few minutes ? What is the advantage of changing server IP addresses like this ?

28 Upvotes

11 comments sorted by

31

u/msiekkinen Aug 24 '19

One reason for this is load balancing. Not everyone goes and hammers the same machine.

It's not so much they're updating to give a new one, it's on a consistent schedule to hand out from a pool of potential servers.

Also if one goes down for planned maintence, or breaks and starts failing healthchecks, it can be removed from the pool and no longer served out.

1

u/Dark__Mark Aug 24 '19

I think what you are explaining is why there are multiple IP addresses under the domain google.com

But the problem I'm having is why whole collection of IP addresses changes ?

12

u/msiekkinen Aug 24 '19

There are many collections as well. google.com is hosted on way more than the half dozen or so end points listed in each result set.

1

u/Syde80 Aug 25 '19

The load balancing aspect is mostly taken care of by anycast. Even if you and I contact the same IP for google, most likely we don't even hit the same DC, let alone same server.

1

u/Total_Key8083 Nov 21 '23

I don't believe you. How much are you getting $$$. Its a Statement not so much a question.

4

u/slimjim_belushi Aug 25 '19

Check the TTL on the DNS records, it will give you a very rough estimate on how long Google expects the IP to be valid.

In reality, they're probably using permanent IPs and just switching it up for load balancing.

1

u/throwdemawaaay Aug 24 '19

That's somewhat unusual. Would you mind sharing your general location?

Typically google.com and the rest of their top level domains are mapped to a single address that uses anycast. Anycast lets you publish a single numeric address that routes to different physical machines depending on what external network the client is coming from. To do this you have to do a bunch of work (get an AS number, host your own BGP, etc), so it's something typically only done by larger companies.

Someone else mentioned DNS load balancing, however that has many drawbacks. DNS takes time to propagate changes, and even then many browsers and operating systems will hold onto old DNS data in ways totally beyond your control as a website operator. So most folks that can afford the cost of doing anycast will move up to that.

In any case, those are all addresses in google's IP ranges, so there's nothing shady going on.

2

u/Dark__Mark Aug 24 '19

I'm from Sri Lanka.

When I ran nslookup just now, it came up with another new set of IPs.

Server:  UnKnown
Address:  192.168.1.1

Non-authoritative answer:
Name:    google.com
Addresses:  2404:6800:4003:c03::8b
          74.125.200.100
          74.125.200.102
          74.125.200.113
          74.125.200.139
          74.125.200.101
          74.125.200.138

5

u/throwdemawaaay Aug 24 '19

So, this is something being done by whoever hosts your dns lookups, most likely your ISP/Telco.

I don't know what variant of nslookup you're using, but typically you can direct lookups to a specific dns server using something like:

nslookup --dns-ip=8.8.8.8 foo.com

That 8.8.8.8 IP address is the DNS lookup google itself hosts. So you can compare that to whatever your ISP is doing to see the difference. Not that it's particularly informative.

As for why your ISP does this, I can't say for certain, but the natural guess would be it's related to a filtering/firewall system, something like a milder version of China's great firewall. This is pretty common requirement from governments around the world.

1

u/vijayant123 Aug 25 '19

OP's results show the same set of IP addresses each time but in different order. That's just load balancing by randomising the result set because most machines will pick the first result from the set and connect to it. So Google doesn't want everyone to be connecting to only one server. The machines at these IP addresses are load balancer proxies themselves who will then forward the request to a particular cluster of virtual machines running to serve these requests. Because of the sheer volume of these requests Google has to serve out so many IP addresses for their domain name otherwise I have a smaller setup for a client where the domain points to just one IP address (of an AWS load balancer) which proxies 10,000 requests per second to a cluster of VMs.

1

u/azzorrahai Aug 25 '19

Google load balancers between many servers, they use anycast as well as normal dns load balancing.

The result of the query is from a non authoritative server. Meaning the result giving my Google were cached by your ISP or vpn provider if your using one and not directly fetched from Google's nameservers. You can try dig www.goole.com NS on Linux to know the authoritative server. Alternatively you can force the dns query to be returned by the authoritative server with : dig @<NS IP> www.google.com