John Andersen said the following on 01/03/2014 05:38 PM:
But DNS serves up exactly one IP address (to the best of my knowledge).
No it doesn't. Look at the example James Knott and I have give. The output of HOST: $ host google.com google.com has address 74.125.226.132 google.com has address 74.125.226.135 google.com has address 74.125.226.142 google.com has address 74.125.226.131 google.com has address 74.125.226.129 google.com has address 74.125.226.128 google.com has address 74.125.226.133 google.com has address 74.125.226.130 google.com has address 74.125.226.137 google.com has address 74.125.226.134 google.com has address 74.125.226.136 google.com has IPv6 address 2607:f8b0:400b:80b::100e google.com mail is handled by 40 alt3.aspmx.l.google.com. google.com mail is handled by 30 alt2.aspmx.l.google.com. google.com mail is handled by 10 aspmx.l.google.com. google.com mail is handled by 20 alt1.aspmx.l.google.com. google.com mail is handled by 50 alt4.aspmx.l.google.com. or the output of DIG $ dig google.com ; <<>> DiG 9.9.3-P2 <<>> google.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27199 ;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 4, ADDITIONAL: 5 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;google.com. IN A ;; ANSWER SECTION: google.com. 218 IN A 74.125.226.131 google.com. 218 IN A 74.125.226.133 google.com. 218 IN A 74.125.226.142 google.com. 218 IN A 74.125.226.128 google.com. 218 IN A 74.125.226.134 google.com. 218 IN A 74.125.226.135 google.com. 218 IN A 74.125.226.137 google.com. 218 IN A 74.125.226.132 google.com. 218 IN A 74.125.226.129 google.com. 218 IN A 74.125.226.130 google.com. 218 IN A 74.125.226.136 ;; AUTHORITY SECTION: google.com. 49972 IN NS ns1.google.com. google.com. 49972 IN NS ns3.google.com. google.com. 49972 IN NS ns4.google.com. google.com. 49972 IN NS ns2.google.com. ;; ADDITIONAL SECTION: ns1.google.com. 222772 IN A 216.239.32.10 ns2.google.com. 222772 IN A 216.239.34.10 ns3.google.com. 222772 IN A 216.239.36.10 ns4.google.com. 222772 IN A 216.239.38.10 illustrates this. If you look at the man page for GETHOSTBYNAME(3) you'll see that it returns a LIST of addresses. The structure is: struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses */ } and the man page says h_addr_list An array of pointers to network addresses for the host (in network byte order), terminated by a NULL pointer. Given that list, the application can pick and choose. At any point in time the server's DNS can return a subset of the possible addresses - as shown by the differences between my earlier post and James' earlier post. How the application picks and chooses is entirely up to the application. What happens BEHIND these interfaces that google, yahoo and others present is another matter, and they have published a number of papers on this and how they have tried out different approaches, But essentially there is another 'crossbar switch' and another layer of load balancing. How it works ... probably changes as new technology comes along and new ideas are formulated. I'll grant you that some sites, like my own little site, does have just one address. $ host www.antonaylward.com www.antonaylward.com has address 66.33.210.248 Yes, that's it. But its not as if I get a lot of traffic :-) -- "You may have to fight a battle more than once to win it." -- Margaret Thatcher -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org