NLnetLabs / unbound

Unbound is a validating, recursive, and caching DNS resolver.
https://nlnetlabs.nl/unbound
BSD 3-Clause "New" or "Revised" License
3.13k stars 359 forks source link

Forward zone query distribution #414

Open nikeshjauhari opened 3 years ago

nikeshjauhari commented 3 years ago

I've got a question how queries are distributed to forward resolvers.

In this example, I've defined that all queries, which can't be answered from the cache, are forwarded to cloudflare and openDNS:

forward-zone: name: "." forward-tls-upstream: yes

Cloudflare DNS

forward-addr: 1.1.1.3@853#family.cloudflare-dns.com forward-addr: 1.0.0.3@853#family.cloudflare-dns.com

OpenDNS Server

forward-addr: 208.67.222.222@853#doh.opendns.com forward-addr: 208.67.220.220@853#doh.opendns.com

Looks like all my queries is going to cloudflare, because it's the first one. how can we achieve some sort of distribution (random / roundrobin, etc ...)

thanks, Nikesh

wcawijngaards commented 3 years ago

Unbound selects the upstream server at random. If one of them if very slow, or unreachable, it is exempted from the random selection.

If you want to modify the selection, instead of random you can have the fastest with the options fast-server-permil and fast-server-num. The option unknown-server-time-limit can be useful if you want to modify unknown server selection versus known server selection.