You know that feeling when you’re trying to read an article and the page is 60% ads? Pop-ups, auto-playing videos, banners tracking you across every site you visit? Now imagine all of that just… gone. Not just on your laptop — on every device in your house. Your phone, your smart TV, your kid’s tablet, your guest’s phone when they connect to your Wi-Fi.
That’s what Pi-hole does. And setting it up on a Raspberry Pi 5 takes about 30 minutes.
Pi-hole is a free, open-source network-level ad blocker that runs on a Raspberry Pi. Instead of installing ad blockers on every browser and every device, Pi-hole blocks ads and trackers at the DNS level — meaning anything connected to your network gets protection automatically. No apps to install, no browser extensions to manage.
We’ve been running Pi-hole on our network for a while now, and honestly, it’s one of the best Raspberry Pi projects we’ve ever done. Here’s the full step-by-step setup guide.

What You’ll Need (Hardware + Software Checklist)
The good news: you don’t need much. If you already have a Raspberry Pi 5, you might have everything you need sitting in a drawer.
Hardware
- Raspberry Pi 5 (4GB or 8GB) — The 8GB model is overkill for Pi-hole, but if you plan to run other services alongside it, grab the 8GB. Check price on Amazon
- MicroSD card (32GB+) — Any Class 10 card works. We recommend 64GB so you have room to grow.
- USB-C power supply (27W) — The official Raspberry Pi 5 power supply is ideal. Most Pi 5 starter kits include one.
- Ethernet cable — You can use Wi-Fi, but Ethernet is more reliable for a DNS server that your whole network depends on.
- Case with cooling — The Pi 5 runs warm. A case with a fan or heatsink keeps things stable. The GeeekPi case with active cooling is a solid budget pick, or go with the Argon Flirc passive case if you want silent operation.
Want everything in one box? The CanaKit Raspberry Pi 5 Starter Kit PRO includes the board, case, power supply, SD card, and cooling — everything you need to get started.
Software
- Raspberry Pi Imager — Free download from raspberrypi.com
- Raspberry Pi OS Lite (64-bit) — The headless version without a desktop. Pi-hole doesn’t need a monitor.
- Pi-hole — Installed via a single command (we’ll get there)
Step 1 — Flash Raspberry Pi OS Lite
Download and install Raspberry Pi Imager on your computer. Plug in your microSD card and:
- Open Raspberry Pi Imager
- Click Choose OS → Raspberry Pi OS (other) → Raspberry Pi OS Lite (64-bit)
- Click Choose Storage → select your microSD card
- Click the gear icon (or press Ctrl+Shift+X) to open Advanced Options:
- Enable SSH (password authentication)
- Set a username and password (write these down — you’ll need them)
- Optionally configure Wi-Fi (but again, Ethernet is better)
- Click Write and wait for it to finish
Pop the microSD card into your Pi 5, connect the Ethernet cable to your router, and plug in the power supply. Give it a minute to boot.
Step 2 — SSH In and Update
Find your Pi’s IP address. The easiest way is to check your router’s admin page for connected devices — look for “raspberrypi.” Or if you set a hostname in the Imager settings, try:
ssh yourusername@raspberrypi.local
Once you’re in, update everything:
sudo apt update && sudo apt full-upgrade -y
sudo reboot
Wait a minute for the reboot, then SSH back in.

