🧰 How to Set Up Pi-hole on a Raspberry Pi (Block Ads Network-Wide!)

Tired of ads and trackers? Learn how to turn your Raspberry Pi into a powerful network-wide ad blocker using Pi-hole—no browser plugins needed!

🧰 How to Set Up Pi-hole on a Raspberry Pi (Block Ads Network-Wide!)
Photo by Mateusz Wacławek / Unsplash

🔷 Introduction

Ever feel like ads are stalking you across the internet? From pop-ups to autoplay video ads, it can be overwhelming. But what if you could block ads on every device in your home—without installing ad blockers on each one?

That’s exactly what Pi-hole does! It acts as a network-wide ad blocker, filtering out ads before they even reach your devices. Less tracking, fewer distractions, and a faster browsing experience.

Let’s go!


📌 What You Need to Get Started

  • ✅ Raspberry Pi (Pi 3, 4, or 5 recommended)
  • ✅ MicroSD card (16GB minimum, 32GB+ recommended)
  • ✅ Stable internet connection (Ethernet recommended)
  • ✅ SSH access (or a monitor & keyboard for initial setup)

💡 Bonus: A Pi-case with cooling, like the Electrocookie Case we previously featured, helps with airflow and style.


🔧 Step 1: Install Raspberry Pi OS

Pi-hole runs on Raspberry Pi OS, so if you haven’t set that up yet:

  1. Download Raspberry Pi OS Lite (no desktop needed)
  2. Flash it onto your microSD card using Raspberry Pi Imager (or balenaEtcher)
  3. Enable SSH
  4. Insert the SD card into your Pi and boot it up
  5. Open a terminal or connect via SSH: ssh pi@raspberrypi.local

🛠️ Step 2: Install Pi-hole

Now for the fun part—installing Pi-hole! 🎯

  1. Run the installation command to start the automated set up process:
    curl -sSL https://install.pi-hole.net | bash
  2. Select your preferred DNS provider (Cloudflare, OpenDNS, Tailscale's MagicDNS, Google, etc.)
  3. Set a static IP address
  4. Enable the Web Admin Interface when prompted so you'll be able to see blocked domains and stats

💡 After installation, Pi-hole will give you an admin password—write it down, or, better yet, generate a strong, unique password and save it in a password manager like 1Password.


🌐 Step 3: Set Pi-hole as Your Network's DNS Server

For Pi-hole to work across all devices, you need to set it as your DNS server in your router:

  1. Log in to your router settings (e.g. 192.168.1.1 or 192.168.0.1)
  2. Find the DNS settings (often under LAN or DHCP settings)
  3. Enter your Raspberry Pi’s static IP as the Primary DNS Server
  4. Save and reboot the router

💡 Now, every device on your network will automatically route internet traffic through Pi-hole!


📊 Step 4: Monitor & Control Ads with the Dashboard

To access the Pi-hole web dashboard, open your browser, go to http://pi.hole/admin and enter the admin password you saved earlier.

Here, you can:

  • 📈 View blocked ad stats
  • 🚫 Add or remove domains from blocklists
  • ⏸️ Temporarily disable Pi-hole when needed

❗ Bonus: Customize & Expand Pi-hole

  • ✅ Whitelist sites if things break; some banking or shopping sites might break with aggressive ad-blocking.
  • ✅ Find and add more blocklists from firebog.net for even stronger ad-blocking.
  • ✅ Use Pi-hole with Unbound for a private DNS resolver for extra privacy.

⚠️ Troubleshooting Tips

  • 💡 Not blocking ads? Check the DNS settings on your devices.
  • 💡 Fix issues or repair the installation using pihole -r
  • 💡 Temporarily disable it using pihole disable 10m where 10m represents the number of minutes to disable it
  • 💡 Check the Pi-hole dashboard for blocked domains

📊 Quick Setup Overview (TL;DR)

Step What to Do
1. Install Raspberry Pi OS Flash OS, enable SSH, connect to Pi
2. Install Pi-hole Run curl command, follow setup
3. Set as Network DNS Change router settings
4. Use the Dashboard View stats, manage settings

🎬 Final Thoughts: Enjoy an Ad-Free Internet!

That’s it! You’ve successfully set up Pi-hole on your Raspberry Pi, giving you network-wide ad blocking for a cleaner, faster, and more private browsing experience.

💬 Have any questions or need help? Drop a comment below!