cancel
Showing results for 
Search instead for 
Did you mean: 

Can I run 2 Pihole servers on 2 Raspberry Pis?

glocal
Rising Star
Posts: 140
Thanks: 11
Registered: ‎11-09-2007

Can I run 2 Pihole servers on 2 Raspberry Pis?

Is there a way to use two separate Raspberry Pis running pihole concurrently?

I have been using one 24/7 on Hub One and Two since August 2020 following this advice to solve the problem of these routers not allowing us to change the DNS server address. It runs Unbound and I have had no issues but I thought some redundancy would be good in case that Pi fails one day. A second Pi would run backup Pihole and PiVPN servers in addition to whatever else I decide not to install on the first one. I am guessing that normally I would define a primary and a fall-back secondary DNS server on the router, but my concern is these routers don't allow that. Any ideas?

26 REPLIES 26
Dan_the_Van
Hero
Posts: 3,069
Thanks: 1,499
Fixes: 90
Registered: ‎25-06-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@glocal 

Unlike the Hub One the Hub two does allow you to add your preferred choice of DNS servers

Navigate from Home >Advanced settings >My Network >IPv4 configuration >DNS servers >change from auto

Use this to enable custom Primary and Secondary DNS Servers being leased via DHCP.
All clients will need to renew its DHCP lease for changes to take effect.

 

 

glocal
Rising Star
Posts: 140
Thanks: 11
Registered: ‎11-09-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

That's great. I didn't see the options because the DHCP server on my router was disabled. Thanks.

Has anyone used primary/secondary DNS addresses there for two Raspberry Pis?

 

Baldrick1
Moderator
Moderator
Posts: 12,356
Thanks: 5,543
Fixes: 430
Registered: ‎30-06-2016

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?


@glocal wrote:

….Iam guessing that normally I would define a primary and a fall-back secondary DNS server on the router, but my concern is these routers don't allow that. Any ideas?


I only run a single pi hole but my observation: I have read that the secondary DNS server is more than a fall back port and the two can interlace and share the load. I found that mine did not play nicely unless I pointed both primary and secondary ports to the pi hole IP address.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Champnet
Aspiring Hero
Posts: 2,894
Thanks: 1,085
Fixes: 14
Registered: ‎25-07-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?


@Baldrick1 wrote:

I found that mine did not play nicely unless I pointed both primary and secondary ports to the pi hole IP address.

Aren't you creating an unnecessary single point of failure ?

Baldrick1
Moderator
Moderator
Posts: 12,356
Thanks: 5,543
Fixes: 430
Registered: ‎30-06-2016

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@Champnet 

Probably not in the way that you are thinking.

The actual upstream DNS lookup is passed from the hub to the pi hole IP address where up to four resolver IP addresses can be specified.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

glocal
Rising Star
Posts: 140
Thanks: 11
Registered: ‎11-09-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

I suppose interlacing may mean that when one of the Pis is down, a second one works as fall-back, which would be good for redundancy if that setup played nicely.

 

Out of interest, with a single Pi setup, what address did the secondary DNS point to before you used the pihole address for both secondary and primary DNS?

Baldrick1
Moderator
Moderator
Posts: 12,356
Thanks: 5,543
Fixes: 430
Registered: ‎30-06-2016

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@glocal 

No, I mean that it uses the two alternatively not the secondary as a back up for the first. Without the pi hole you either leave the hub to use a pair of Plusnet DNS servers or manually set the DNS addresses to the primary and secondary servers of your choice.

When this function is transferred to the pi hole then this is where you enter this two IP addresses, plus two more if you so wish.

The way to check this out without a Pi hole is to simply set the Hub 2  to use your own choice of IP address, then only enter one, leaving the other entry field blank. This would simiulate one of the suggested two pi holes failing.

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Dan_the_Van
Hero
Posts: 3,069
Thanks: 1,499
Fixes: 90
Registered: ‎25-06-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@Baldrick1 

When this function is transferred to the pi hole then this is where you enter this two IP addresses, plus two more if you so wish.

What IP Addresses are you referring to, where are the two more if you so wish?

The way to check this out without a Pi hole is to simply set the Hub 2  to use your own choice of IP address, then only enter one, leaving the other entry field blank. This would simiulate one of the suggested two pi holes failing.

