What is the purpose of a DNS server returning more than 1 A record?

How are the secondary addresses used? Is it application specific?

Note: I'm not asking about round robin dns. That could be done by only returning 1 address at a time.


Solution 1:

I believe that IS round robin DNS. The DNS server returns all the IPs for services matching that A record. It is up to the client/browser to resolve which IP to use.

Solution 2:

If a client fails to connect to the first IP-address, it can try to connect to the next IP-address in the list if more than one IP address is provided. You can see it as a "cheap" fault tolerance solution. And the order of the addresses is altered (round robin) so it also works as a "cheap" load balancing.

Solution 3:

For one thing, the DNS protocol is designed to be independent of the data that's actually stored in it. There are many record types that really need multiple answers, like MX (mail servers), and NS (name servers) records. Generally you should always have multiple of those if you're running a decent site with redundancy in place.

For addresses, however, there are times that people like returning multiple records. The DNS specifications state that if you get more than one, you should ideally "pick one at random". This is highly helpful for spreading load across multiple machines, though in practice it's not as ideal as you'd like which is why there is a more common practice of IP-based load balancers rather than using multiple answers. Thus, multiple-A or multiple-AAAA (IPv6) are less used than they used to be.

But remember: DNS, the protocol, is designed not to care about the data it is carrying. It will happily deliver multiple records of a particular type even if it is not useful to the end-application.