←
Homelab / DevOps

Network-Wide Ad Blocking: Pi-hole v6 on Docker (OMV 7) and a FRITZ!Box 7530

How I extended the Gen8 MicroServer with a DNS sinkhole: freeing port 53 from systemd-resolved, volumes on RAID 1, the dashboard on 8081 and FRITZ!Box DHCP, plus a two-minute recovery plan.


In my previous article I described how I turned an HP ProLiant MicroServer Gen8 into a private cloud with OpenMediaVault 7, Docker and Cloudflare Tunnel: Nextcloud, Collabora and Vaultwarden, with data on two mechanical drives in RAID 1 and the OS on an internal USB stick.

That machine runs 24/7, and once the “productive” services were in place the next question came naturally: can I use it to clean up my home network too? Phones, laptops, smart TVs and IoT devices all go through the same router, and all of them, to varying degrees, ask for ads, trackers and telemetry. A DNS sinkhole like Pi-hole v6 is the most effective way to intercept them all at once, without installing anything on each device.

Dropping it into an existing production stack, however, is not a docker run away. Port 53 is already taken by the system resolver, the dashboard has to fit between OMV and Nextcloud, and LAN clients must be allowed to query the container. This guide covers how I solved those three problems and what I learned in the first days of use.


1. The Port 53 Conflict: Freeing systemd-resolved

On Debian 12 the systemd-resolved daemon listens on 127.0.0.53:53 through a stub listener by default. As long as that socket is taken, Pi-hole cannot bind port 53 and Docker stops with a rather unhelpful error:

Error response from daemon: driver failed programming external connectivity on endpoint pihole:
Bind for 0.0.0.0:53 failed: port is already allocated

Uninstalling systemd-resolved looks like the quick fix, but it is the wrong path: OMV and the other host services still rely on name resolution, and without a resolver the server loses outbound connectivity. The correct fix is to disable only the stub listener and let the host query the upstream servers directly:

# 1. Disable the stub listener, keeping a backup of the original file
sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf

# 2. Point resolv.conf at the file generated by resolved, with the real upstreams
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

# 3. Restart the service to apply the changes
sudo systemctl restart systemd-resolved

With the stub disabled, /etc/resolv.conf must no longer point to 127.0.0.53, otherwise the host keeps looking for a resolver that no longer answers.

The standard port must be free: if this command prints nothing, it can be handed to Pi-hole.

sudo ss -tulpn | grep :53

2. Pi-hole v6 in an Existing docker-compose.yml

As with Nextcloud, I applied two rules that are non-negotiable on the Gen8.

Zero wear on the boot USB stick. Pi-hole writes constantly to the gravity database and to query logs. If that data landed on the USB drive, the stick would be the first component to give up within a few months. That is why the /etc/pihole volume is mapped to the mechanical drives in RAID 1, where continuous writes are business as usual.

Web port isolation. Ports 80 and 8080 are already taken by OMV and Apache/Nextcloud, so the Pi-hole v6 dashboard is exposed on 8081. In v6 the internal web server listens on container port 80, hence the 8081:80 mapping.

Then there is a Docker detail: containers live on a private bridge network, and by default Pi-hole would only accept queries from that subnet. Home clients come from outside it, so FTLCONF_dns_listeningMode=all is required.

  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8081:80/tcp"
    environment:
      - TZ=Europe/Rome
      # Dashboard password, read from the .env file next to the compose file
      - FTLCONF_webserver_api_password=${PIHOLE_PASSWORD}
      # Accept queries from the whole LAN, not just Docker's bridge network
      - FTLCONF_dns_listeningMode=all
    volumes:
      # In v6 everything lives here: pihole.toml, the gravity database
      # and custom dnsmasq configuration (/etc/pihole/dnsmasq.d)
      - /srv/dev-disk-by-uuid-<disk-uuid>/appdata/pihole:/etc/pihole

The compose file has no /etc/dnsmasq.d volume. That is not an oversight: in v6 custom dnsmasq configuration moved under /etc/pihole/dnsmasq.d, which makes the old mount pointless. Mounting only /etc/pihole also means a backup of that folder really contains the whole configuration, with no pieces scattered elsewhere.

The password should not be written in plain text in the compose file: I pass it as an environment variable, so the YAML can be shared without leaking credentials. The value is exported in the shell the compose command runs from.

# Before startup: the password stays out of the YAML file
export PIHOLE_PASSWORD='<strong-password>'

At this point startup is the usual one, with an eye on the first boot logs:

docker compose up -d pihole
docker compose logs -f pihole

Once the container is ready, the dashboard answers on http://192.168.1.10:8081/admin. If the password is lost, it can be reset from the terminal without recreating the container:

docker exec pihole pihole setpassword

3. DHCP Propagation on the FRITZ!Box 7530

You can set Pi-hole as the DNS server directly in the router’s WAN configuration. It works, but it is the wrong perspective. All home traffic would appear to come from the gateway IP, logs would collapse into one repeated line, and Group Management would lose its meaning, because a phone and a smart TV would no longer be distinguishable.

