For example, google.com has at least these ip:
74.125.225.49
74.125.225.51
74.125.225.81
Does ping just pick one of them randomly?
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
The answer is it depends on how your DNS resolver is setup and also how the DNS server for the domain in question is set up. The DNS resolver on your ping source host will consult the OS and network configuration to lookup the host you want to ping. If this is a new host, one for which you haven't previously done a lookup, the DNS query sequence will go from start to finish. The number of A records and contents of those records as well as what order they are are returned depends on the name servers for the target ping destination domain. This process is a whole other discussion. Your DNS client will pick one of those IPs returned in the A records and your ping will start sending IMCP echo-request messages to that destination IP. Your local OS may cache one or more of the responses for some period of time, typically but not always the TTL specified in the A record. There is also another caching opportunity at your DNS resolver, again, which typically but not always will follow the TTL. One final wrinkle is the so-called sort ordering done by some DNS clients. See: | ||||
feedback
|
|
It just picks one of them. It's not quite random -- for example, if one of them is on the same local network, it will typically pick that one. | |||||||||||
feedback
|
|
THE PING PROCESS
The process above is repeated until all requested ICMP ECHO packets have been sent and their responses have been received or the default 2-second timeout expired. The default 2-second timout is local to the host initiating the PING and is NOT the Time-To-Live value in the datagram. More: http://www.inetdaemon.com/tools/ping/how_ping_works.shtml | |||
|
feedback
|