Want to be able to choose upstream DNS servers depending on the DNS domain query. The reason being is my DNS provider (opendns) blocks DNS lookups for my vpn provider (Surfshark). If I can compile a list of the DNS names it needs to resolve, can I use an alternate upstream DNS server for those lookups only? I wonder if there is something I can do with either iptables on the pihole or the pihole software itself?
thanks - I already have devices setup in dnsmasq on my router (where DCHP is controlled from) which are set to use different DNS and that works fine - I have some devices which need googles DNS and the lovely ads that come with it.
What I'm looking for is to assign a different DNS server for specific requests only depending on the DNS request domain (ideally wildcard it with surfshark in the name - if detected use a different DNS server like quad 9). I don't think you can do this in dnsmasq?
jfb has already answered that: You should be able to do this with dnsmasq.
Please take the time to read through the link he provided.
You'll find the following infomation there:
More specific domains take precedence over less specific domains, so: --server=/google.com/1.2.3.4 --server=/www.google.com/2.3.4.5
will send queries for *.google.com to 1.2.3.4, except www.google.com, which will go to 2.3.4.5
thankyou - I will read the manual - thanks for pointing out the specific section. Looks like I need to play with that. I'll go and try it and report back if I still have questions/success.
Jul 24 14:02:44 ROUTER daemon.info dnsmasq[8117]: using nameserver 9.9.9.9#53 for domain surfshark
I'm guessing clients will ignore this though as they are pointed to pihole as their DNS server? Don't really want to use pihole as DHCP server as I prefer to have the dnsmasq config including DHCP on the router. Ideally I just want dns requests sent to pihole to use this and not do DHCP from the pihole. Is it possible/safe to make the change to dnsmasq and run it on the pihole as well?
Internally, piholes is using dnsmasq (only slightly modified). So you can continue to use your router as DHCP and pihole as DNS. There is no need to install dnsmasq alongside pihole (it even can cause issues), but you can make all configuration changes that are possible in dnsmasq available in pihole too by adding files to /etc/dnsmasq.d/