Block ads on every device in your home—phones, tablets, computers, smart TVs—without installing anything on each device. Pi-hole acts as your DNS server, filtering out ads before they even reach your devices. This is one of the most practical and immediately useful Raspberry Pi projects.
What You're Building
A network-wide ad blocker that:
- Blocks ads on ALL devices automatically (phones, tablets, computers, smart TVs)
- Speeds up web browsing by blocking tracking scripts
- Works on apps and websites
- Improves privacy by blocking tracking domains
- Shows detailed statistics on blocked content
- Requires no configuration on individual devices
- Runs 24/7 silently in the background
- Blocks malware and phishing domains
- Works with streaming devices (Roku, Fire TV, etc.)
Difficulty: ⭐⭐ Easy Time Required: 30 minutes - 1 hour Cost: $58-83 Daily Impact: Immediate and noticeable
What You'll Need
Required Components
Raspberry Pi
- Raspberry Pi 4 – Best performance, handles large networks
- Raspberry Pi 3 B+ – Great for most home networks, very affordable
- Raspberry Pi Zero 2 W – Budget option, works for smaller networks
- Any Pi works - Even older models are fine for Pi-hole
Storage
- SanDisk 128GB microSD Card – Plenty of space for logs
- Minimum: 8GB (though 16GB+ recommended)
Power Supply
- Official Raspberry Pi power supply (USB-C for Pi 4, micro USB for Pi 3/Zero)
- Quality power = stability (Pi-hole runs 24/7)
Network Connection
- Ethernet cable (strongly recommended for reliability)
- Built-in Wi-Fi works but ethernet is more stable
Case
- Pi 4 Case – If using Pi 4
- Pi 3 B+ Clear Case – If using Pi 3 B+
- Pi Zero 2 W Clear Case – If using Zero 2 W
- Fanless is fine (Pi-hole is very lightweight)
Quick Shopping List
Everything You Need:
Raspberry Pi (Choose One):
- Raspberry Pi 4 – Best for large networks, $35-45
- Raspberry Pi 3 B+ – Perfect for most homes, $35
- Raspberry Pi Zero 2 W – Ultra budget option, $15
Storage:
- SanDisk 128GB microSD Card – $15-20
Case (Match to your Pi):
- Pi 4 Case – $8-10
- Pi 3 B+ Clear Case – $8-10
- Pi Zero 2 W Clear Case – $8-10
Also Needed:
- Power supply (official recommended)
- Ethernet cable (Cat5e or Cat6)
- Access to your router settings
Total Cost: $58-83
How Pi-hole Works
The Simple Explanation:
- Every device asks "DNS servers" to translate website names (google.com) into IP addresses
- Pi-hole becomes your DNS server
- Before looking up a domain, Pi-hole checks if it's on the blocklist
- If it's an ad/tracker domain → blocked
- If it's a legitimate domain → Pi-hole forwards the request normally
The result: Ads never even load, saving bandwidth and speeding up browsing.
Step-by-Step Setup Guide
Step 1: Install Raspberry Pi OS Lite
Using Raspberry Pi Imager:
- Download from raspberrypi.com/software
- Insert microSD card
- Choose OS → Raspberry Pi OS (other) → Raspberry Pi OS Lite (32-bit)
- Choose Storage → Select your SD card
- Click gear icon (⚙️) for advanced options:
- Set hostname:
pihole - Enable SSH
- Set username and password
- Configure Wi-Fi (if not using ethernet)
- Set locale settings
- Set hostname:
- Click "Write"
Step 2: Boot and Connect
- Insert SD card into Pi
- Connect ethernet cable (recommended)
- Connect power
- Wait 1-2 minutes
Step 3: Find Pi's IP Address
- Use hostname:
pihole.local - Check router for new device
- Use network scanner app (Fing)
Step 4: Connect via SSH
ssh username@pihole.local
Enter your password.
Step 5: Update System
sudo apt update
sudo apt upgrade -y
Step 6: Install Pi-hole
curl -sSL https://install.pi-hole.net | bash
Follow installation wizard:
- Choose network interface (eth0 for ethernet)
- Select upstream DNS (Cloudflare recommended)
- Install web admin interface: Yes
- Install web server: Yes
- Log queries: Yes
- Write down admin password!
Step 7: Set Static IP
On your router:
- Log into router admin
- Reserve IP for Pi (DHCP reservation)
- Use something like 192.168.1.50
Step 8: Configure Router DNS
Critical step:
- Log into router admin
- Find DNS settings
- Set Primary DNS to Pi-hole IP (192.168.1.50)
- Leave Secondary DNS blank
- Save and reboot router
Step 9: Access Web Interface
Open browser:
http://pihole.local/admin
Log in with password from installation.
Step 10: Test It's Working
- Visit a website with ads
- Check Pi-hole dashboard
- You should see queries being blocked!
Using Pi-hole
Dashboard Features
- Total queries blocked
- Query log (real-time)
- Top blocked domains
- Which devices make most requests
Whitelist a Domain
If something is blocked incorrectly:
- Dashboard → Whitelist
- Enter domain
- Add to whitelist
Add More Blocklists
- Group Management → Adlists
- Add blocklist URL
- Tools → Update Gravity
Recommended: firebog.net (curated blocklists)
Disable Temporarily
Click "Disable" button, choose duration.
Troubleshooting
No Ads Being Blocked
- Verify router DNS points to Pi-hole
- Restart router
- Clear device DNS cache
- Check Pi-hole status:
pihole status
Can't Access Websites
- Check Query Log for blocks
- Whitelist blocked domain
- Temporarily disable to test
Pi-hole Not Responding
- Check Pi is powered and connected
- Restart:
pihole restartdns - Reboot Pi:
sudo reboot
Tips for Best Results
Network Reliability:
- Use ethernet, not Wi-Fi
- Quality power supply prevents crashes
- Consider UPS for power outages
Regular Maintenance:
- Update Pi-hole monthly:
pihole -up - Update blocklists: Tools → Update Gravity
- Review false positives weekly
Blocklist Management:
- Don't add too many lists (slows DNS)
- Stick to quality curated lists
- Update weekly
Advanced Features
Local DNS Records
Create custom DNS entries:
- Local DNS → DNS Records
- Add domain and IP
- Access devices by name
Two Pi-holes (Redundancy)
Set up second Pi-hole:
- Primary DNS: Pi-hole #1
- Secondary DNS: Pi-hole #2
- If one fails, other works
VPN Integration
Access Pi-hole remotely:
- Set up VPN (PiVPN)
- Configure VPN to use Pi-hole DNS
- Ad-blocking on phone anywhere
Real-World Impact
Typical results:
- 10-30% of queries blocked
- Faster page loads
- Less bandwidth used
- Better privacy
What gets blocked:
- Website ads (80-95%)
- Mobile app ads (most)
- Smart TV ads (YouTube, etc.)
- Tracking scripts
What doesn't get blocked:
- YouTube website ads (same domain)
- Sponsored social posts
- First-party ads
Privacy and Ethics
Legal? Yes, completely legal.
Ethical?
- Sites lose ad revenue
- Consider whitelisting sites you support
- Subscribe to ad-free versions
What's Next?
Expand your setup:
- Add PiVPN for remote access
- Install Unbound for recursive DNS
- Add Grafana for stats visualization
- Integrate with Home Assistant
Resources
- Pi-hole Docs: docs.pi-hole.net
- r/pihole subreddit
- Blocklists: firebog.net
Final Thoughts
Pi-hole is one of the most practical Pi projects:
✅ Immediate benefits ✅ Family-friendly ✅ Set and forget ✅ $60 one-time investment ✅ Privacy boost
Most users can't imagine going back!
Ready to block ads network-wide? Follow this guide for a cleaner, faster internet!
Disclosure: Troy's Tech Corner participates in the Amazon Associates Program. We may earn a commission from qualifying purchases at no additional cost to you.