Step 3 — Set a Static IP
Your Pi-hole needs a consistent IP address so your router always knows where to send DNS requests. The easiest approach: set a DHCP reservation in your router.
- Log into your router’s admin page (usually 192.168.1.1 or 192.168.0.1)
- Find the DHCP or LAN settings
- Look for your Pi’s current IP and MAC address
- Create a reservation that always assigns that same IP to your Pi
Alternatively, you can set a static IP directly on the Pi by editing /etc/dhcpcd.conf, but the router reservation method is simpler and survives OS reinstalls.
Write down your Pi’s IP address — you’ll need it for the next step and for configuring your router later.
Step 4 — Install Pi-hole
Here’s the fun part. One command:
curl -sSL https://install.pi-hole.net | bash
The installer walks you through a few options:
- Upstream DNS provider — Pick Google (8.8.8.8), Cloudflare (1.1.1.1), or whatever you prefer. (If you add Unbound later, you’ll change this.)
- Blocklists — Accept the default. You can add more later.
- Admin web interface — Yes, install it. This is how you’ll monitor and manage Pi-hole.
- Query logging — Enable it. Useful for troubleshooting.
When the installer finishes, it displays a randomly generated admin password. Copy it. You can change it later with:
pihole -a -p
Test the web interface by opening a browser and going to:
http://YOUR-PI-IP/admin
You should see the Pi-hole dashboard. Congratulations — the hard part is done.
Step 5 — Configure Your Router
This is where Pi-hole goes from “running on a Pi” to “blocking ads on every device in your house.”
You need to tell your router to use Pi-hole as the DNS server for your entire network:
- Log into your router’s admin page
- Find the DNS settings (usually under LAN, DHCP, or Network settings)
- Replace whatever DNS servers are there with your Pi’s IP address
- Save and reboot the router
Every device that connects to your network will now send DNS requests through Pi-hole. Ads and trackers get blocked before they even load.
Important: Some routers don’t let you change DNS settings. If yours doesn’t, you can enable Pi-hole’s built-in DHCP server instead (Settings → DHCP in the Pi-hole admin). Just disable your router’s DHCP first to avoid conflicts.
Optional: Add Unbound for Recursive DNS
By default, Pi-hole forwards your DNS queries to an upstream provider like Google or Cloudflare. That means they can see every domain you visit. If privacy matters to you (and it should), you can run your own recursive DNS resolver with Unbound.
Install it:
sudo apt install -y unbound
Create the config file:
sudo nano /etc/unbound/unbound.conf.d/pi-hole.conf
Paste the official Pi-hole Unbound configuration (it’s about 30 lines — the Pi-hole docs have the exact content).
Then restart Unbound and verify it works:
sudo systemctl restart unbound
dig example.com @127.0.0.1 -p 5335
If you get a response, go to Pi-hole admin → Settings → DNS, remove the upstream servers, and add 127.0.0.1#5335 as a custom upstream. Now your DNS queries go directly to the root servers — no middleman.
Testing and Troubleshooting
Verify Pi-hole Is Working
- Open the Pi-hole dashboard (http://YOUR-PI-IP/admin)
- Browse a few websites on any device connected to your network
- Check the dashboard — you should see queries being blocked in real-time
You can also visit ads-blocker.com to test whether ads are being blocked.
Common Issues
“Some websites are broken” — Pi-hole might block a domain that a site needs to function. Check the Query Log in your dashboard, find the blocked domain, and whitelist it.
“Pi-hole isn’t blocking anything” — Make sure your router’s DNS is pointing to the Pi’s IP. On your computer, run nslookup google.com — the server should show your Pi’s IP address.
“I can’t access the internet at all” — The Pi might be off or unreachable. As a quick fix, manually set your device’s DNS to 8.8.8.8 to bypass Pi-hole while you troubleshoot. Check that the Pi is powered on, connected via Ethernet, and running (pihole status).
“YouTube ads still show” — This is a common complaint. YouTube serves ads from the same domains as video content, making them difficult to block at the DNS level. Pi-hole catches most web ads, but YouTube and a few other platforms are the exception.

Frequently Asked Questions
Does Pi-hole slow down my internet?
No. If anything, it makes browsing faster. Blocked ads and trackers mean less data to download on every page load. DNS resolution on a Raspberry Pi 5 is nearly instant — the 2.4GHz quad-core processor handles DNS queries without breaking a sweat.
Can I use Pi-hole with a VPN?
Yes. You can configure Pi-hole to work with WireGuard or OpenVPN so that your devices get ad blocking even when you’re away from home. The Pi-hole docs have guides for both setups.
Will Pi-hole block ads on my smart TV?
Yes — this is one of the biggest wins. Smart TVs, Roku, Fire Stick, and other streaming devices can’t install ad blockers. But since Pi-hole works at the network level, it blocks tracking and some ad requests from these devices automatically. Results vary by platform, but Samsung TV ads and Roku home screen ads are commonly reduced.
Do I need the Raspberry Pi 5, or will a Pi 4 work?
A Pi 4 (or even a Pi Zero 2 W) works fine for Pi-hole alone. The Pi 5 is overkill for DNS, but it’s great if you want to run additional services like Home Assistant, Unbound, or a VPN server on the same device. Plus, the Pi 5’s improved Ethernet performance means faster DNS resolution under heavy load.
How much does the whole setup cost?
If you’re buying everything new: a Raspberry Pi 5 (4GB) runs about $60, a case with cooling is $10-25, a power supply is $12, and a microSD card is $8-12. Total: roughly $90-110 for a network-wide ad blocker that protects every device in your home. A starter kit like the CanaKit PRO bundles everything for about $210 with the 8GB board and 128GB storage.

