How to resolve a domain name to a single IP address?

I was surprised to learn that a single domain name can have many IP addresses. For example, here are my results for Dns.GetHostAddresses("www.google.com"):

{System.Net.IPAddress[6]}
    [0]: {74.125.127.147}
    [1]: {74.125.127.99}
    [2]: {74.125.127.103}
    [3]: {74.125.127.104}
    [4]: {74.125.127.105}
    [5]: {74.125.127.106}

(YMMV, the addresses seem to change periodically)

Where do these different addresses come from and how to choose the IP address to connect to?

0
source share
4 answers

IP addresses come from the DNS server associated with the requested domain name, www.google.com in your example. This will be the same process as the web browser to access the server IP addresses.

, IP- , , , , , , , .

0

IP-, DNS .

" ", . DNS, , , .. (example.com) , (), .

DNS , , ..... .

+2

Most likely, some RoundRobin is used.

You can only rely on a domain name if the domain is not under your control.

+1
source

You can do a few things:

  • Use System.Net.IPAddress [0] right with a bat.
  • You can ping all 6 and see which one responds best to time, cache, value and try to use it later.
0
source

All Articles