tags:

views:

2161

answers:

6

This question probably highlights a lack of understanding of networking principals on my part, rather than a programming issue.

I'm doing a lookup on a hostname using

Dns.GetHostEntry

This returns an IPHostEntry to me, which has an AddressList property which is an array of IPAddress.

I always thought there is a 1 to 1 mapping between hostname and IP, but I'm finding that in some cases I get back several IPAddress(es) for the same host.

This is a surprise to me.

Which part of domain name resolution do I not understand?

+4  A: 

Any system can have multiple network interfaces and internet addresses, yet only have one name. The forward mapping from name to address will return all of the addresses mapped to a particular name. We used to do this with our file servers so that hosts wouldn't have to traverse a network boundary when accessing files and to spread the load out across the various NICs. The file servers would be homed on each of our various subnets, having multiple interface cards, each with a different subnet address, but the same name. The DNS servers on campus are still set up this way. Additionally, you may have a name that maps to more than one system, providing some level of load balancing via DNS.

tvanfosson
The system can be reached by multiple names - just a matter of DNS entries. You are right however that usually the machine itself has a single name, but that does not necessarily have anything to do with DNS.
Daniel Schneller
+2  A: 

One possibility:
A name can resolve to more than one address, this is sometimes used for round robin it's a weak way of load balancing your servers.

Nifle
+1  A: 

As far as I know it is possible to allow multiple IP addresses for one hostname to allow for high-availability. That is: when one machine is down, another one will be used.

Thorsten Dittmar
+2  A: 

You can have multiple adresses from multiple network adapters or multiple protocols. Often you'll have IPV4 and IPV6 adress for the same host.

Hugo Riley
+6  A: 

The mappings between physical network interfaces, DNS names and IP addresses is practically arbitrary. However you should distinguish between network interfaces (typically Ethernet adapters, Wifi adapters, Bluetooth network devices etc.) and the DNS side of things, which only deals with names and IP addresses (not physical interfaces).

Here are some facts that you can mix and match:

  • a single network card can have 1 or many IP addresses.
  • a single DNS name can be resolved to 1 or many IP addresses.
  • a single IP address can (and will usually) identify a single machine
  • mulitple DNS names can be mapped to a single IP address

Consider hosting providers: They will have many DNS names pointing to the same - shared - server. That server might for reasons of reliablilty be equipped with multiple network cards, each with several IP addresses.

For PCs you will usually get more than one IP address if you query by hostname, because nowadays you typically have at least two (wifi and ethernet) adapters with their individual (mostly single) IP address. In load-balancing scenarios however all sorts of clever mappings and redirections (virtual IP addresses and the like) can occur.

Both DNS and IP protocols are very flexible, however this of course does not necessarily make them easier to understand.

Daniel Schneller
A: 

How can i attached multiple IPs to one DNS, i already purchased a DNS with SRV feature for voip. Now i have tried several times to attache my 2 servers to this DNS but it doesnt seem to work, i have only suceeded in attaching the DNS to just 1 of my voip servers. I configured the svoip server using the DNS SRV feature is there anything i have to do on the voip server itself? Thanks