Skip to content

How to Set Up Pi-hole to Block Ads on Your Network

A beginner-friendly guide to installing Pi-hole on a spare device to block ads network-wide.

Home Lab Basics 9 min read
A Raspberry Pi connected to a home router with glowing network cables, positioned on a clean desk with soft warm lighting from the side, surrounded by a subtle aura of blocked ads fading away like dus

If you're tired of ads slowing down every website and app in your house, a proper Pi-hole setup can fix that for every device on your network at once, not just the browser you're using. It works like a filter that sits between your devices and the internet, quietly blocking known ad and tracker domains before they even load. This guide walks you through the whole process, from installing Pi-hole to pointing your network at it, whitelisting sites that break, and undoing anything that goes wrong.

Expect to spend about an hour on this the first time, longer if you're also setting up a Raspberry Pi from scratch. It's a beginner-friendly project, nothing here needs coding experience, but you will be comfortable typing commands into a terminal by the end.

What You'll Need

  • A Raspberry Pi, old laptop, mini PC, or a spare machine that can stay on all the time
  • A microSD card (if using a Raspberry Pi) with Raspberry Pi OS already installed
  • A stable network connection, ideally wired via Ethernet rather than Wi-Fi
  • Access to your router's admin settings
  • About an hour of free time
  • A second device (phone or laptop) to test with once Pi-hole is running

If you don't already have hardware set aside for this, our guide to the best mini PCs for a home lab has some solid options that barely sip power, which matters since Pi-hole needs to run around the clock.

Step 1: Choose and Prepare Your Hardware

Pi-hole is lightweight, so you don't need anything powerful. A Raspberry Pi 3 or 4 handles it easily, and so does almost any old laptop or mini PC gathering dust in a drawer.

  1. Decide what you're using. If it's a Raspberry Pi, flash Raspberry Pi OS Lite onto the microSD card using the Raspberry Pi Imager tool.
  2. Connect the device to your network, ideally with an Ethernet cable rather than Wi-Fi. A wired connection is more reliable for something that needs to stay online constantly.
  3. Give the device a fixed IP address, either through your router's DHCP reservation settings or by setting a static IP on the device itself. Pi-hole needs a consistent address so your router can always find it.

If you haven't run Ethernet to where this device will live, it's worth reading up on running Ethernet cable through your house before committing to a spot. A few metres of cable now saves a lot of hassle later.

Step 2: Install Pi-hole

Pi-hole has an official installation script that handles almost everything for you.

  1. Open a terminal on your device, or connect to it over SSH from another computer.
  2. Run the following command:

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

  1. Follow the on-screen prompts. You'll be asked to choose an upstream DNS provider (Cloudflare and Google are common choices, pick whichever you trust), confirm your network settings, and choose whether to install the web admin interface. Say yes to the web interface, you'll want it.
  2. Once installation finishes, the script will show you a web admin password. Write this down or take a screenshot, you'll need it to log in later.
  3. Note the IP address shown at the end of the installation. This is the address you'll point your network to in the next step.

The whole process usually takes five to ten minutes, most of which is the script downloading and installing files in the background.

Step 3: Log Into the Pi-hole Dashboard

Before changing anything on your network, check that Pi-hole itself is working.

  1. On any device connected to your network, open a browser and go to http://[your-pihole-ip]/admin (replace with the actual IP address from Step 2).
  2. Log in using the password from the installation.
  3. You should see a dashboard showing queries, though it'll be mostly empty since nothing is using it yet.

If the page doesn't load, double check the IP address and make sure the Pi-hole device is actually online.

Step 4: Point Your Network at Pi-hole

This is the step that actually makes Pi-hole block ads for every device, not just the one you're using. You have two options here.

Option A: Change DNS settings on your router (recommended)

  1. Log into your router's admin panel. This is usually done by typing an address like 192.168.1.1 into a browser.
  2. Find the DNS settings, often under WAN, Internet, or Network settings.
  3. Replace the existing DNS addresses with the IP address of your Pi-hole device.
  4. Save and restart the router if prompted.

This method covers every device on your network automatically, including phones, smart TVs, and smart home gadgets, without you touching each one individually.

Option B: Change DNS settings on individual devices

If you'd rather test things gradually, you can change DNS settings on one device at a time instead of the whole router. This is slower but useful if you want to be cautious.

  1. Go into the Wi-Fi or network settings on the device.
  2. Find the DNS configuration option, usually under "advanced" settings.
  3. Enter your Pi-hole's IP address as the DNS server.
  4. Save and reconnect to the network.

Give it a few minutes, then browse a few websites and check the Pi-hole dashboard. You should see queries appearing and some being blocked.

Step 5: Test That It's Actually Working

