> ## Content Index
> Fetch the complete content index at: https://www.adamsooley.ca/llms.txt
> Use this file to discover other available public pages before exploring further.

# Pi-hole on a Raspberry Pi, and why you should have two
- URL: https://www.adamsooley.ca/pi-hole-on-a-raspberry-pi-and-why-you-should-have-two/
- Published: 2026-09-13T15:20:00.000Z
- Updated: 2026-09-13T15:26:58.000Z
- Description: Pi-hole is one of those wonderfully boring pieces of technology that you install once and then mostly forget about, until you look at how much advertising, tracking and other nonsense it has quietly blocked. In this post, I explain how I run Pi-hole on a Raspberry Pi, why I keep it off unRaid.
- Author: Adam Sooley
- Tags: Technology, HowTo

## What is Pi-Hole?

Pi-hole is a free, open-source DNS sinkhole and network-level advertisement blocker that protects all devices on a private network without requiring client-side software. It functions by intercepting DNS queries from connected devices such as smartphones, smart TVs, and IoT gadgets and comparing them against community-maintained blocklists of known ad, tracker, and malware domains. 

If a requested domain matches a blocklist, Pi-hole returns a null response (often 0.0.0.0), effectively preventing the device from loading the unwanted content. This approach blocks ads and telemetry at the gateway, which can improve network performance, reduce bandwidth consumption, and enhance privacy across the entire local network. 

## Where this started

