You know what's exhausting about the modern internet? The ads. They're everywhere. Pop-ups, banner ads, video ads, sponsored posts, "recommended" content that's really just paid placements. Every website you visit is trying to sell you something, and they're willing to ruin your experience to do it.
You've probably tried ad blockers. uBlock Origin in your browser works great for desktop. But what about your phone? Your smart TV? Your tablet? Your IoT devices that are constantly phoning home to advertise? Browser extensions only go so far.
Enter Pi-hole. It's a DNS-level ad blocker. Instead of blocking ads in your browser, it blocks them at the network level. Every device on your network uses it. Every device gets ad-free. No browser extensions required. No configuration on each device. It's beautiful.
Here's how it works: when your phone tries to load an ad from ads.google.com, Pi-hole says "nope, that doesn't exist." DNS is the phone book of the internet—it translates domain names to IP addresses. Pi-hole just refuses to look up the addresses of known ad servers.
What We'll Cover
What is Pi-hole?
Pi-hole is open-source software that runs on a Linux machine—traditionally a Raspberry Pi, hence the name. It's a DNS server that blocks requests to known advertising and tracking domains.
Think about how DNS works: when you type youtube.com into your browser, your computer asks a DNS server "what's the IP address for youtube.com?" The DNS server answers, and your browser loads the site.
Pi-hole sits in the middle of this process. When your computer asks about doubleclick.net (Google's ad network), Pi-hole says "I don't know that one" (technically it returns 0.0.0.0). Your browser tries to connect to 0.0.0.0, fails, and the ad never loads. Simple as that.
Why Use It?
- Network-wide blocking – Every device. Phones, laptops, TVs, smart speakers, game consoles. If it's on your network, it gets blocked. No browser extensions needed.
- Blocks more than ads – It blocks trackers too. Those little scripts that follow you around the internet, building a profile of who you are? Pi-hole stops those at the DNS level.
- Privacy – No ad companies tracking you. No data being collected about your browsing habits. You're not the product.
- Faster browsing – Blocking all those ad requests actually makes pages load faster. Less stuff to download means quicker page loads.
- It's free – Open source, no subscription, no premium features. Just good software.
The best part is seeing the statistics. Pi-hole shows you how much garbage it's blocking. On my home network, we block somewhere between 30-50% of all DNS queries. That's half the requests that would have gone to ad and tracking servers. It's obscene how much stuff the average device tries to connect to.
What Hardware Do You Need?
Pi-hole was designed for the Raspberry Pi, but it runs on anything Linux. Here are your options:
Raspberry Pi (Recommended)
A Raspberry Pi 3, 4, or even a Zero will work. The Pi 4 is the best choice if you can get one—it has gigabit ethernet and enough RAM to handle a busy network. The Pi 3B+ is fine for smaller networks. The Zero works but can be slow.
Old Computer
Have an old laptop or desktop gathering dust? Install Debian or Ubuntu on it and run Pi-hole. It'll use more electricity than a Pi, but it's plenty powerful.
VPS
You can run Pi-hole on a VPS too. This lets you use it as a VPN—connect to your VPS with WireGuard, and your traffic gets ad-blocked even when you're on someone else's network. More on that in the WireGuard guide.
Docker
If you already run Docker, Pi-hole has an official image. This is easiest if you're comfortable with Docker Compose. I'll show both the Docker way and the regular install way.
Installing Pi-hole
I'll show you two ways: Docker (easier if you already run Docker) and the direct install (easier if you want a dedicated device).
Option A: Docker Install (Recommended if you have Docker)
mkdir -p ~/docker/pihole && cd ~/docker/pihole
cat > docker-compose.yml << 'EOF'
version: '3'
services:
pihole:
image: pihole/pihole:latest
container_name: pihole
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "8080:80/tcp"
environment:
- TZ=America/Los_Angeles
- WEBPASSWORD=your-password-here
volumes:
- ./data:/etc/pihole
- ./dnsmasq.d:/etc/dnsmasq.d
cap_add:
- NET_ADMIN
EOF
your-password-here to something secure. This is the admin password for Pi-hole's web interface.
docker-compose up -d
That's it. Pi-hole is running. Skip to the setup section.
Option B: Direct Install (For Raspberry Pi or dedicated machine)
curl -sSL https://install.pi-hole.net | bash
That's the official install script. It walks you through the setup. You'll answer questions about:
- Static IP – Give it a fixed IP on your network so you can always find it
- Upstream DNS – Where Pi-hole forwards non-blocked requests. I use Cloudflare (1.1.1.1) and Google (8.8.8.8) as fallbacks.
- Admin password – Set a password for the web interface
After install, the script will show you the admin URL and password. Write those down.
Initial Setup
Point your browser to the Pi-hole admin interface. If you're running Docker on your server, that's probably http://localhost:8080. If it's a standalone machine, it's http://its-ip-address/admin.
Log in with the password you set. You'll see the dashboard. It's got charts and graphs and numbers. They're pretty satisfying. At the top, you'll see:
- Total queries – How many DNS queries have been made
- Queries blocked – How many were blocked
- Percent blocked – The ratio
- Domains on blocklist – How many domains are being filtered
Below that, you see pie charts of where queries go, what types of queries, and queries over time. It's like a window into how much garbage your devices are trying to connect to.
- Cloudflare: 1.1.1.1
- Google: 8.8.8.8
Setting Up Your Network
Here's the tricky part: you need to tell your network devices to use Pi-hole for DNS instead of whatever they're using by default.
There are a few ways to do this:
Method 1: Router DHCP (Recommended)
This is the easiest method. You configure your router to give out Pi-hole's IP as the DNS server to every device on your network.
Log into your router's admin interface. Look for:
- DHCP settings
- Network settings
- LAN settings
Find the DNS server field. Instead of letting the router give out the ISP's DNS, enter your Pi-hole's IP address.
Save and restart your router. Now every device that connects to your network will automatically use Pi-hole for DNS.
Method 2: Configure Devices Manually
On each device, go to network settings and manually set DNS to your Pi-hole's IP address. This is tedious but works.
Method 3: Docker with Host Networking
If you ran Pi-hole in Docker, you need to be careful about DNS. Use host networking mode:
version: '3'
services:
pihole:
image: pihole/pihole:latest
container_name: pihole
restart: unless-stopped
network_mode: "host"
environment:
- TZ=America/Los_Angeles
- WEBPASSWORD=your-password-here
volumes:
- ./data:/etc/pihole
- ./dnsmasq.d:/etc/dnsmasq.d
cap_add:
- NET_ADMIN
This makes Pi-hole use the host's network directly, which plays better with most home networks.
Verify It's Working
Go to the Pi-hole query log (Query Log in the sidebar). You should see queries coming in from your devices. If you see nothing, DNS isn't working yet—check your router settings.
Blocklists and Filtering
Pi-hole comes with a default blocklist, but you'll want to add more. More blocklists = more blocked stuff.
Go to Group Management > Blocklists. Add these URLs (these are the most popular, widely-used lists):
# AdGuard Default
https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
# AdGuard EasyList
https://raw.githubusercontent.com/AdAwayAdaWayHostsFile/master/hosts.txt
# Fanboy's Ultimate
https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt
# StevenBlack Hosts
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
# NoCoin (cryptomining)
https://raw.githubusercontent.com/nickypangers/coinblockerlist/master/hosts
Click "Save" and then "Update." Pi-hole will download and merge these lists.
You can also add your own custom blocklist. Want to block facebook.com at the DNS level? Just add it to a custom list. Or create a regex filter for entire categories of domains.
Whitelisting
Sometimes a site you use breaks because Pi-hole is blocking something it shouldn't. You'll need to whitelist it.
Go to Whitelist and add domains that are getting falsely blocked. Common ones:
- Some banking sites are overly aggressive with security and get flagged
- Some streaming services check for ads aggressively
- Sometimes a site's CDN gets blocked
Finding what's blocked: go to the Query Log and search for the domain. If it shows "blocked," click it and you can whitelist it right there.
Remote Access
Want to use your Pi-hole when you're away from home? There are a few options:
VPN (Recommended)
Set up WireGuard on your home network. Connect to it from outside. All your traffic goes through your home network, including through Pi-hole. It's like you're sitting at home. This is what I do.
See the WireGuard guide for how to set that up.
Pi-hole Cloudflared
There's a project called cloudflared that lets you access your Pi-hole over the internet securely. It's more complex to set up, but it's an option if you don't want to run a full VPN.
The Magic of Ad-Free Internet
The first few days with Pi-hole, you'll keep noticing things. Your smart TV doesn't show ads anymore. Your phone doesn't get those creepy ads that seem to know what you were just talking about. Websites load faster. Your data stays yours.
It's one of those things you don't realize you needed until you have it. And once you have it, you can't go back. Visiting a friend's house and seeing ads everywhere feels weird now. It's like going back to regular TV after years of Netflix.
Pi-hole won't fix everything. Browser fingerprinting still exists. Some trackers use clever methods. But blocking 30-50% of the garbage out there? That's a huge win. That's less data flying out of your home. That's less tracking. That's one more piece of your digital life that's actually yours.
Welcome to the clean internet.
The revolution will not be proprietary.