Block Ads Network-Wide With Pi-hole on a Raspberry Pi

· 2 min read raspberry-pipi-holednsnetworkingadblock

Pi-hole acts as the DNS server for your whole network, refusing to resolve domains known to serve ads and trackers. One Pi protects phones, laptops, TVs, and smart-home gadgets without installing anything on them. Most pages load faster because ad requests die instantly.

What you need

  • Any Raspberry Pi with a wired or stable wireless connection; a Pi Zero 2 W is enough
  • 8 GB+ microSD card flashed per [[raspberry-pi-headless-setup]]
  • Router admin access to change its DHCP DNS setting
  • Static IP address reserved for the Pi on your router

Step by step

  1. Reserve a static IP for the Pi in your router's DHCP settings, for example 192.168.1.10, so devices can always find it.
  2. SSH into the Pi and download the installer with curl -sSL https://install.pi-hole.net | bash.
  3. Accept the defaults in the text wizard, choosing your upstream DNS provider (Cloudflare or Quad9 are solid choices) and enabling the default blocklists.
  4. Note the web admin password shown at the end; reset it anytime with pihole -a -p.
  5. Log into the web dashboard at http://your-pi-ip/admin to confirm queries are flowing once clients start using it.
  6. Point your router's DHCP scope at the Pi: set the DNS server handed out to clients to the Pi's IP. Some routers call this "DNS server" under LAN/DHCP settings.
  7. Alternatively, set DNS manually on individual devices or run Pi-hole as the router's DHCP server itself, which the wizard can configure.
  8. Flush client DNS caches (reconnect Wi-Fi on a phone) and visit an ad-heavy site to confirm blocking; check the dashboard query log turning red blocks.
  9. Whitelist false positives from the Query Log screen; common casualties are analytics domains some shopping carts depend on.

Common mistakes

  • Changing DNS on the router's WAN side instead of the DHCP/LAN side, which only affects the router itself, not clients.
  • Blocking your own network's device-name resolution: keep conditional forwarding enabled for local hostnames.
  • Using the Pi over flaky Wi-Fi; if the Pi drops, the whole network loses name resolution until clients fall back.
  • Never updating: run pihole -up every couple of months.

Related guides

The Pi doing this job pairs naturally with [[raspberry-pi-network-storage]] or [[raspberry-pi-media-center-kodi]] on separate hardware, or combined on one Pi 4. If you have not yet flashed a card, start with [[raspberry-pi-headless-setup]].