Installing Pi-hole on Raspberry Pi Zero 2W: Blocking Ads and Telemetry with a RPi!


If you’ve ever felt like you’re being watched online, well, you probably are. Ads, trackers, and all that “helpful” telemetry lurk behind every webpage and app. Online advertising and telemetry have become an unavoidable part of daily browsing and device use. Nearly every website and app now tracks your activity and serves ads (not this one…), often at the expense of your privacy and network performance. Fortunately, there are practical solutions to minimize or block these unwanted intrusions for your entire home network.

Pi-hole is a popular network-wide ad blocker that works as a DNS sinkhole, blocking requests to advertisement and tracking domains before they load. All it takes is a low-powered device, like a Raspberry Pi, to set up your own Pi-hole server. While any Raspberry Pi model will work for this project, the Raspberry Pi Zero 2W, with an ethernet hat and suitable case, is particularly appealing for its compact size and quiet operation. For a standalone Pi-hole setup, larger and more powerful models are generally unnecessary.

raspberry-pi-zero-2w

Raspberry Pi Zero 2W

I prefer to run Pi-hole on a dedicated Raspberry Pi, especially because I also use it as my network’s DHCP server. This setup separates Pi-hole from other experiments or services, increases reliability, and makes network management more straightforward.

In this guide, I’ll show you how to install and configure Pi-hole on a Raspberry Pi Zero 2W, optimize your Pi-hole setup, and help your entire network benefit from faster browsing and stronger privacy.

Before we dive in, make sure to grab a quality SD card (don’t cheap out or you’ll regret it when it fails), and find a spot for your Pi that’s near your router. Ethernet is king here, trust me, wireless can be flaky, and Pi Zero’s WiFi is nothing to brag about.

No fluff, no drama, and no telling my life story before the recipe 🤷🏻‍♂️

Let’s do this.

Step 1: What You Need

  • Raspberry Pi Zero 2W (or really, any RPi you have handy)
  • Ethernet hat/case (for a stable connection)
  • High-quality microSD card (16GB+ is fine; beware cheap no-name brands)
  • Power supply (Try to use official one, this device will be working 24/7)
  • Router access (To tie things together)
  • Optional: Monitor and keyboard (but SSH is way easier)

Pro-tip: SD cards have a lifespan. Set reminders for periodic backups or image clones. Future you will thank you (or me).

raspberry-pi-zero-2w-ethernet-hat

Raspberry Pi Zero 2W Ethernet Hat

Step 2: Flashing the Raspberry Pi OS

  1. Download Raspberry Pi Imager
    Get it from here.

  2. Choose OS
    Go for the Raspberry Pi OS Lite (you do NOT need the desktop version). Less bloat, more stability.

    raspberry-pi-imager-config

  3. Set Device Name
    Name it something memorable like pihole. Helps with SSH later.

    raspberry-pi-imager-device-name

  4. Network Setup

    • Ethernet: If using Pi Zero 2W + ethernet hat, disable WiFi during imaging (they sometimes fight).
    • SSH: Enable it. And choose passwords authentication.

    raspberry-pi-imager-ssh-setting

  5. Write to SD Card
    Fire it up and wait until it’s done.

Step 3: Getting the Pi on Your Network

  1. Plug in the SD card and power up your Pi.

  2. Wait 2-3 minutes to boot up.

  3. SSH in:

    ssh pi@pihole.local
    # or using IP if you've configured it
    ssh pi@<IP_ADDRESS>

    pi here before ”@” is your user name, and pihole after ”@” is the device name you have decided.

    If this doesn’t work, use a monitor/keyboard once, or hunt down its IP on your router admin page.

  4. Update Everything

    sudo apt update && sudo apt upgrade -y
    sudo reboot

    After rebooting, SSH back in.

  5. Find Your Pi’s IP Address

    hostname -I

    Note this down. You’ll need it a lot.

  6. Assign a Static IP (Important!)
    Go to your router’s admin panel (usually 192.168.1.1 or similar).

    • Find the “DHCP Reservation” or “Static Lease” section.
    • Assign your Pi’s IP (from previous step) so it doesn’t change and break your ad-blocking.

