Privacy Tools #Pi-hole#DNS blocking#ad blocking

Pi-hole Setup Guide: Network-Wide Ad and Tracker Blocking

Complete guide to installing and configuring Pi-hole on Raspberry Pi. Block ads and trackers for your entire home network with DNS-level filtering.

10 min read

What Is Pi-hole and Why You Need It

Pi-hole is network-level DNS filtering software that blocks ads, trackers, and malware domains for every device on your network. Unlike browser extensions that only work in your browser, Pi-hole works on your phone, smart TV, tablets, and every other device.

How it works: When a device on your network tries to visit an ad server or tracking domain, Pi-hole intercepts the DNS request and returns a blank response. The ad never loads.

Benefits:

  • Block ads on phones and tablets (where extensions don’t work)
  • Faster page load times (fewer trackers to load)
  • Reduced data usage on mobile
  • Protection for all devices automatically
  • Monitor network activity in real-time

Requirements:

  • Raspberry Pi (or any Linux computer)
  • Ethernet or WiFi connection to your router
  • Basic Linux comfort (not hard to learn)

Part 1: Hardware Setup

What You Need

Essential:

  • Raspberry Pi 4 ($35-75) or better—Pi 3 is too slow
  • SD Card (32GB+, UHS-II class recommended)
  • Power Supply (Official Raspberry Pi 27W adapter)
  • Ethernet Cable (recommended for stability)
  • Case (optional but recommended for heat dissipation)

Optional:

  • HDMI cable and monitor (for initial setup)
  • USB keyboard and mouse

Not needed:

  • You don’t need to buy a separate device if you have a Pi already running another purpose—Pi-hole uses minimal resources

Buying Recommendations

Official Source (Most Reliable):

  • Visit raspberrypi.com/products/raspberry-pi-4
  • Or buy official Raspberry Pi starter kits
  • More expensive but guaranteed compatible

Third-Party:

  • Amazon, Newegg, local electronics stores
  • Ensure you’re buying the official Raspberry Pi 4, not clones

Budget Option:

  • Used Raspberry Pi 3B+ or 4 (~$20-40 on eBay)
  • Works fine if you accept slightly slower performance

Part 2: Raspberry Pi OS Installation

Step 1: Prepare Your SD Card

  1. Download Raspberry Pi Imager from raspberrypi.com/software
  2. Install on your computer (Windows, macOS, or Linux)
  3. Insert your SD card into your computer
  4. Open Raspberry Pi Imager
  5. Click Choose device → Select Raspberry Pi 4
  6. Click Choose OS → Select Raspberry Pi OS (64-bit) (Recommended)
  7. Click Choose storage → Select your SD card
  8. Click Settings (gear icon):
    • Enable Set hostname: pi-hole
    • Enable SSH: Use password authentication
    • Set Username: pi
    • Set Password: Choose a strong password
    • Wireless SSID: Enter your WiFi network name
    • Wireless password: Enter your WiFi password
  9. Click Save and then Write
  10. Wait for the SD card to be written and verified (~5 minutes)

Step 2: Boot Your Pi

  1. Insert the SD card into your Raspberry Pi
  2. Connect the Ethernet cable (recommended)
  3. Plug in the power adapter
  4. Wait 2-3 minutes for the Pi to boot
  5. Your Pi will appear on your network as pi-hole

Part 3: Connect to Your Pi

If you set up SSH in the Imager:

  1. Open a terminal on your computer (Mac/Linux) or PowerShell (Windows)
  2. Type: ssh pi@pi-hole or ssh pi@pi-hole.local
  3. Enter the password you set
  4. You’re now connected to your Pi

Alternative: Connect Monitor/Keyboard

If you don’t have SSH set up:

  1. Connect HDMI cable to your Pi and monitor
  2. Connect USB keyboard and mouse
  3. Log in with username pi and your password
  4. Open a terminal (Ctrl+Alt+T)

Part 4: Update Your Raspberry Pi

Before installing Pi-hole, update your system:

sudo apt update
sudo apt upgrade -y

Wait for updates to complete (5-10 minutes).

