This guide walks you through turning a Raspberry Pi Zero (or Zero W/2 W) into a Pi-hole server. Pi-hole is a network-wide ad blocker that works at the DNS level, meaning it blocks ads and trackers for every device on your home network—phones, laptops, smart TVs, and more—before they even load. The Pi Zero’s low power draw makes it ideal for running 24/7. You’ll need a Raspberry Pi Zero, a microSD card (8GB or larger), a power supply, and a way to connect to the Pi (either a keyboard/monitor for initial setup or a USB-to-serial adapter, but the easiest method is using SSH over Wi-Fi with the Zero W/2 W).
What You’ll Need
- Raspberry Pi Zero (any variant; Zero W or 2 W recommended for Wi-Fi)
- MicroSD card (8GB or larger, Class 10 recommended)
- Micro-USB power supply (5V, 1A or higher; 2A for Pi Zero 2 W)
- USB-to-micro-USB adapter or a USB hub (for keyboard, if doing initial setup)
- HDMI adapter (if using a monitor; not required if using SSH)
- Another computer to write the SD card and access the Pi
- Ethernet adapter (for Pi Zero if you want wired; not needed for Zero W/2 W)
- Router admin access (to set DHCP to use Pi-hole)
Step-by-Step
- Download Raspberry Pi OS Lite (64-bit if your Pi Zero 2 W, otherwise 32-bit) from the official Raspberry Pi website. The Lite version has no desktop, which saves resources.
- Flash the OS to the microSD card using Raspberry Pi Imager (or balenaEtcher). In Imager, before writing, click the gear icon to set hostname (e.g.,
pihole), enable SSH, and set a password. If using Wi-Fi, enter your SSID and password. - Insert the SD card into the Pi Zero and power it on. Wait about 1-2 minutes for it to boot.
- Find the Pi’s IP address by checking your router’s DHCP client list, or use
ping pihole.local(if mDNS is enabled). - SSH into the Pi from your computer:
ssh pi@<IP_ADDRESS>(default password israspberryunless you changed it). - Update the system: run
sudo apt update && sudo apt upgrade -y. - Set a static IP address for the Pi on your router (reserve an IP via DHCP reservation) or configure it in
/etc/dhcpcd.conf. This ensures the Pi’s IP doesn’t change. - Install Pi-hole by running
curl -sSL https://install.pi-hole.net | bash. Follow the prompts: choose your upstream DNS provider (e.g., Cloudflare, Google), and accept the default blocklists. - Note the Pi-hole web interface password that appears at the end of installation (or run
pihole -a -plater to set a new one). - Access the admin dashboard by navigating to
http://<PI_IP>/adminin your browser. Log in with the password. - Configure your router to use Pi-hole as the DNS server. In your router’s settings, set the DHCP DNS to the Pi’s IP address. Alternatively, set the DNS on each device manually. If your router doesn’t allow custom DNS, you can disable DHCP on the router and let Pi-hole handle DHCP (enable it in Pi-hole settings).
- Test the setup: After a few minutes, devices should get the Pi-hole DNS. Visit a site with ads; they should be blocked. You can also check the Pi-hole dashboard for queries.
Common Mistakes
- Using a Pi Zero (non-W) without an Ethernet adapter, then trying to connect via Wi-Fi—it won’t work.
- Forgetting to enable SSH before first boot; you’ll need to reflash the SD card or connect a monitor/keyboard.
- Not setting a static IP; the Pi’s IP changes after reboot, breaking DNS.
- Pointing the router to the Pi’s IP but not disabling the router’s own DNS cache; some routers ignore custom DNS.
- Installing the full desktop OS instead of Lite, wasting resources and making the Pi slower.
- Using a low-quality power supply causing random crashes; Pi Zero needs at least 1A.
Tips
- Use a high-quality microSD card (SanDisk Ultra or better) to avoid corruption from power loss.
- Enable automatic updates for Pi-hole:
pihole -upmanually, or set up unattended-upgrades. - Add extra blocklists from the Pi-hole community (e.g., from firebog.net) to increase blocking coverage.
- Set a custom DNS port if you have another DNS service on the network.
- Monitor the Pi’s temperature; Pi Zero runs cool, but if it’s in a closed case, ensure ventilation.
- Use the Pi-hole API to integrate with home automation (e.g., disable for 5 minutes).
Troubleshooting
- Can’t SSH into the Pi: Check that SSH is enabled (create an empty file named
sshin the boot partition of the SD card). Verify the Pi is on the same network; if using Wi-Fi, confirm SSID/password. - Pi-hole install fails: Ensure the Pi has internet access (ping google.com). If the install script times out, try again; sometimes it’s a temporary network issue.
- Devices not blocking ads: Check that your router actually uses the Pi’s IP as DNS. Use
nslookup doubleclick.neton a client; it should return 0.0.0.0. Also, clear browser cache and restart devices. - Pi-hole dashboard not loading: Check that the lighttpd service is running:
sudo systemctl status lighttpd. Restart Pi-hole:pihole restartdns. - DNS resolution slow: Try a different upstream DNS provider (e.g., 1.1.1.1 or 8.8.8.8). Also ensure the Pi is not overloaded; check CPU with
htop. - Pi keeps crashing: Check power supply voltage with
vcgencmd get_throttled. If it shows throttling, use a better power supply or cable.
Frequently Asked Questions
Q: Will Pi-hole work on a Pi Zero without Wi-Fi?
Yes, but you’ll need a USB Ethernet adapter (or a USB-to-serial for setup). The Pi Zero has no built-in Ethernet, so you must use a USB adapter that is compatible with Linux (e.g., AX88772).
Q: Can I use Pi-hole with a VPN?
Yes, you can configure Pi-hole to work alongside a VPN like WireGuard. You’ll need to set the VPN clients to use the Pi-hole as their DNS server, and ensure the Pi-hole can handle queries from the VPN subnet.
Q: How much power does a Pi Zero use?
Typically 0.5-1W, making it very cheap to run 24/7. A Pi Zero 2 W uses slightly more, around 1-2W.
Q: Can I run Pi-hole alongside other services?
Yes, the Pi Zero is capable of running Pi-hole plus lightweight services like a simple web server or Home Assistant, but avoid heavy tasks. For more, consider a Pi 3 or 4.
Q: How do I update Pi-hole?
Run pihole -up to update Pi-hole core, web interface, and FTL. You can also enable automatic updates via cron.
Q: What if I want to temporarily disable blocking?
Use the admin dashboard’s ‘Disable’ button, or run pihole disable 5m to disable for 5 minutes.