How to Split DNS with hosts file and upstream server?

The issue I am facing:

I want split a DNS where:

  • Queries to Pi tailscale0 interface (100.x.x.x) give replies in that ip range
  • Queries to Pi eth0 interface (192.168.x.x) forward upstream to my router running DHCP in that ip range

This would normally work with localise-queries, however the 100/8 IP information comes from a shell script and a addn-hosts=my-100-range-hosts-file configuration.

My issue is that I only get replies from the hosts file regardless of the inbound IP/interface of the query. How could I create a "split dns" configuration where part of the split is hosts and the other is upstream DNS?

Details about my system:

  • Hardware:
    • Pi3b of some kind connected via ethernet to router
  • Network:
    • Router runs DHCP for the network on 192.168.1.1
    • Pi eth0 interface with a 192.168.0.0/24 address
    • Pi tailscale0 interface with a 100.x.x.x/8 address

What I have changed since installing Pi-hole:

I've added a dnsmasq.d file and experimented with server=, addn-hosts=, address=, and other options.

I saw discussion about the limitations of split DNS here in the forums and I also concluded there may be similar limitations by reading the dnsmasq man page.

I believe the best solution may be to run an additional instance of pihole-ftl or dnsmasq. The second resolver could bind to the tailscale0 interface and use the addn-hosts + shell script trick. This would allow me to use multiple server=mydomain.tld/mydnsserver@interface lines to put the two IP ranges on an "even playing field" to let localise-queries do its job.