[Dnsmasq-discuss] The order of nameservers provided by `server=`
Fox Haxx
foxhaxx at yandex.com
Mon Mar 25 19:09:09 GMT 2019
> Let' say I have this config:
>
> server=<ns1>
> server=<ns2>
> resolv-file=/etc/dnsmasq-resolv.conf
> strict-order
>
> By running dnsmasq with `--log-queries` I discovered that <ns2> is actually
> listed above <ns1>:
>
> dnsmasq: using nameserver <ns2>
> dnsmasq: using nameserver <ns1>
> dnsmasq: using nameserver 192.168.1.1#53
> dnsmasq: read /etc/hosts - 2 addresses
> dnsmasq: query[A] x.org from 127.0.0.1
> dnsmasq: forwarded x.org to <ns2>
> dnsmasq: reply x.org is 131.252.210.176
>
> Which is to say, every `server=` server is _prepended_ to servers list, rather
> than _appended_.
>
> I think this is counter-intuitive.
>
> So is this intended?
> Is it documented?
> Should it be changed?
>
Further testing shows another thing that surprises me: no matter whether the
`resolv-file=` is above the `server=` lines or below them, the nameservers in
the resolv-file is _always appended_ to the list of servers produced by
`server=` lines.
For example, this config:
server=<ns1>
server=<ns2>
resolv-file=/etc/dnsmasq-resolv.conf
strict-order
is equivalent to this:
resolv-file=/etc/dnsmasq-resolv.conf
server=<ns1>
server=<ns2>
strict-order
which both produce this queries log:
dnsmasq: using nameserver <ns2>
dnsmasq: using nameserver <ns1>
dnsmasq: reading /etc/dnsmasq-resolv.conf
dnsmasq: using nameserver <ns2>
dnsmasq: using nameserver <ns1>
dnsmasq: using nameserver 192.168.1.1#53
dnsmasq: read /etc/hosts - 2 addresses
dnsmasq: query[A] x.org from 127.0.0.1
dnsmasq: forwarded x.org to <ns2>
dnsmasq: reply x.org is 131.252.210.176
This is not very intuitive either.
More information about the Dnsmasq-discuss
mailing list