0

On round-robin DNS every IP associated to a domain has equal probability of being picked by the client.
But what if I want to set a round-robin domain over two IPs but not in a 50%-50% manner?

For example, I could add 3 A records for IP X and 2 A records for IP Y. That way X and Y would be picked by clients on a 60%-40% rate rather that 50-50 if I would've added only 1 A record for each IP.

In theory it sounds possible. But would this really work as expected?
If it worked on a specific DNS server (namely BIND), what about other DNS servers (e.g. ISP DNSs) that are permanently caching requests??
And assuming this work on the server side, how would clients handle multiple A records having the same IP?

1
  • what you're looking for is called "weighted round-robin" Dec 9, 2009 at 15:31

3 Answers 3

1

Here's an implementation of weighted round robin DNS: https://web.archive.org/web/20100126053705/http://www.mccartney.ie/wordpress/2008/08/19/wrr-dns-with-powerdns

Returning multiple answers is dangerous thanks to implementations of RFC3484: http://drplokta.livejournal.com/109267.html

5

Because of caching, and because the DNS resolver on the client actually makes the choice re: what IP address to choose, round-robin is a poor choice for getting any kind of "balance" out of intended load balancing. Trying to tweak it to trend the load statistically isn't going to accomplish anything useful.

Fundamentally, "A" records weren't designed to do what you're looking for. (SRV RR's, by contrast, do have "weighting" capability but, alas, nobody uses them.) I suppose one could implement a DNS server that permuted the list of IP addresses returned using some kind of statistical metric, but given that a goodly number of clients are going to be receiving cached results for lookups to your servers (which the server-side hypothetical statistical metric would never "see"), there's really no way to make that work either.

1

My understanding of DNS round robin is that the ip returned is controlled by the server (which returns only one ip per client per request) and not controlled by the client. When a client resolver queries DNS, the server returns the first record and sends that record to the back of the line, the next client request gets the second record, etc., etc.

There's no "equal weight" algorithm (or any other alogorithm for that matter that Im aware of). It's simply a matter of how many records there are and those records are returned in order of listing (first to last). Am I right?

3
  • 4
    Not really. DNS servers return all A records to the client but each time in a different order. Then the client chooses which A record to use. And since clients normally pick the first one, this technique can be used as load-balancing
    – GetFree
    Dec 9, 2009 at 16:00
  • @GetFree is this guaranteed by DNS spec? ` but each time in a different order` I entered 2 A records in Hover, then did dnslookup on 3 different machines, each got the IPs in the same order. I know 3 is not a great sample. But is DNS required to randomize the order? Oct 7, 2017 at 21:29
  • @user3175580, the wikipedia article about Round-robin DNS says nothing about standardization (en.wikipedia.org/wiki/Round-robin_DNS). I would guess it's just a common (yet non-standard) feature of DNS servers.
    – GetFree
    Oct 9, 2017 at 4:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .