Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I noticed that dig google.com produces four distinct IP addresses. What does that mean? It could be

  • use any, doesn't matter
  • try the first, if it doesn't respond, try the next (and so forth)
  • or ...?

Or is this just supposed to be round-robin? (If so, why would it return 4 values, instead of just 1?)

I'm sort of hoping it means that browsers would try all four in sequence until they got one that works.

Here's what I'm getting: dig google.com:

;; QUESTION SECTION:`
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     293 IN  A   74.125.19.99
google.com.     293 IN  A   74.125.19.103
google.com.     293 IN  A   74.125.19.104
google.com.     293 IN  A   74.125.19.147

;; AUTHORITY SECTION:
google.com.     81797   IN  NS  ns2.google.com.
google.com.     81797   IN  NS  ns4.google.com.
google.com.     81797   IN  NS  ns1.google.com.
google.com.     81797   IN  NS  ns3.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.     255049  IN  A   216.239.32.10
ns2.google.com.     230304  IN  A   216.239.34.10
ns3.google.com.     231860  IN  A   216.239.36.10
ns4.google.com.     58735   IN  A   216.239.38.10`
share|improve this question

3 Answers 3

up vote 3 down vote accepted

It is round robin. You see all 4 when you dig it, because dig asks the DNS server to return all records for that name.

share|improve this answer
    
You wouldn't have a pointer to a document handy that describes this behavior? –  Johannes Ernst Oct 2 '10 at 4:53
    

dig google.com returns only 1 ANSWER (EDIT: This is in my case but can be different depending on where you are located - thanks to MarkM comment below), the 4 other you see are in Authority section or Additional sections and they are the Name Servers names and IPs and not google.com IP. google.com IP is in Answer section: 64.233.163.104:

;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

So 1 ANSWER, 4 AUTHORITY and 4 ADDITIONAL:

;; QUESTION SECTION:
;google.com.            IN    A

;; ANSWER SECTION:
google.com.        300    IN    A    64.233.163.104

;; AUTHORITY SECTION:
google.com.        137782    IN    NS    ns1.google.com.
google.com.        137782    IN    NS    ns4.google.com.
google.com.        137782    IN    NS    ns3.google.com.
google.com.        137782    IN    NS    ns2.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.        83943    IN    A    216.239.32.10
ns2.google.com.        47822    IN    A    216.239.34.10
ns3.google.com.        47822    IN    A    216.239.36.10
ns4.google.com.        47822    IN    A    216.239.38.10
share|improve this answer
2  
Since google uses geo-based DNS, this is entirely dependent on where you are physically located when running dig. –  MDMarra Oct 2 '10 at 2:10
    
@MarkM, Interesting, thanks for the clarification. Until now I never had noticed multiple answers on dig but today I made some tries and found a few here (surprisingly none from google). I didn't knew that and I thought load balancing was always done with the IP resolved (so a kind of "internal" work). From what I understood reading some docs, I deducted this should be transparent for the client as the asker is supposed to use the 1st delivered address and the NS change this address to distribute the load, right? –  laurent Oct 2 '10 at 14:34
2  
@MarkM, they also use Anycast; so even the same IP doesn't mean you're getting the same server/cluster/datacenter. –  Chris S Oct 5 '10 at 16:44
    
@Chris S, Thanks. That was the name I couldn't remember when I said "kind of 'internal' work done with the IP resolved"! –  laurent Oct 5 '10 at 20:54

It means that the name google.com resolves to 4 different ip addresses. It actually resolves to many more, but you got 4 of them. For all practical purposes the 4 ips are interchangeable. However, whether a browser will try them in sequence until one works is wholly dependent on the browser. And some browsers cache results themselves, and are known to ignore ttl, so be careful trying to predict what a browser will do.

share|improve this answer
    
Any idea which browsers might do which? It seems to me it would be a great idea if browsers did try them in sequence -- costs very little and increases availability. –  Johannes Ernst Oct 2 '10 at 5:34
    
I don't. We did some testing on this a couple of years ago and the results were all over the place with (no surprise) IE doing some strange things. Once we determined it wasn't consistent we didn't proceed much further since one can't ignore IE. –  WaldenL Oct 4 '10 at 12:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.