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?

GetFree
  • 1,460
  • 7
  • 23
  • 37

3 Answers3

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.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
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?

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
  • 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 09 '09 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? – user3175580 Oct 07 '17 at 21:29
  • @user3175580, the wikipedia article about Round-robin DNS says nothing about standardization (https://en.wikipedia.org/wiki/Round-robin_DNS). I would guess it's just a common (yet non-standard) feature of DNS servers. – GetFree Oct 09 '17 at 04:39
1

Here's an implementation of weighted round robin DNS: 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

BrianEss
  • 401
  • 2
  • 6