All pinging works using raw ip between the 2 sites (just to get that out of the way)
Site 1 is called "network1.local" and has a pihole dns server configured and all devices on network1.local can ping eachother using their "shortnames". Example, if i type "ping nas" it resolves as "nas.network1.local" automaticlly from just the shortname. However none of the devices on site1 can ping anything using shortname or FQDN on site2.
Site 2 is called "network2.local" and relies on edgeos dhcp with dnsmasq enabled that is the local router on site2, all clients dns queries that are outside the network2.local domain are being forwarded to the pihole DNS that are on site1. All devices site2 can ping each other using their shortnames and they will resolve to hostname.network2.local, these devices can also ping devices in site1 by using the FQDN, but cannot ping using the shortname. Example: ping nas does not work, but ping nas.network1.local works because the query is being passed on to the pihole dns when not found in the local dnsmasq (i guess?)
I need a way to make pihole resolve the ips of hosts on network2.local for devices that are on site1, which should be possible by forwarding any query that contains the dns name "network2.local" onward to the dnsmasq server on site2 but i cannot get this to work?
In pihole i have tested:
sudo nano /etc/dnsmasq.d/02-custom.conf
server=/network2.local/3.3.3.1
to my understanding this will make traffic that contains hostname network2.local go torwards sever at 3.3.3.1 or have i misunderstood something? It doesn't work for me.
Note that Pi-hole would need to be restarted in order to read and apply that config.
Verify whether it works, e.g. by running
nslookup hostname.network2.local
and share the result, please.
Note that unqualified lookups would still fail, so nslookup hostname would return NXDOMAIN and ping hostname still wouldn't find a host from network2.local.
You may try to add network2.local to your network1's search domains/suffixes, but it would depend on both the software as well as the client's configuration whether a certain software or tool would actually issue DNS requests for all search suffixes. Also note that this may lead to unexpected resolution results if two clients from different networks would claim the same plain name.
It would probably be safer to add Local DNS records for those hosts that need cross-site resolution to your Pi-hole (or each of your DNS servers, if applicable).
thanks, i relied on just restarting the dns resolver thinking the configs would be read.
now i got some progress but this may be completely unrelated to pihole, now i am getting timeout when doing nslookup hostname.network2.local on a device sitting on site1. maybe a firewall rule on the other router preventing the dns queries reaching the destination? it would be strange though as i have opened everything from this subnet.
edit: maybe i have created a loop, im in over my head, maybe like you say static dns records in each site is the way to go, was just hoping there was an easy way to do this
Did Pi-hole forward that query as expected?
Check the Query Log or use pihole -t while issuing nslookups.
If it is forwarded, check whether your far side DNS server has received and answered that query.
If it is answered, note that some routers may suppress DNS answers that contain a private IP address (which usually is a sane thing to do). Usually, a router would do so for replies to DNS requests it has issued itself (edit: so it would have to be part of the resolution chain to interfere in your case).
Look for configuration of a feature named DNS rebind protection or similar in your router, and define exemptions for those domains you want to resolve.
yes, queries are being forwarded so pihole is working as it should, issue is on other end, will look into the rebind protection thing! thanks for all the help!