Part 5: Install Pi-hole

Pi-hole installation is automated with a one-line script.

Installation Command

Run this command in your terminal (you’ll be prompted for your sudo password):

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

This will:

  1. Download Pi-hole
  2. Install dependencies
  3. Configure DNS
  4. Set up the web interface
  5. Generate a random admin password

Installation takes 10-15 minutes. Don’t interrupt it.

During Installation

When prompted, answer:

  • Use IPv4: Yes
  • Use IPv6: Yes (optional, but recommended)
  • Install admin dashboard: Yes
  • Install lighttpd web server: Yes
  • Enable logging: Yes
  • Privacy mode: Your choice (detailed = more logging)

Part 6: Access the Pi-hole Dashboard

Find Your Pi-hole IP Address

After installation, you’ll see a message with your Pi’s IP address, e.g., 192.168.1.100

Log In to the Dashboard

  1. On any computer on your network, open a browser
  2. Go to http://pi-hole.local/admin or http://192.168.1.100/admin
  3. You’ll see a login screen
  4. Click Login (no username needed)
  5. Enter the password shown during installation

Save your password:

  • Go to Settings > Admin > Password
  • Click Change password
  • Set a secure password you can remember
  • Click Save

Part 7: Configure Your Router

For Pi-hole to work, your devices must use Pi-hole as their DNS server.

This makes all devices automatically use Pi-hole:

  1. Log into your router
  2. Go to Settings > DHCP (or DHCP Server)
  3. Find DNS servers or Primary DNS
  4. Set Primary DNS to your Pi-hole IP (e.g., 192.168.1.100)
  5. Clear Secondary DNS or set to empty
  6. Click Save or Apply
  7. Reboot your router

Timing: Takes a few minutes for all devices to update.

Method 2: Manual DNS Configuration (Per Device)

If you can’t configure your router’s DHCP:

Windows 10/11:

  1. Go to Settings > Network & Internet > WiFi (or Ethernet)
  2. Click your network
  3. Go to DNS server assignment > Edit
  4. Change from Automatic to Manual
  5. Toggle IPv4 on
  6. Enter Preferred DNS: 192.168.1.100 (your Pi-hole IP)
  7. Click Save

macOS:

  1. Go to System Settings > Network
  2. Click your WiFi network > Details
  3. Go to DNS
  4. Click + Add DNS Server
  5. Enter your Pi-hole IP: 192.168.1.100
  6. Click OK

iPhone/iPad:

  1. Go to Settings > WiFi
  2. Tap your network > Information
  3. Scroll to DNS
  4. Tap Configure DNS > Manual
  5. Add your Pi-hole IP

Android:

  1. Go to Settings > Network & Internet > WiFi
  2. Long-press your network > Modify
  3. Go to Advanced Options
  4. Change DHCP to Static
  5. Set IP: 192.168.1.xxx (any IP on your subnet)
  6. Set DNS 1: 192.168.1.100 (your Pi-hole IP)
  7. Save

Part 8: Configure Blocklists

Pi-hole’s power comes from blocklists—curated lists of ad and tracking domains.

Default Blocklists

Pi-hole comes with a few default lists. Add more for comprehensive blocking:

  1. Go to Adlists in the Pi-hole dashboard
  2. Scroll to Adlist URL
  3. Paste each blocklist URL and click Add

Recommended Blocklists:

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://adaway.org/hosts.txt
https://www.malwaredomainlist.com/hostslist/hosts.txt
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts
https://www.cedia.org.in/miscellaneous/rogue-hosts-list-2021
https://blocklistproject.github.io/Lists/ads.txt
https://blocklistproject.github.io/Lists/tracking.txt
https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt

Each URL is a text file containing domain names to block.

Update Gravity (Compile Blocklists)

After adding blocklists:

  1. Go to Tools > Update Gravity
  2. Click Update (waits for Pi-hole to refresh its blocklist database)
  3. Gravity update takes 1-5 minutes
  4. Check for errors in the log

