this post was submitted on 04 Feb 2024
46 points (97.9% liked)

Selfhosted

40382 readers
487 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I have an asus router with a pi-hole on the network.

I was doing some work on my server and noticed that when pi-hole was down, I couldn't access the internet. I was looking for some ideas online how to deal with this, but they said to have a second pihole on the network in case one is offline. Is that the only way to do it? Is there any way to have the network go back to normal if the pihole is offline?

top 50 comments
sorted by: hot top controversial new old
[–] atzanteol 61 points 9 months ago (1 children)

I was doing some work on my server and noticed that when pi-hole was down, I couldn't access the internet.

You've opted to take control over a critical piece of network infrastructure. This is to be expected.

There's a reason DHCP provides for multiple DNS servers to be listed. Having redundant DNS servers is a common setup. So yes, multiple piholes if you want stability.

[–] [email protected] 31 points 9 months ago (1 children)

Just wanted to add onto your comment for clarity for others, the multiple servers are not redundancy so much as first come first serve, which is why your comment of multiple pi-holes is important.

If you were to list a pihole and say Google DNS as primary and secondary respectively, you may have some DNS queries responded to by Google. Negating the point of having a pi-hole or similar DNS service locally.

A secondary can be a docker container, another physical pi-hole (even a zero-w, which I personally don't recommend being your only way to manage DNS, but is fine when you just need to do some maintenance on the primary).

[–] [email protected] 2 points 9 months ago

Could have pihole running on your desktop as a backup

[–] [email protected] 12 points 9 months ago (2 children)

One option is just do a temporary change on your PC to different DNS servers while you work on the stuff.

Otherwise a second PiHole set as the secondary DNS in DHCP would keep things online.

load more comments (2 replies)
[–] [email protected] 10 points 9 months ago (2 children)

Not sure if this is common knowledge but Pi-hole can also run in a docker container, it doesn’t have to be a raspberry pi. I have it running on portainer on two different machine in my house. I’m a systems architect by trade so there no kill like overkill 😅

You might be a nerd when you have to schedule maintenance at your own house.

load more comments (2 replies)
[–] [email protected] 9 points 9 months ago* (last edited 9 months ago) (1 children)

Another trick is setting up a guest/secondary AP that don't use pi-hole. When your pihole is down, just switch to the secondary AP. Most routers can setup multiple APs, though not all can setup different dns server for the other APs.

load more comments (1 replies)
[–] WindowsEnjoyer 7 points 9 months ago* (last edited 9 months ago) (5 children)

On Mikrotik I have a script that runs every 30sec. If pi-hole not responding, router switches to public cloudflare dns records, otherwise to pi-hole IP.

This setup works like a charm.

P.S. I am using Blocky, but it's almost the same as Pi-Hole.

EDIT: Since at least 2 guys asked how to do it:

https://forum.mikrotik.com/viewtopic.php?p=866934#p866934

Don't forget to configure Mikrotik router to act as passthrough DNS server with cache (for performance) and configure DHCP server's DNS to router's IP.

[–] [email protected] 3 points 9 months ago* (last edited 9 months ago) (1 children)

That sounds cool. I've never messed with scripts on Mikrotik, but would it be possible to share what you have?

I'm guessing a relatively short DHCP lease time is also in play so devices can get the new DNS address? Or do you have Mikrotik set as the DNS server?

[–] WindowsEnjoyer 2 points 9 months ago (1 children)

I've edited my comment. It contains my used script.

load more comments (1 replies)
load more comments (4 replies)
[–] [email protected] 5 points 9 months ago (2 children)

I have my pi-hole setup as the upstream DNS in my router, with cloudflare as a secondary DNS. That way, all my devices always use the router for DNS (since that's what is advertised in my DHCP) and the router then uses pi-hole if it's available, or cloudflare if it isn't. But the individual device doesn't get to choose between different servers.

[–] taladar 8 points 9 months ago (1 children)

The vast majority of devices that allow setting multiple DNS servers do not strictly prioritise one over the other even if they label it as primary and secondary.

[–] [email protected] 2 points 9 months ago (1 children)

That's why I don't let every device decide individually. I know my router (FritzBox) prioritizes the pi-hole (it's even called "preferred" and "alternative" DNS-Server in the UI)

load more comments (1 replies)
[–] [email protected] 5 points 9 months ago* (last edited 9 months ago) (2 children)

~~Use something like AdGuard or NextDNS as your secondary resolver~~

Check out the comment by @[email protected]

[–] [email protected] 9 points 9 months ago (1 children)

Primary and secondary dns is not a thing. There is no priority for DNS. Depending on the device it will use ether address and will only try the other on failure.

[–] [email protected] 2 points 9 months ago (2 children)
[–] [email protected] 4 points 9 months ago

Yeah, that's how they are named, my experience showed that the devices used whichever of the two they wanted.

load more comments (1 replies)
[–] Gooey0210 4 points 9 months ago (4 children)

That's why you usually have two piholes, or adguard homes

And can even synchronize them

load more comments (4 replies)
[–] [email protected] 4 points 9 months ago

I use Nextdns for this reason. DNS is critical for Wife Acceptance Factor

[–] dream_weasel 3 points 9 months ago (1 children)

Ssh to pihole. $ pihole restartdns usually works for me

load more comments (1 replies)
[–] [email protected] 3 points 9 months ago* (last edited 9 months ago) (1 children)

You mentioned you have an Asus router. Which one? Why not move to hosting your stuff on the router? https://www.snbforums.com/forums/asuswrt-merlin.42/ Sure it doesn't completely solve the issue but in my experience it's incredibly stable, and more so people expect to restart the router if the Internet isn't working which simplifies things too. Also beneficial is that you can give different clients different DNS servers comfortably.

Specifically, check out https://diversion.ch/ for dns blocking but its capable of a lot more.

load more comments (1 replies)
[–] [email protected] 2 points 9 months ago

I have Pihole in a Proxmox LXC Container that does just that. Just Pihole. It is set to automatically restart.

All for that Reason that you just named.

load more comments
view more: next ›