11

I was wondering if it was possible to configure dnsmasq to send "server=" entries to multiple upstream servers?

so like this:

server=/facebook.com/1.2.3.4
server=/facebook.com/2.3.4.5

and have it pick which one based on it being available or not, as with resolv.conf? According to the man page, it looks like only one is allowed, but I wondered if there was a way to ask it to behave this way.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
T. B.
  • 313
  • 1
  • 2
  • 8

2 Answers2

12

Well in your example you're only pointing out facebook, but I guess you would have the same need for every hostname you might visit

dnsmasq provides the option --all-servers

--all-servers

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 requestor.

Set a several DNS servers

server=OpenDNS.IP.Addr.ess

server=GoogleDNS.IP.Addr.ess

server=...

And the fastest response will be considered

Spredzy
  • 955
  • 8
  • 11
7

Sure just add multiple lines.

server=/facebook.com/1.2.3.4
server=/facebook.com/2.3.4.5

Man dnsmasq

   -S, --server=[/[<domain>]/[domain/]] ...
          ...  More than one -S  flag  is  allowed,  with
          repeated domain or ipaddr parts as required.
Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • huh.... but is the behavior as per resolv.conf? – T. B. Apr 27 '13 at 02:17
  • 1
    yes, if one the first server is unavailable, dnsmasq will then send the request to the second server (unless the --all-servers options is used, that will force dnsmasq to use all the servers in parallel and take the first reply) – higuita Jan 05 '17 at 13:23