Setting Up Conditional Forwarding In Pi-Hole 6

The tremendous @deHakkelaar helped me to set a filter for a domain so that it was sent to Google rather than Unbound. You can see that here: Trying to unblock api.met.no - #62 by deHakkelaar

However upon upgrading to PH6, I'm noticing that's not being honoured. I'm wondering if anyone knows how to achieve the same result for Pi-Hole 6?

2 Likes

That's Conditional Forwarding to alternative DNS upstreams by means of custom dnsmasq configuration rather than filtering.

See Etc/dnsmasq.d files

Thank you so much. That's indeed fixed it.

With v6, there is also the option to skip those config files all together with below one:

$ pihole-FTL --config misc.dnsmasq_lines
[]

The webGUI settings says this about it:

Additional lines to inject into the generated dnsmasq configuration.
Warning: This is an advanced setting and should only be used with care. Incorrectly formatted or duplicated lines as well as lines conflicting with the automatic configuration of Pi-hole can break the embedded dnsmasq and will stop DNS resolution from working.
Use this option with extra care.

Eg via shell:

$ sudo pihole-FTL --config misc.dnsmasq_lines '[ "server=/met.no/8.8.8.8", "server=/met.no/8.8.4.4 "]'
[ server=/met.no/8.8.8.8, server=/met.no/8.8.4.4  ]
$ dig +noall @localhost api.met.no
$
$ sudo pihole tail
[..]
22:48:51: query[A] api.met.no from 127.0.0.1
22:48:51: forwarded api.met.no to 8.8.8.8
22:48:51: reply api.met.no is 157.249.81.141

Whatever you prefer :wink:

2 Likes

That's super cool. I feel like this is probably the more graceful solution.

1 Like