Tip: Every router looks different, but it’s generally in the LAN or DHCP settings.

Step 4: Installing Pi-hole

Now, the fun part. SSH into your Pi and run:

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

raspberry-pi-pihole-installation

You’ll get the legendary blue terminal menu. Here’s what to watch for:

  1. Static IP Address: Double check you have reserved the IP address for the Raspberry Pi.

raspberry-pi-pihole-installation

  1. Upstream DNS Provider:
    Choices like Cloudflare, Google, OpenDNS. Pick your favorite. It’s what Pi-hole will use to resolve non-blocked sites.

  2. Blocklists:
    Defaults are good for a start. We’ll supercharge these later.

You can enable query logging for better maintenance

I tend to choose Show Everything for Privacy Mode for FTL

  1. Web Admin Password:
    Write it down or copy/paste to a safe spot.

raspberry-pi-pihole-installation

  1. Finish Installation.

  2. Using Pi-hole as DHCP Server:

    • You should go on and change your router’s DHCP address with the IP address of Raspbery Pi. (This is what I do!)
    • You can also control this manually and set DNS per device.

First Time Logging in

  • Go to http://<Pi-IP-address>/admin
  • Log in using the password you saved earlier.

If you forget the password, no worries! SSH into the Pi and run:

pihole -a -p

Follow prompts to reset it.

Step 5: DHCP and Network Configuration

If Pi-hole is handling DHCP:

raspberry-pi-pihole-dhcp

  1. Enable DHCP in Pi-hole
    Go to Settings > DHCP. Enable it, set your IP range.
  2. Disable DHCP on Your Router
    Every router brand is different, but look under LAN or DHCP settings.

If using your router’s DHCP:

  • Simply set your Pi-hole as the DNS for each device.

    • Windows: Network & Internet Settings → Change Adapter Options
    • macOS: Network Details → DNS
    • Android/iOS: WiFi → Advanced

Result: Devices now send DNS queries through Pi-hole!

Step 6: Supercharge Your Blocklists

The default blocklists are decent, but why stop there? For more comprehensive blocking, check DNS Blocklists.

  • Click “Group Management > Adlists” in Pi-hole’s admin panel.
  • Add new URL(s) from the this repo.
  • Refresh Gravity:
    After adding lists, go to Tools > Update Gravity or run:
    pihole -g

raspberry-pi-pihole-gravity-pull

Step 7: Testing and Monitoring

raspberry-pi-pihole-dashboard

Visit an Ad-Heavy Site, open a browser and head to a news or blog site notorious for ads. See fewer or no ads? Success!

Check the Pi-hole Dashboard, watch as queries, blocks, and client stats roll in! See which devices are the chattiest, and which domains get blocked most. After I started using Pi-hole, I’ve learned that my dear washing machine is like a whale in a ocean, singing non-stop to make itself heard!

raspberry-pi-pihole-bloacked-traffic

Final Tips and Ongoing Maintenance

  • Whitelisting: Occasionally, a site or service you want to use gets blocked. Use the dashboard to whitelist individual domains.
  • Keep Updating: Run sudo apt update && sudo apt upgrade on your Pi-hole Pi every so often.
  • Try New Blocklists: Experiment with more privacy filter lists. Just don’t get too aggressive, or you might break things you need.
  • Backups: SD cards do fail. Clone your card or backup the Pi-hole config regularly.

Enjoy Ad-free Browsing! Sit back and enjoy the peace and quiet of an ad-minimized internet.

Conclusion

Running Pi-hole on a Raspberry Pi Zero 2W (with Ethernet) is cheap, compact, and deadly effective against ads and creepy telemetry. Once set up, it quietly protects anything on your network, no browser extensions required.

Just remember: network-level ad-blocking is only as good as its blocklists, so keep checking Pi-hole repositories for updates and new tricks. Your future self and your network will thank you.

Pi-hole official website
r/pihole
Repo for Pi-hole

Let me know if it works for you!

Cheers,

berkem