The best way to check failover is to fail something not reconfigure a device. So with two pi-hole switch one of them OFF.

 

Baldrick1
Moderator
Moderator
Posts: 12,356
Thanks: 5,543
Fixes: 430
Registered: ‎30-06-2016

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@Dan_the_Van 

What IP Addresses are you referring to, where are the two more if you so wish?

I was referring to the IP addresses of the chosen DNS servers. I obviously failed to remember that the four is made up of two IPv4 and two IPv6 addresses.

The best way to check failover is to fail something not reconfigure a device. So with two pi-hole switch one of them OFF.

It obviously is, but the purpose was to question whether it is worth configuring two pi holes in case that it does not really enhance the availability of a DNS resolver. I would assume that due to the reduced complexity and running temperature of a pi hole, they are inherently more reliable than a router.

Thinking back as to why I ended up with pointing both hub IP addresses to the pi hole: originally I assumed, like others, that the primary IP address would be normally used and the secondary only brought into service if the primary was down or overloaded. With this in mind I directed the hub primary DNS to the pi hole and the secondary to OpenDNS, assuming that it would be very rarely used. When I started playing with seeing how well blocking was working I got inconsistent results, suggesting that quite a lot of traffic was being directed through the secondary DNS channel. I fully accept that this could of been a false impression and I was being fooled by, for example, previously cached results and I welcome further feedback.

What we don't know is how the Plusnet hub steers the DNS requests to the primary and secondary servers. Does it in standard form direct every request initially to it''s primary server, or does it share the load? If one of the two is down then what happens, for example, does it just slow down the response?

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'

Anunnaki
Aspiring Pro
Posts: 120
Thanks: 45
Fixes: 3
Registered: ‎15-06-2024

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?


@Baldrick1 wrote:

 

What we don't know is how the Plusnet hub steers the DNS requests to the primary and secondary servers. Does it in standard form direct every request initially to it''s primary server, or does it share the load?

 

Or the other possibility is that it tries both simultaneously, and uses the quickest response (that's what 'dnsmask' does).

.

Dan_the_Van
Hero
Posts: 3,069
Thanks: 1,499
Fixes: 90
Registered: ‎25-06-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@Baldrick1 

I would be interested to know when you define you own DNS server on the Hub what is ipconfig /all on a windows pc showing the DNS server to be

The Hub's IP Address or the pi-hole IP Address?

EDIT: this assumes the Hub is still acting as the DHCP server

glocal
Rising Star
Posts: 140
Thanks: 11
Registered: ‎11-09-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

If the router (a) tries both servers simultaneously (b) tries the secondary server only when the primary one fails or (c) interlaces primary and secondary servers but retries with the other IP when one of them fails, then we get the redundancy if one of the Pihole setups fails. The only scenario I can think of where we don't get redundancy is in the case of interlacing but without the retries when one of the Pis fails.

Unless someone already knows the answer, a test with switching off one of the Pis is the only way to find out. This is not great because I was trying to avoid setting up a Pi just for testing. I suppose I could point the secondary DNS to a non-existent Pi and see what happens.  

 

For the record, my DNS IPs on the router are ignored and don't have to worry about them because I have DHCP on the router switched off. That workaround is from my Hub One days when we couldn't change DNS IPs. Pihole gets all the requests and the logs show that.

Dan_the_Van
Hero
Posts: 3,069
Thanks: 1,499
Fixes: 90
Registered: ‎25-06-2007

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?

@glocal 

IP Address 0.0.0.0 is usually used for a place holder where no valid IP Address is required

Baldrick1
Moderator
Moderator
Posts: 12,356
Thanks: 5,543
Fixes: 430
Registered: ‎30-06-2016

Re: Can I run 2 Pihole servers on 2 Raspberry Pis?


@Dan_the_Van wrote:

@Baldrick1 

I would be interested to know when you define you own DNS server on the Hub what is ipconfig /all on a windows pc showing the DNS server to be

The Hub's IP Address or the pi-hole IP Address?
EDIT: this assumes the Hub is still acting as the DHCP server


It shows it to be the pi hole LAN address.

dns.png

Moderator and Customer
If this helped - select the Thumb
If it fixed it,  help others - select 'This Fixed My Problem'