I have DHCP enabled in my network with static lease for my known devices (laptop, server, phone, etc..) so I don't need to configure static ips in each of them.I have just installed a dockerized pihole in my network (IP 192.168.0.21) so I want this to be the first DNS option for each device connected.
So when a new lease is solicited, the router send not only the IP but the DNS servers (first my pihole, then google dns for example just in case my server is down). The problem now is the router is sending 192.168.0.1 (itself) as DNS server and then he resend the petition to the pihole.
Could this be changed?
I have:
DNS forwardings set in DHCP server settings (192.168.0.21, 8.8.8.8, 8.8.4.4)
Network > interfaces > wan > edit > Use custom DNS server (192.168.0.21, 8.8.8.8, 8.8.4.4)
But the 'problem' is still there. Is there anything I could do?
P.D: my ISP router is on the top of this 'architecture' with a DMZ to my openwrt.
The problem is that I need a backup DNS server (maybe in the openwrt itself) just in case my server goes down. Can this be achieved without using thirdparty DNS and without setting up another machine with pihole?
I just turned off my server (after checking that my computer appears in the pihole client list and it was working) and names are being resolved anyway. If I do a 'config /all' I can see my Pihole Ip as the only DNS server. How is my computer resolving then?
Sorry for so many questions and thanks for you help
Ok, I see in your code that what you are doing is setting my Pihole at first in the order but there are another DNS somewhere, right?
The OP wants to use failover DNS when Pi-hole is down, however passing multiple DNS with DHCP makes it depend on the client implementation, which is not guaranteed to utilize strict order.
True, but in this case I would send the Pihole and the OpenWrt. If everything works fine, the hosts will query Pihole directly or OpenWrt, which in turn will query Pihole. If it is down, OpenWrt will try the nameservers of the wan.
This may result in a significant delay for the clients that don't remember DNS server status and use round robin or strict order methods for every DNS query.
In that case, 30-50% of the DNS queries would be answered only after Pi-hole DNS timeout.
In fact, I just tried that and network is really slow. I'm still wondering how to do it because in you previous answer Dnsmasq @ OpenWrt is the first option and not Pihole.
Edit: Well, I found this. So I'm afraid I have to set up a raspberry pi as a backup!!