Bind options rotate in resolv.conf file

I have a question regarding the behavior of options rotate in /etc/resolv.conf file on Ubuntu 16.04 LTS.

From the book DNS and Bind, it says:

rotate lets your resolver make use of all the name servers in resolv.conf, not just the first one. As long as your resolver's first name server is healthy, it'll service all of your resolver's queries. Unless that name server gets very busy or goes down, your resolver will never query the second or third name servers in resolv.conf. If you'd like to spread the load around, you can set:

    options rotate

to have each instance of the resolver rotate the order in which it uses the name servers in resolv.conf. In other words, an instance of the resolver still queries the first name server in resolv.conf first, but for the next domain name it looks up, it queries the second name server first, and so on.

I find the above description conflicting, or at least not very clear. I have 2 interpretations:

1 once options rotate is set, the resolver will try to use the first name server, unless the first one is down. This means queries won't be load balanced to the remaining servers as long as the first one is healthy;

2 once options rotate is set, the resolve will try to load balance the queries to all the servers, even when the first one is healthy.

Now, which interpretation is the fact?

Thanks.


Solution 1:

It is case number 2.

The default behaviour, without any option, is already your first case: first nameserver is always used, except if it does not reply in which case the query is done again with second nameserver. This is repeated each time per query. So by default you have failover not load balancing.

You can test this very easily by putting as first nameserver one IP address that does not reply to DNS requests, in the first case you will see all requests being delayed (the time waiting for the timeout before testing the second nameserver) while in second case you will have 50% of requests slow (as previously) and 50% fast because they will directly hit the second nameserver.