Dnsmasq not using strict-order

I've got multiple DNS forwardings configured on my GL-MT6000 and I've also got Strict Order checked. When looking at the logs I'm noticing that the last entered DNS server is being used for lookups. This is true even after I add/remove other entries and seems backwards to how I would expect it to work (top-down, not bottom-up).

I also simulated a failure of the last entered server and dnsmasq started using the one just above it. After recovering from the failure, dnsmasq started querying multiple DNS servers (at least initially--it seems to have cleared up now).

Is the DNS forwarding list read from the top-down or from the bottom-up when Strict Order is selected?

Strict order is only the order the dns is sent in the routers logic.

On the OS, it often takes the dns on best availability meaning it doesn't follow a order.

It's more of a fallback system / availability system than a strict order it follows.

The logs I was looking at were on the router (logread), not on the OS. The dnsmasq doc states:

By default, dnsmasq will send queries to any of the upstream servers it knows about and tries to favour servers that are known to be up. Setting this flag forces dnsmasq to try each query with each server strictly in the order they appear in /etc/resolv.conf.

The dnsmasq.conf file used by the dnsmasq service has the same forwarding order as what's displayed in the GUI. So still not understanding why the last server is being used and not the first (when both are available).

In my case I have a Pi-Hole server that I want as the primary DNS. If it's unreachable for whatever reason (it happens), a backup DNS server but then back to the Pi-Hole once it's back online.

This is made worse by the fact that Samsung TVs (and likely other IoT devices) don't support secondary DNS servers so when your primary DNS is unreachable, the TV becomes useless. Hence doing this on the router.

The unfortunate side effect is that the client don't choose the strict order, it can appear like that, but that doesn't mean it strictly follows it, on Windows it choices the dns based on best request and response latency ratio, it only fallsback if a ip clearly goes offline, but there is no real order windows follows.

Unless you can setup more control on the client, not possible.

The best you can do is indeed is having the order reversed, but clients can do whatever they want with this list.

1 Like

As previously stated, some devices like Samsung TVs have no secondary DNS setting. In those cases there is nothing to fall back to. For other OS's like Windows, setting a single DNS entry to the router IP seems reasonable because if the router goes offline so does the OS. Let the router handle any fallback--which is exactly what I'm trying to accomplish.

This question is really directed at how strict-order works on the router, and not about the client.