Home lab

A house-wide ad blocker on a Raspberry Pi

← All guides

Who it is for

This is for someone who wants fewer ads and trackers on phones, TVs, and smart speakers without installing an extension on every device. You should be willing to change one DNS setting on the router. You do not need to write firewall rules. If the only computer you care about is a laptop you carry to other networks, a browser extension is simpler. Pi-hole earns its keep when it stays on, at home, for everything.

Source tutorial: Block EVERY Online Ad with THIS - Pi-Hole on Raspberry Pi.

Parts list

  • A Raspberry Pi 4 or Raspberry Pi 5. Use the Ethernet jack. A smaller board can run the software, but a wired board is the one worth leaving on.
  • The official power supply for that model. Phone chargers brown out and corrupt the card.
  • A microSD card, 16 GB or larger, from a brand you can return.
  • A small case for the Pi.
  • A short Ethernet cable from the Pi to the switch or router.
  • A mini switch if the router has no free port.

No hat is required.

Steps

  1. Install Raspberry Pi Imager from https://www.raspberrypi.com/software/. Write Raspberry Pi OS Lite (64-bit). Set a hostname, a username, and a password, and turn SSH on. Do not set Wi-Fi. This box should be wired.
  2. Boot it on Ethernet. On the router, reserve that address so it cannot change next week. Clients will be told to use this address for every name lookup.
  3. Update the Pi, then run the one-step install documented at https://docs.pi-hole.net/main/basic-install/:

    curl -sSL https://install.pi-hole.net | bash

    That page also shows how to clone the repository or download the script and read it before you run it. In the prompts, choose an upstream resolver and leave the web interface enabled. Set a password when asked. The installer prints the admin URL. Use that URL. Do not guess a path.

  4. From a computer on the same network, open the admin URL and confirm that queries are arriving.
  5. In the router, set the LAN DNS server to the Pi and remove any second public DNS server. A second server lets devices skip the blocker. The post-install notes are at https://docs.pi-hole.net/main/post-install/. If the router cannot set DNS, you may use Pi-hole's own DHCP, but only after DHCP on the router is off. Two DHCP servers on one LAN will fight.
  6. Load a busy site from a phone and look at the query log. If a site you need breaks, allow that domain. Do not turn the whole blocker off and leave it off.

Caution

Do not publish the admin page on the internet, and do not pull power while the card is writing.

Want this done for your office?

The quote is free and human-written, from the engineer who would do the work. Websites are remote-friendly across the US. WiFi, and Apps & AI, are local to Nashua, southern New Hampshire, and northern Massachusetts.

Get a free quote

The weekly note

A short email on tech and the home lab, from the same engineer. Confirm from your inbox before the first issue. Unsubscribe whenever you want.