The Goal & Constraint

I wanted network-level ad and tracker filtering for my own PC and iPhone without changing the router's global DNS settings for everyone else on the home network.

Running Pi-hole inside Podman on my Fedora server kept it isolated from the rest of the host while forcing me to configure SELinux and firewalld properly.

Network Setup & Firewalling

First, I reserved a static LAN IP for the Fedora host via DHCP reservation on my router so endpoints never lose track of the DNS server across reboots.

On the Fedora host, I kept a default-deny posture in firewalld and explicitly exposed only DNS (53/tcp and 53/udp) plus port 8080 for the Pi-hole web UI.

firewalld allowlist
sudo firewall-cmd --permanent --add-service=dns
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

Podman Isolation & SELinux (:Z)

Podman places containers on an internal virtual bridge subnet behind NAT, and Fedora's SELinux blocks unlabeled bind mounts by default. Without relabeling the mount, Pi-hole cannot write its config or gravity database.

Adding :Z to the volume mount scopes the SELinux label to that container, and setting FTLCONF_dns_listeningMode="ALL" lets Pi-hole answer LAN queries routed across Podman's virtual bridge.

Podman launch flags (key options)
podman run -d --name pihole \
  --restart unless-stopped \
  -p 53:53/tcp -p 53:53/udp -p 8080:80/tcp \
  -e FTLCONF_dns_listeningMode="ALL" \
  -v ./etc-pihole:/etc/pihole:Z \
  docker.io/pihole/pihole:latest

Verification & Real-World Gotchas

I verified resolution directly with nslookup against the Fedora host, confirming normal domains like google.com resolved cleanly while ad and tracker domains like doubleclick.net returned 0.0.0.0.

Testing on real Windows and iOS clients surfaced three practical lessons that rarely show up in textbook DNS diagrams:

  • Alternate DNS is NOT a passive backup: OS resolvers query primary and secondary servers concurrently, so leaving a public secondary DNS leaks queries around Pi-hole.
  • Browser DNS-over-HTTPS (DoH) and Apple iCloud Private Relay / Limit IP Address Tracking tunnel DNS over HTTPS (port 443), bypassing local port 53 filtering unless disabled on the local network.
  • Podman's NAT bridge plus SELinux enforcing require intentional firewall, listening-mode, and :Z volume configuration.