Pi-hole has a simple built-in test for this.

  1. Visit pi.hole/admin or your Pi-hole IP address again and check the dashboard for query activity.
  2. Open a browser on a connected device and visit a site known for heavy advertising. You should notice fewer ads, faster loading, or both.
  3. For a more technical check, there are test domains designed specifically to confirm ad-blocking DNS is working, which you can find listed on Pi-hole's own documentation.

If nothing is being blocked, it usually means your devices are still using the old DNS settings rather than Pi-hole. Routers sometimes cache DNS settings, so a restart can help here too.

Step 6: Whitelist Sites That Break

Occasionally Pi-hole blocks something a bit too enthusiastically, and a site stops working properly. Maybe images won't load, or a login button does nothing. This is normal and easy to fix.

  1. Open the Pi-hole dashboard and go to the "Query Log" section.
  2. Find the domain that's causing problems. It'll usually show as blocked in red.
  3. Click the domain and choose to whitelist it.
  4. Alternatively, go to the "Whitelist" section directly and add the domain manually if you already know its name.
  5. Refresh the affected site. It should now work normally.

Some sites use several different domains for ads, analytics, and actual content, so you might need to whitelist more than one before everything works again.

Step 7: Know How to Undo Changes

Things occasionally go wrong, usually when a router setting doesn't revert cleanly, or the Pi-hole device goes offline and takes your internet down with it. It's worth knowing how to reverse everything quickly.

  1. To stop using Pi-hole entirely, go back into your router's DNS settings and switch back to automatic, or manually enter a public DNS provider like 1.1.1.1 or 8.8.8.8.
  2. If you changed DNS settings on individual devices, repeat that process in reverse, setting DNS back to automatic.
  3. If Pi-hole itself seems to be misbehaving, you can temporarily disable blocking from the dashboard without removing it entirely. There's a "Disable" button on the main page with options for 10 seconds, 30 seconds, 5 minutes, or permanently.
  4. To uninstall Pi-hole completely, run pihole uninstall from the terminal on the device.

Keeping a note of your router's original DNS settings before you start is a good habit, just in case you need to roll back quickly.

Common Mistakes to Avoid

  • Not giving the Pi-hole device a fixed IP address. If its address changes, your router's DNS settings will point to nothing and your whole network loses internet access.
  • Forgetting to restart devices after changing DNS settings. Phones and laptops often cache old DNS information and need a quick restart or network toggle to pick up the change.
  • Blocking too aggressively from the start. Using multiple strict blocklists immediately can break more sites than it fixes. Start with the default lists and add more gradually.
  • Running Pi-hole on unreliable hardware. If the device crashes or loses power often, your entire network's internet access goes down with it. Choose something stable that can run constantly.
  • Skipping the whitelist step out of frustration. A broken site is almost always a two minute whitelist fix, not a reason to abandon the setup entirely.

Conclusion

A Pi-hole setup is one of the more satisfying home lab projects you can take on, mainly because the results are so obvious straight away. Pages load faster, ads disappear, and you get a surprisingly interesting look at just how many trackers your devices are quietly talking to. If this is your first dip into running your own network services, it's a gentle way to start, and our guide to home lab basics for beginners has more ideas for what to try next.

Just remember to keep the hardware stable, whitelist sites as needed, and keep a note of your original router settings in case you ever need to step back.

FAQ

Does Pi-hole block ads inside apps, not just websites?

Yes, to an extent. Because Pi-hole blocks requests at the DNS level, it can stop ads in many apps too, not just browsers. Results vary depending on how the app serves its ads, but most people notice a real difference across YouTube, games, and other apps.

Will Pi-hole slow down my internet?

No, if anything it tends to speed things up slightly, since blocked requests never get a chance to load. The only time you'd notice a slowdown is if the Pi-hole device itself is underpowered or struggling, which is rare with modern hardware.

What happens if the Pi-hole device goes offline?

If your router is set to use only Pi-hole for DNS and it goes offline, devices on your network will lose internet access until it comes back or you switch DNS settings back manually. Some people add a backup DNS server as a second option in their router settings to avoid this.

Can I use Pi-hole alongside my existing router without buying new equipment?

Yes, that's actually the most common setup. You don't need a new router, just a spare low-power device to run Pi-hole on and a quick change to your router's DNS settings.

Does Pi-hole work with guest Wi-Fi networks?

It can, depending on how your router handles DNS for separate network segments. If you run a guest Wi-Fi network, check its settings separately, as some routers apply DNS settings differently to guest and main networks.

Is Pi-hole enough on its own, or do I still need a browser ad blocker?

Pi-hole catches a lot, but a browser extension can still help with ads that slip through, particularly ones embedded directly in a webpage rather than loaded from a separate ad server. Many people run both for the best results.