Amazon Cyber Monday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

Pi-hole Setup on Raspberry Pi: Step-by-Step Guide

Pi-hole is a network-wide ad blocker that runs on a Raspberry Pi. Instead of blocking ads in just one browser, it filters DNS requests for every device on your home network—phones, smart TVs, laptops, and more. This guide walks you through installing Pi-hole on a Raspberry Pi, from flashing the OS to configuring your router. By the end, you’ll have a private, low-power ad blocker that also improves privacy by blocking trackers at the network level.

What You’ll Need

  • A Raspberry Pi (any model from Pi 2 onward; Pi Zero 2 W works, but a Pi 3 or 4 is smoother)
  • A microSD card (8GB or larger, Class 10 recommended)
  • A power supply for your Pi
  • An Ethernet cable (strongly recommended for reliability) or stable Wi-Fi
  • A computer to write the SD card and access the Pi
  • Optional: a USB keyboard and HDMI monitor for initial setup

Step-by-Step

  1. Flash Raspberry Pi OS Lite – Download the Raspberry Pi Imager from the official Raspberry Pi website. Insert your microSD card into your computer, open the Imager, choose your Pi model, select “Raspberry Pi OS Lite (32-bit)” from the OS menu, and pick your SD card. Click “Write” and wait for it to finish.
  2. Enable SSH (optional but helpful) – After flashing, the SD card will appear as a drive called “boot”. Create an empty file named ssh (no extension) in that folder. This allows you to connect remotely later.
  3. Boot the Pi – Insert the SD card into the Pi, connect the Ethernet cable, and plug in power. If you have a monitor and keyboard, you can log in directly; otherwise, wait a minute and find the Pi’s IP address from your router’s admin page.
  4. Log in and update – Open a terminal (or SSH from your computer) and log in with the default credentials: username pi, password raspberry. Then run:
    sudo apt update && sudo apt upgrade -y

    This updates the system and may take a few minutes.

  5. Set a static IP address – Pi-hole needs a fixed IP so devices always find it. Edit the DHCP configuration file:
    sudo nano /etc/dhcpcd.conf

    Add these lines at the bottom (replace with your network details):

    interface eth0
    static ip_address=192.168.1.200/24
    static routers=192.168.1.1
    static domain_name_servers=1.1.1.1 8.8.8.8

    Save with Ctrl+X, then Y, then Enter. Reboot with sudo reboot.

  6. Install Pi-hole – After reboot, log in again and run the one-line installer:
    curl -sSL https://install.pi-hole.net | bash

    Follow the on-screen prompts. Accept the default choices unless you have a reason to change them. When asked for an upstream DNS provider, choose one you trust (e.g., Cloudflare or Google).

  7. Set a web admin password – After installation, you’ll see a random password. To set your own, run:
    sudo pihole -a -p

    Enter a strong password when prompted.

  8. Access the admin dashboard – Open a web browser on any device and go to http://your-pi-ip-address/admin (e.g., http://192.168.1.200/admin). Log in with the password you set.
  9. Configure your router to use Pi-hole – Log into your router’s admin panel (usually via a browser at 192.168.1.1). Find the DHCP settings and change the DNS server to your Pi’s static IP address. Save and reboot your router. All devices will now get Pi-hole as their DNS.
  10. Verify it works – Visit http://your-pi-ip-address/admin and check the “Queries” graph. You should see queries from all devices. Try visiting a site with ads—they should be blocked.

Common Mistakes

  • Forgetting to set a static IP – If your Pi’s IP changes, devices lose ad blocking. Always set a static IP before installing.
  • Using Wi-Fi for the Pi – Wi-Fi can be unstable and adds latency. Use Ethernet for best performance.
  • Skipping the router change – Installing Pi-hole alone doesn’t block ads network-wide; you must point your router’s DNS to the Pi.
  • Not updating the Pi – An outdated OS can cause install failures. Always run sudo apt update && sudo apt upgrade first.
  • Choosing the wrong upstream DNS – If you pick a slow or unreliable DNS provider, browsing will feel sluggish. Test a few.

Tips

  • Use a blocklist – Pi-hole comes with a default list. You can add more from the admin dashboard under “Group Management” → “Adlists”. Popular ones include StevenBlack’s hosts list and OISD.
  • Whitelist false positives – If a site breaks, check the “Query Log” and whitelist the domain that’s being blocked.
  • Set a custom DNS for your Pi – In /etc/dhcpcd.conf, use a public DNS like 1.1.1.1 instead of your router’s IP to avoid loops.
  • Update Pi-hole regularly – Run sudo pihole -up to get the latest features and blocklists.
  • Back up your config – Use sudo pihole -a -t to create a teleporter backup file you can restore later.

Troubleshooting

  • No queries showing in the dashboard – Check that your router is actually using the Pi’s IP as DNS. Reboot your router and devices. Also verify the Pi’s static IP is correct.
  • Internet stops working after router change – This usually means the Pi’s DNS isn’t reachable. Confirm the Pi is online and that sudo pihole status shows “Active”. If not, restart the Pi-hole service with sudo systemctl restart pihole-FTL.
  • Pi won’t boot after flashing – Re-flash the SD card, ensuring you selected the correct OS. If you created an ssh file, make sure it has no extension.
  • Can’t access the admin page – Check the Pi’s IP with hostname -I. Ensure you’re using http:// not https://. If the page loads but login fails, reset the password with sudo pihole -a -p.
  • Slow internet after installation – Try a different upstream DNS provider in Pi-hole’s settings. Also check that your router isn’t using the Pi as its own DNS (which can cause loops).

Frequently Asked Questions

Will Pi-hole slow down my internet?

No, it typically speeds up browsing because it blocks ads and trackers before they load. DNS lookups are cached, so repeat requests are faster.

Can I use Pi-hole on a Raspberry Pi Zero?

Yes, a Pi Zero 2 W works, but the web interface may be slower. A Pi 3 or 4 is recommended for smoother performance.

Do I need to configure each device individually?

No. If you change your router’s DNS, every device on the network automatically uses Pi-hole. You can also set Pi-hole as the DNS on individual devices if you prefer.

Will Pi-hole block ads on YouTube or Netflix?

It won’t block video ads because they come from the same domain as the video content. However, it will block many banner and pop-up ads on websites.

How do I uninstall Pi-hole?

Run sudo pihole uninstall from the terminal. This removes Pi-hole but leaves your Raspberry Pi OS intact.

Can I run other services on the same Pi?

Yes, Pi-hole is lightweight. You can run a VPN, a media server, or other tools, but be mindful of the Pi’s resources.

Pi-hole Setup on Raspberry Pi: Step-by-Step Guide
Scroll to top