The right path is to distribute Pi-hole to clients over DHCP, so each device queries the sinkhole directly and its real IP shows up in the Query Log.

In my setup the FRITZ!Box is at 192.168.1.1 and the MicroServer has a static IP, 192.168.1.10.

  1. Open the FRITZ!Box interface.
  2. Go to Home Network > Network > Network Settings (advanced settings).
  3. Open the IPv4 tab.
  4. Leave the IPv4 address field untouched.
  5. Scroll down to the DHCP section and change only the Local DNS server field, entering 192.168.1.10.
  6. Apply and confirm by pressing a physical button on the router.

Clients that are already connected keep using the DNS server they received earlier until their lease expires. To see the effect immediately, toggle Wi-Fi on the phone or renew the lease from the PC.

Two limits I ran into on my own network, worth knowing before hunting for bugs that do not exist:

  • IPv6. The FRITZ!Box also advertises its own IPv6 resolvers to clients. If a device prefers IPv6, it may keep asking the router for names and bypass Pi-hole. It is worth checking the IPv6 section of the network settings and aligning it if needed.
  • Devices with hardcoded DNS. Some gadgets (Chromecast, certain smart TVs, part of the IoT fleet) ignore the DHCP-provided DNS and use public resolvers baked into the firmware. They are a minority, but they are exactly the devices that generate the most telemetry.

4. Beyond Ad Blocking

Once queries start flowing, Pi-hole stops being a simple blocklist and becomes a control point over the network. The features I found most useful:

  • Local DNS Records. Under Local DNS > DNS Records you can map memorable names to container IPs. With nas.lan pointing at 192.168.1.10, typing addresses and ports in the browser is over, and setting up a reverse proxy becomes much more convenient too.
  • Targeted blocklists. The default list already covers a lot, but smart TV telemetry needs specific lists. firebog.net remains the reference for figuring out which lists are safe and maintained. The trade-off is always the same: more lists mean more false positives and slower gravity rebuilds.
  • Group Management. The kids’ tablet can get a very aggressive block, the work PC a looser policy. You create groups, assign clients and apply different rules without touching the global configuration.
  • Handling false positives. When a link in a newsletter does not open, the Query Log shows the red row for the blocked domain: whitelist it from there and the problem is solved for the whole network in two clicks.

5. Emergency Plan: When the Server Goes Offline

One scenario is worth deciding on beforehand, not during the outage. With Pi-hole as the only resolver handed out via DHCP, if the MicroServer powers off or hangs, nobody in the house can browse anymore: devices show the classic “connected, no internet” and it looks like an ISP problem.

Manual recovery takes less than two minutes:

  1. Open the FRITZ!Box at http://192.168.1.1.
  2. Go back to Home Network > Network > IPv4.
  3. Scroll to the bottom and set the Local DNS server field to the router’s own address, 192.168.1.1.
  4. Save and confirm on the router.

From that moment clients fall back to the ISP resolvers and browsing resumes, just long enough to repair or reboot the server.

Two things I worked out by thinking through this scenario:

  • A public secondary DNS is a trap. It looks like the obvious fix, but clients pick a resolver non-deterministically: some queries would end up on 1.1.1.1 or 8.8.8.8, bypassing the block and splitting the statistics. A single resolver and a clear procedure are better.
  • The router as secondary is a trade-off, not a free fallback. Configure it as a second DNS and the network keeps working when the server is down, but a share of queries goes through the router unfiltered. That is acceptable only if you accept the degradation and monitor it.

The rest is operational discipline: a UPS on the Gen8, regular backups of /srv/dev-disk-by-uuid-<disk-uuid>/appdata/pihole, and recovery instructions saved offline too, because when the outage hits, the dashboard containing them is precisely the thing that is not answering.


6. Takeaways

Pi-hole is one of those projects where the value is not in the complexity but in the layer it targets: a single layer, DNS, that every device in the house is forced to cross. It needs no agents, certificates or per-device configuration, which makes it far more manageable than any individually installed ad blocker.

On the Gen8 the impact was marginal: the container settles at a few hundred MB of RAM, the CPU stays essentially idle, and the added name resolution latency is imperceptible, not least because Pi-hole’s cache answers most repeated queries locally. The surprising number is not resource usage but the share of DNS traffic being blocked: most of it comes from smart TVs, mobile apps and telemetry domains, not from the sites actually being visited.

The most useful lesson, though, is not about Pi-hole. Adding a single point of name resolution means you have put an infrastructure component into production: it must be treated as such, with a written recovery plan, a configuration backup, and the awareness that the home network now depends on that machine. The rest is convenience: a quieter network, logs that are finally readable, and the satisfaction of seeing how many pointless requests are stopped before they leave the house.

Found this article helpful?

If this guide saved you some debugging hours or sparked a new idea, you can support my open-source writing by buying me a coffee.

Support me on Ko-fi