How to setup a local DNS resolver that can send query to multiple nameservers in parallel?

Why I need it:

  • The reliability of or are not very good. (Observed hours of down or unstable time over last week for
  • The machine hosts https/socks5 proxy, so name lookup is crucial and quite frequently.
    Parallel look-up is preferred to reduce latency if one nameserver does not service.

The linux machine is ubuntu server 22.04.
The https/socks5 proxy service cannot handle multiple DNS server, so a local resolver have to handle the parallel or fallback look-up for it.

2 Answers 2


According to the documentation this is possible using Dnsmasq.

The parameter to use is:

By default, when dnsmasq has more than one upstream server available, it will send queries to just one server. Setting this flag forces dnsmasq to send all queries to all available servers. The reply from the server which answers first will be returned to the original requester.

You can do so by editing /etc/default/dnsmasq and adding –all-servers to DNSMASQ_OPTS like so:


References :


DNSMASQ cannot do it by itself, but I saw Pihole ( which uses DNSMASQ behind the scenes ) being used with Unbound, giving you a recursive DNS server. Meaning that your server will ask the TLD Server directly and totally skip Google/Cloudflare.

  • Unbound will have terrible latency for non-cached queries. Recursive lookup is the total opposite of what OP asked for. Pi-hole is irrelevant.
    – gronostaj
    Feb 9 at 19:36
  • I'm guessing said 'latency' is the waiting time for a DNS request to time-out, and not about the millisecond delay. OP is asking for reliability, as far as I understand it. Also - I'm not suggesting pihole, but dnsmasq - which is the underlying engine, and a great DNS server.
    – Netan
    Feb 10 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.