In my other post ([Taking back my digital life: Building my own Canadian home cloud](https://www.adamsooley.ca/taking-back-my-digital-life-building-my-own-canadian-home-cloud/)), I talked about moving more of my digital life away from big cloud companies and onto hardware that I actually own. I've got unRaid running a whole collection of services:

- Immich
- Home Assistant
- Nextcloud
- Mealie
- Frigate
- Ghost
- Pi-hole

Well, I've changed my mind about one of those, I'm not running my primary Pi-hole on unRaid anymore. Instead, I've moved Pi-hole onto a Raspberry Pi. I've actually moved it onto two Raspberry Pi's and there's a very good reason for that.

## DNS is more important than you think

> Most people probably don't think about DNS.

You type google.ca into your browser amd the website appears, magic, except it isn't magic. Before your computer can connect to google.ca, something needs to translate that friendly name into an IP address.

That's DNS. Think of DNS as the phone book for the internet. Instead of remembering: Googee.ca's IP address today your computer asks a DNS server Hey, where is google.ca? The DNS server answers with the IP location of google.ca then your computer connects to it. You probably don't even notice it happening and that's exactly why DNS is so important. When DNS stops working, a lot of things suddenly look broken. 

Your internet connection might technically still be working, your Wi-Fi might still be working, your router might still be working, your unRaid server might still be running but your family will tell you THE INTERNET IS DOWN! and technically it isn't. DNS is down.

## Why pi-hole?

Pi-hole is a network-wide DNS sinkhole. Instead of every device in my house going directly to whatever DNS server happens to be configured, I can tell my network to ask Pi-hole first and Pi-hole will check the request. If it's a normal website, it forwards the request to an upstream DNS provider. If it's an advertising or tracking domain on its blocklists, Pi-hole can simply refuse the request. 

That means I don't need to install an ad blocker individually on every:

- Laptop
- Phone
- Tablet
- Smart TV
- Streaming box
- IoT device
- Home Assistant device

One DNS server can handle it for the whole network. 

## Why not just run pi-hole on unRaid?

That's exactly what I did originally and it works and there's absolutely nothing wrong with running pi-hole in Docker on unRaid but eventually I realized I had created a problem.

My unRaid server was becoming the centre of everything with pi-hole running on it but controlling access to the internet for everything.

Look at my setup:

```Starting
                 INTERNET
                    │
                 ROUTER
                    │
                  Pi-hole
                    │
                 UNRAID
        ┌─────────┼──────────┐
        │           │           │
      Immich     Home Ass    Pi-hole
        │           │           │
     Nextcloud   Frigate       Ghost
        │         
      Mealie     

```

Now imagine something happens to unRaid, maybe:

- The server reboots.
- Docker crashes.
- I'm doing maintenance.
- A drive has a problem.
- I'm upgrading hardware.
- I accidentally break something.
- I completely screw up a configuration.

Whatever the reason, Pi-hole goes down and now I've got a problem. My DNS server is running on the machine that I'm trying to troubleshoot.

> This did happen: server crashed, while I was at work and my wife was working at home. Hence the reason for the change. 

## The raspberry pi solution

Enter the Raspberry Pi. A Raspberry Pi is almost perfect for this job. It's small, cheap, quiet, low power, reliable, and most importantly it doesn't need my unRaid server, that's the key.

My DNS infrastructure is now completely independent of my application server. If I shut down Unraid for four hours to work on it, the internet in my house doesn't care, Pi-hole keeps running.

## Why I run two

DNS is one of the things you really don't want to lose, as I learn the hard way. Your router can be working your internet connection can be working, your Wi-Fi can be working, your servers can be working, but if every device is configured to use a DNS server that's unavailable, your network experience can become a disaster, so I run two Pi-hole servers.

### Pi-hole #1

My first Raspberry Pi is the primary DNS server.

Something like:

```text
Raspberry Pi #1
       │
    Pi-hole
       │
   Primary DNS

```

Every device on my network can use it.

### Pi-hole #2

The second Raspberry Pi is the backup.

```text
Raspberry Pi #2
       │
    Pi-hole
       │
 Secondary DNS

```

It's configured with the same blocklists and general settings.

If Pi-hole #1 disappears, pi-hole #2 is still there.

### What happens when one goes down?

My DHCP server/router can provide two DNS servers to clients.

For example:

```text
Primary DNS:
192.168.1.10

Secondary DNS:
192.168.1.11

```

My devices receive both.

So conceptually:

```text
             HOME NETWORK
                  │
          ┌───────┴───────┐
          │               │
     Pi-hole #1       Pi-hole #2
       PRIMARY          BACKUP
          │               │
          └───────┬───────┘
                  │
              INTERNET

```

If the first server becomes unavailable, clients can use the second.

That means I can:

- Reboot Pi #1
- Update Pi #1
- Replace Pi #1
- Troubleshoot Pi #1
- Accidentally break Pi #1

without taking down DNS for the whole house.

## My ideal setup

I'd rather have:

```text
                     INTERNET
                        │
                     ROUTER
                        │
              ┌─────────┴─────────┐
              │                   │
        Raspberry Pi #1     Raspberry Pi #2
           Pi-hole             Pi-hole
              │                   │
              └─────────┬─────────┘
                        │
                    HOME LAN
                        │
       ┌────────────────┼────────────────┐
       │                │                │
     Wi-Fi            Wired           IoT
       │                │                │
    Phones           Computers       Smart Home

```

And then separately:

```text
                    UNRAID
                      │
        ┌─────────────┼─────────────┐
        │             │             │
     Immich      Home Assistant   Ghost
        │             │             
    Nextcloud       Frigate        
        │
      Mealie

```

Now I've separated two very different functions.

> DNS infrastructure from Application infrastructure.

## Setting up pi-hole on a raspberry pi

The actual installation is surprisingly easy. Start with a Raspberry Pi and I'd recommend a Pi 3, Pi 4 or Pi 5, although you don't need anything particularly powerful for Pi-hole.

You'll also need:

- Raspberry Pi
- microSD card
- Power supply
- Ethernet cable
- Network connection
- Optional USB battery backup or UPS

I'd strongly recommend Ethernet rather than Wi-Fi. DNS is infrastructure and infrastructure should be boring, boring is good, boring is my slogan. 

### Install raspberry pi OS

[Download Raspberry Pi OS](https://www.raspberrypi.com/software/operating-systems/?ref=adamsooley.ca) and write it to the microSD card. A lightweight Raspberry Pi OS installation is more than enough. 

Give the Pi a hostname, something like: 

```
pihole01

```

 and for the second one:

```
pihole02

```

Once it's running, update it:

```bash
sudo apt update
sudo apt full-upgrade -y

```

Then reboot if required.

### Give It a Stable IP Address

Your DNS server needs a predictable IP address. You don't want your router giving Pi-hole a different address every few days. There are two common approaches.

- You can configure a static IP on the Raspberry Pi.
- Create a DHCP reservation on your router.

For example:

```text
pihole01
192.168.1.10

pihole02
192.168.1.11

```

The router sees the Pi's MAC address and always gives it the same IP.

### Install pi-hole

Pi-hole provides an official installation process in its [documentation](https://www.raspberrypi.com/documentation/?ref=adamsooley.ca).

The installer walks you through:

- Network interface
- Static IP configuration
- Upstream DNS provider
- Blocklists
- Web interface
- DNS configuration

The [official documentation ](https://www.raspberrypi.com/documentation/?ref=adamsooley.ca)should always be your first stop because installation commands and supported platforms can change over time. Once installed, you'll have the Pi-hole web interface and suddenly you've got a DNS server.

## Configure your router

Installing Pi-hole doesn't automatically make your entire network use it. Your router's DHCP settings need to tell clients which DNS servers to use.

For example:

```text
DNS Server 1:
192.168.1.10

DNS Server 2:
192.168.1.11

```

Now when your laptop joins the network, it receives those DNS settings automatically. Same with your phone, your TV, your smart-home devices and no individual configuration required.

## Configure both pi-holes

The two Pi-holes should have essentially the same configuration.

That means keeping the following synchronized:

- Blocklists
- Allow lists
- Local DNS entries
- DNS settings
- Custom rules

Pi-hole's current versions provide mechanisms for managing and synchronizing configuration, but the exact approach depends on the Pi-hole version and the configuration you want to replicate. The important thing is to not forget about Pi-hole #2.

A backup DNS server that hasn't been updated in two years isn't much of a backup.

## Test it

Once everything is configured, check your clients. You want to see DNS queries appearing in the Pi-hole dashboard. Then test the second server.

Stop Pi-hole #1 or temporarily disconnect the first Raspberry Pi from the network.

Your network should continue operating through Pi-hole #2.

Then bring #1 back.

That's the test that matters.

Don't wait until your wife, and kids or whoever uses your network tells you: 

> The internet isn't working.

## The best part is how boring it is

And this brings me back to my favourite word, boring. DNS shouldn't be exciting, my DNS server should sit there, quietly, every day, answering requests, blocking garbage, and otherwise doing absolutely nothing interesting.

If you're running a [home server](https://www.adamsooley.ca/taking-back-my-digital-life-building-my-own-canadian-home-cloud/), I'd seriously consider putting Pi-hole somewhere other than the home server itself and a Raspberry Pi is perfect, and two gives you redundancy.