← All guides

Pi-hole in the home lab: network-wide DNS filtering, set up properly

Networking · 8 min read

Single-board computer with a heatsink wired by ethernet cable to a home router on a wooden desk
One small always-on box answering DNS for the whole house.

Every device in your house asks the same question hundreds of times a day: "what is the address for this name?" That question goes to a DNS server, and whoever answers it sees, and can shape, a surprising amount of your network's behavior. Pi-hole is a DNS sinkhole you run yourself: devices send it their DNS queries, it answers the legitimate ones, and it refuses the ones asking for known ad and tracker domains. Because it works at the DNS level, it also covers the places a browser extension cannot reach, mobile apps, smart TVs, and the chatty gadgets on your network that phone home at 3 a.m.

Most Pi-hole guides stop at "run the installer." That is the easy 20 percent. The other 80 percent is treating Pi-hole as infrastructure: deciding where it runs, how the network gets pointed at it, and what happens on the day it stops working. This guide covers all of it.

Where Pi-hole should run

Pi-hole is genuinely lightweight, the project's own prerequisites ask for a minimum of 2GB of free disk space (4GB recommended) and 512MB of RAM, and despite the name, it does not need a Raspberry Pi. It runs on any hardware running a supported operating system: Debian, Ubuntu, Raspberry Pi OS, Armbian, Alpine, Fedora, or CentOS Stream, in their actively maintained versions. That gives you three realistic homes for it in a lab:

OptionStrengthsWatch out for
Dedicated small board or mini PC Independent of your main server; keeps working while the hypervisor reboots; trivial power draw. One more device to patch and back up.
VM or container on your main host No new hardware; snapshots make upgrades and rollbacks easy. When the host is down for maintenance, the whole house loses DNS, plan a fallback (below).
On the router/firewall itself Nothing extra to power; sits at the natural choke point. Only viable on platforms that support it; a router problem becomes a DNS problem too.

There is no wrong answer, but there is a wrong assumption: that DNS is a minor service. The moment your router hands out Pi-hole's address, Pi-hole becomes as critical as the router itself. Choose its home with that in mind, and give it a static IP address, the project is explicit that Pi-hole needs one to function properly, and a DHCP reservation counts.

The three rollout methods, and how to choose

Installing Pi-hole does not make anything use it. The official post-install documentation describes three ways to point your network at it, and choosing correctly matters more than the install itself:

MethodHow it worksChoose it when
Router advertises Pi-hole Your router's DHCP settings hand out Pi-hole's address as the DNS server. Every device is covered automatically. Your router lets you set a custom DNS server. This is the preferred default.
Pi-hole becomes the DHCP server Pi-hole hands out addresses and points clients at itself. You must disable DHCP on the router first. Your router cannot set a custom DNS (common with ISP-supplied gear), or you want per-device query visibility.
Per-device manual DNS You set Pi-hole's address in each device's network settings by hand. You are testing with one or two devices, or a specific device needs an exception. The docs call this the last resort, and they are right.

One detail catches people out: the Pi-hole host itself does not automatically use Pi-hole after installation. If you want the host's own lookups filtered, you configure that separately, and carefully, because a host whose only DNS path runs through a broken Pi-hole is hard to repair.

Setup, step by step

  1. Pick the host and reserve its address. Install a supported OS, then set a static IP or create a DHCP reservation for it in your router. Write the address down, every later step uses it.
  2. Run the installer. On the host, run the project's one-step automated install: curl -sSL https://install.pi-hole.net | bash. If piping a script into bash makes you uneasy, a reasonable instinct, the project documents alternatives: clone the repository and run basic-install.sh yourself, download the installer first and inspect it, or use the official Docker image.
  3. Work through the installer prompts. Choose an upstream DNS provider (the resolver Pi-hole forwards allowed queries to), accept the default blocklist to start, and install the web interface. Note the admin password shown at the end.
  4. Test on one device first. Before touching the router, set a single laptop or phone to use Pi-hole's address as its DNS server manually. Browse normally. Then open the Pi-hole dashboard and watch the query log: you should see that device's queries arriving and some of them being blocked.
  5. Roll out network-wide. Using the method you chose above, point the whole network at Pi-hole. If you are switching DHCP to Pi-hole, disable the router's DHCP server first, two DHCP servers on one network is a classic self-inflicted outage.
  6. Reconnect everything. Devices pick up new DNS settings when their DHCP lease renews. Speed it up by toggling Wi-Fi or rebooting the devices you care about most, then confirm they appear in the query log.

What success looks like

Three checks, in order. First, the dashboard's query log shows queries from many different client devices, not just the one you tested with, that proves the rollout actually reached the network. Second, the dashboard shows a non-trivial share of queries being blocked, and ads disappear in places they never could before, like a smart TV's home screen or a free mobile app. Third, the check everyone skips, ordinary things still work: banking apps, work VPNs, and the streaming service your household will riot over. Live with it for a day before declaring victory, and keep the dashboard open in a tab; the first false positive (a site broken by an over-eager blocklist) is a when, not an if, and the query log is how you find and allow-list it in about a minute.

What Pi-hole will never block

Honest limits, so the tool does not get blamed for physics. Pi-hole blocks domains. An ad served from the same domain as the content you asked for cannot be separated from that content at the DNS level, this is why Pi-hole cannot block YouTube ads, a limitation the project's own community states plainly. Likewise, a device only gets filtered if it actually asks Pi-hole: an app or gadget that insists on using its own hard-coded or encrypted DNS resolver bypasses the sinkhole entirely. And DNS filtering does nothing about ads injected by the page itself or a compromised browser extension. Treat Pi-hole as a strong network-wide layer, one that removes a large class of trackers and nuisance traffic for every device at once, not as a guarantee of an ad-free life.

The failure plan: when Pi-hole is down

Here is the scenario to design for: Pi-hole stops, the board's SD card dies, a container host reboots into an update, someone trips over a cable. Every device that relies on it now cannot resolve names, which looks exactly like "the internet is down," including to the person trying to search for how to fix it. Decide your answer before rollout day. The sensible options: keep a note of the router change you made so you can revert it in two minutes; run Pi-hole somewhere independent of the machine you tinker with most; or accept a short outage as the price of a VM install and make sure the host comes back on its own after power returns. What you should not do is list a public DNS server as a "secondary" in your DHCP settings and call it redundancy, clients are free to use either server, so a share of queries will quietly bypass filtering all the time, and your query log will under-report what your devices are really doing.

FAQ

Do I need a Raspberry Pi? No. Any hardware running a supported operating system works; a VM or an old mini PC is a perfectly good home for it.

Will it slow down my browsing? Pi-hole answers from its cache for repeat queries and only forwards the rest; its documented footprint, 512MB of RAM, is smaller than a single browser tab's typical appetite. The honest answer is that DNS stops being the bottleneck.

My router won't let me change DNS. Am I stuck? No, that is exactly the case Pi-hole's built-in DHCP server exists for. Disable DHCP on the router, enable it in Pi-hole, and clients get pointed at Pi-hole as part of receiving an address.

Should I add huge blocklists right away? Start with the default list for a week. Every extra list adds false positives, and the query log from a normal week tells you what your network actually asks for, tune from evidence, not from a list-collection contest.

Next: Docker for beginners →