Sorry if this has been asked before. I have looked...
I have been searching for this but have not found a blow-by-blow account of what's going on nor have I found an idiot's guide in fixing it.
I have a pi with a working pihole. I can connect using clients by adding the client in pihole, so pihole is working fine. No issues there.
I want to do the following:
In my router, change the primary DNS server to my pihole which is 192.168.1.119 (the ip is fixed in the router and during the install of pihole.) The secondary DNS address should be a public one such as 1.1.1.1 or another, or my ISPs secondary DNS address, as a fallback if the pi throws a hissy fit and goes offline.
If I do the above in my router settings, the internet fails. The router goes to a different admin IP from 192.168.1.254 to 192.168.0.1 and the DHCP pool changes to the same range hence access is no longer available for any client on my network. I have to go into the router and reset the router's admin ip and change the primary DNS setting to the original IP adrress to get things working again.
What have I done (or not done)?
I want the router admin ip to stay the same.
I want the DHCP pool to stay the same, as I have two servers that have fixed IP addresses on the LAN.
I want pihole to provide DNS services to my network rather than on a client by client basis.
The preferred method depends on if you can alter LAN DHCP DNS settings on the router.
If you can, first check if a client can query Pi-hole and gets a reply when you run below on a Windows, MacOS or Linux client (10.0.0.5 below is my Pi-hole IP):
Only when those queries reply positive, you can proceed by changing only the router LAN section DHCP DNS setting.
No other router settings needs changing!
Pi-hole should be the sole DNS server for your clients and no others like a fallback DNS:
Next have the PC that you use for testing renews its DHCP lease.
They usually do when you shortly disconnect them from network.
And run below nslookup again but this time without the Pi-hole IP as an extra argument:
If that all works, you'd have to let the rest of your clients renew their DHCP leases.
You can do that all at once by power cycling your router, Wifi AP's and or network switches.
As soon as the clients detect the restored network connection, they will request a new DHCP lease.
Above is only for the IPv4 part!
IPv6 is another monster
Thanks very much for your reply. Maybe I'm missing something. All of the above is ok.
All of the clients connect if I set them as clients in pihole, I can see them, and the blocks are logged for that client.
I can edit the settings in the router, but the problem is when I set the ip address for the Primary DNS server to the pihole in the router, then the DHCP server in the router and the admin ip of the router gets changed, How do I stop that? How and why is that happening?
Sounds like a router issue.
You could post router make/model here and if lucky, someone here knows what to do?
Try editing your original starting post to add those details?
But you'll have better luck at the support channels for your router I guess.
You could also run below in the shell to create a debug log and upload it to the Pi-hole tricorder server for the mods and devs to see if anything is off:
pihole -d
Post only the resulting token URL here!
Not the output for the debug log!
I can edit the settings in the router, but the problem is when I set the ip address for the Primary DNS server to the pihole in the router, then the DHCP server in the router and the admin ip of the router gets changed, How do I stop that? How and why is that happening?
Some routers have one set of DNS entries for the WAN connection and a separate set of DNS entries for the LAN clients of that router. It may be you are putting the Pihole address in for your WAN DNS and it needs to be only for the LAN clients.
So like @deHakkelaar mentioned, let us know the make/model of the router and someone may have a hint or at least can point you in the right direction.
I am a complete and total idiot... Sorry for wasting your time. Yes, indeed it was this morning that I realised what I was doing.
I was putting pihole on the WAN side of the router and NOT the LAN side. I am so so sorry. The 10 clients in the property, have had the DNS changed and are now pointing to the pihole, and it's working!!!!
What a dunce I am... Thanks for confirming my stupidity though. I've learned.