tags:

views:

83

answers:

2

Does Dns.GetHostAddresses really get back all registered IPs?

That is DNS can have multiple IP's registered against a DNS name for round-robin type purposes (e.g. multiple proxy servers but give use one main DNS proxy server name)

But does the .NET method "Dns.GetHostAddresses(hostname)" really bring all of these registered IP addresses back?

If not, any other suggestions re how to get a list of all possible IP's that a DNS name may resolve to?

+1  A: 

The documentation for Dns.GetHostAddresses indicates that

The GetHostAddresses method queries a DNS server for the IP addresses associated with a host name.

Therefore, it will return all IP addresses that the DNS server it contacts can provide. So the answer is a qualified yes. But only if the DNS server that the machine your code runs on can obtain a full and correct list of IP addresses for the host name you're querying.

Rob
thanks - so the overall answer is not "yes" but more "i possibly could" I guess - no ideas any other technique/approach to somehow get the full list back?
Greg
+2  A: 

For servers that have so-called "round robin" addresses, they may be configured to have a lot of IP addresses offered for a single name. However, the size of a DNS response is limited to a certain size, which in turn limits the number of addresses that can be returned in one query. So typically the DNS server might shuffle the list of IP addresses and return the first n that fit in the answer.

For a thought experiment, ask yourself whether a single query to google.com could possibly return all addresses that might serve Google web pages.

Greg Hewgill
thanks - so the overall answer is not "yes" but more "i possibly could" I guess - no ideas any other technique/approach to somehow get the full list back?
Greg