Monitor Blocked Queries

  1. Go to the Dashboard tab
  2. Scroll down to see Queries blocked
  3. View Top blocked domains and Top advertisers
  4. This shows what Pi-hole is blocking in real-time

Part 9: Fine-Tuning

Whitelist (Allow) Domains

Some blocklists are too aggressive. Whitelist domains that should load:

  1. Go to Adlist or Whitelist
  2. Add domains you want to allow:
    • Example: If Netflix is blocked, whitelist netflix.com

Blacklist (Block) Domains

Block specific domains not in the default lists:

  1. Go to Blacklist
  2. Add domains to block
  3. Click Add

Regex Filtering

Advanced: Block domains matching patterns:

  1. Go to Tools > Regex Filter
  2. Add regex patterns: Example: .*\.ads\.example\..* blocks all subdomains of ads.example

Part 10: Monitor Your Pi-hole

Check Pi-hole Health

  1. Go to Tools > Gravity
  2. Verify blocklists are up-to-date
  3. Check the date of last update

View Query Logs

  1. Go to Query Log
  2. See all DNS requests from your network
  3. Filter by client device, domain, or status

Monitor Performance

  1. Go to Dashboard
  2. Check:
    • Total queries: Queries over 24 hours
    • Blocked percentage: What % are blocked
    • Clients: Number of devices using Pi-hole
  3. Average home network blocks 5-20% of traffic

Part 11: Advanced: Using Unbound for Recursive DNS

For even more privacy, use Unbound (a recursive DNS resolver) with Pi-hole instead of relying on external DNS servers.

Install Unbound

  1. SSH to your Pi
  2. Run: sudo apt install unbound -y
  3. Download the root hints file:
    curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache

Configure Pi-hole to Use Unbound

  1. In the Pi-hole dashboard, go to Settings > DNS
  2. Under Upstream DNS Servers, uncheck all defaults
  3. Check Add custom DNS records
  4. Enter: 127.0.0.1#5335 as a custom upstream
  5. Save

This makes Pi-hole query Unbound recursively, which queries root nameservers directly—no reliance on external DNS services.

Part 12: Backup Your Configuration

Protect your Pi-hole setup:

  1. Go to Settings > Teleporter
  2. Click Download backup
  3. Save the .tar.gz file somewhere safe
  4. If your Pi fails, you can restore this backup to a new Pi

Troubleshooting

Devices Not Using Pi-hole

  1. Check router DHCP settings
  2. On the device, manually flush DNS:
    • Windows: ipconfig /flushdns
    • Mac: sudo dscacheutil -flushcache
    • Linux: sudo systemctl restart systemd-resolved
  3. Restart the device

Too Many False Positives (Websites Breaking)

  1. Check the query log for the blocked domain
  2. Add it to the whitelist
  3. Adjust blocklist aggressiveness (remove overly strict lists)

Pi-hole Dashboard Won’t Load

  1. SSH to your Pi: ssh pi@pi-hole
  2. Check if lighttpd is running: sudo systemctl status lighttpd
  3. If not, restart: sudo systemctl restart lighttpd

Pi-hole Running Slowly

  1. Check CPU usage: top command
  2. If CPU is high, reduce blocklists
  3. Ensure adequate cooling (Pi running hot = throttled performance)

Maintenance

Monthly:

  • Review blocked queries (check for false positives)
  • Update blocklists (usually automatic)
  • Check Pi-hole temperature

Quarterly:

  • Update Raspberry Pi OS: sudo apt update && sudo apt upgrade -y
  • Update Pi-hole: pihole -up

Annually:

  • Back up configuration using Teleporter
  • Review and prune blocklists

Conclusion: Network-Level Privacy

Pi-hole turns your home network into a privacy fortress. Every device automatically gets ad and tracker blocking—no configuration needed per device.

Setup takes 30-45 minutes the first time, but the long-term benefit is enormous. Your phones, tablets, smart TVs, and computers all benefit from the same protection.

Start with the default blocklists and add more as you discover domains you want blocked. Your network will be faster, cleaner, and more private.

#privacy #network #Raspberry Pi #ad blocking #DNS blocking #Pi-hole