I have a setup specifying two DNS namservers. One in local, the other is external. The local one is a pihole, which itself forwards requests externally after url filtering. The external one is set in case the pihole device software or hardware fails.
The pihole response time is about 20 ms, the external response time is about 2 ms. Although the pihole is listed as a nameserver before the external, dnsmasq will by default test timing responses and use whichever is faster.
dnsmasq does however offer a parameter
strict-order which should use the nameservers in the strict order they are listed, and so in this case should only use the external nameserver if the pihole "fails".
In practice using the parameter
strict-order doesn't work as hoped, and the external nameserver still wins. The dnsmasq manual page doesn't go into detail about the definition of "failed".
I am looking for other parameter setting which might solve this problem.
As a last resort I would use an external program to detect pihole working order, and manipulate the dnsmasq nameserver settings accordingly. But that is not a preferred solution.