OPNsense Forum

English Forums => General Discussion => Topic started by: dwasifar on January 29, 2021, 05:17:27 pm

Title: How does Unbound prioritize upstream servers?
Post by: dwasifar on January 29, 2021, 05:17:27 pm
I have Unbound configured with two Cloudflare and two Google upstream DNS-over-TLS servers: 1.1.1.1@853, 1.0.0.1@853, 8.8.8.8@853, and 8.8.4.4@853, in that order.

Watching the logs, it seems to use all four of them, although it favors Cloudflare.  How does it choose?  Does it select randomly, or is there a logic to it that I'm not seeing?
Title: Re: How does Unbound prioritize upstream servers?
Post by: Fright on January 29, 2021, 08:05:37 pm
Quote
Does it select randomly
yes, but taking RRT into account
https://github.com/NLnetLabs/unbound/issues/167#issuecomment-590272561
Title: Re: How does Unbound prioritize upstream servers?
Post by: dwasifar on January 29, 2021, 09:35:40 pm
Very interesting.  And smart, on the Unbound dev's behalf.  Looking at my logs, Unbound is favoring Cloudflare over Google more and more, which indicates Cloudflare is faster on the average.

The context of that github thread is amusing.  The dev is being pestered by a user to implement a function whereby all configured upstream servers are queried simultaneously and the first reply is used, the others discarded.  To me this is like ordering something online from four different vendors, keeping the first arrival, and returning the other three.  I'm not surprised the Unbound dev doesn't want to do it.