Shut your hole¶
Noise Canceled Internet with Pi-hole¶
Yehuda Deutsch¶
The modern web is loud¶
Ads, trackers, and telemetry follow you from page to page and app to app
- Every page load calls dozens of third-party domains
- Apps and smart devices phone home constantly
- Browser extensions only cover the browser
- Your TV, your fridge, and your guests' phones don't run uBlock
The plan¶
Block the noise at the network level, before it ever reaches your devices
- Pi-hole on a Raspberry Pi
- Blocklists - what, where, and how many
- Custom allow / block rules
- Unbound - recursive DNS and internal names
- WireGuard - taking it on the road
- Questions
Who am I?¶
Yehuda Deutsch¶
Software Developer with a sweet tooth for infrastructure
Principal DevOps Engineer at Palo Alto Networks SDLC / Internal Platform
Open Source / Data / Knowledge activist
Self Hoster
A note on these slides¶
- Slides were generated with the help of AI / LLM tools
- All knowledge is based on actual use and experience
- Content has been thoroughly reviewed
- The title was generated with the assistance of my 7-year-old
How does Pi-hole work?¶
A DNS sinkhole - it answers every DNS query on your network, and lies about the bad ones
- Devices ask Pi-hole "where is
ads.example.com?" - Blocked domain - Pi-hole answers
0.0.0.0 - Allowed domain - Pi-hole asks upstream, caches and answers
- The connection to the tracker never happens
Only the questions, not the traffic¶
Pi-hole controls name resolution, nothing else
- Only DNS queries reach Pi-hole
- The traffic itself still routes as usual - device → router → internet
- Pi-hole never sees, inspects or filters the actual connections
- Not a firewall, not a proxy - if Pi-hole is down, nothing resolves, but routing still works
Caveats¶
Blocking a name blocks everything behind it
- Same domain for ads and content - can't block one without the other
- Paramount+ - ads share a domain with watch-time tracking: block it, lose your watch position
- Hardcoded DNS and DNS-over-HTTPS skip Pi-hole entirely
One layer, not the whole wall¶
Pi-hole is part of the protection, not all of it
- Browser extensions - see the page, block by URL and element
- Filtering DNS services (OpenDNS, NextDNS, Quad9...) - protection off the home network
- Device and OS settings - telemetry toggles, app permissions
- Complementary, not instead - each layer covers what the others can't
The hardware¶
Pi-hole is light, any Raspberry Pi will do
- Raspberry Pi (even a Zero 2 W), wired Ethernet preferred
- Raspberry Pi OS Lite (64-bit) via Raspberry Pi Imager
- Preconfigure hostname, user and SSH in the Imager
- Give it a fixed address - DHCP reservation on the router
Installing Pi-hole¶
sudo apt update && sudo apt full-upgrade -y
curl -sSL https://install.pi-hole.net | bash
# or, if you read before you pipe:
wget -O basic-install.sh https://install.pi-hole.net
less basic-install.sh
sudo bash basic-install.sh
# set the web interface password
pihole setpassword
Web interface: http://<pi-address>/admin
Point the network at it¶
The "no per-device configuration" part
- Router DHCP settings - DNS server = Pi-hole address
- Remove any secondary DNS (it will be used to bypass)
- Or let Pi-hole be the DHCP server, if the router can't
- Renew leases (or wait) and watch the query log fill up
Lists - the concepts¶
- Gravity - all subscribed lists, compiled into one database
- Block lists and allow lists - both can be subscribed
- Formats - hosts file, plain domains, ABP style (
||domain^) - Groups - assign lists and rules to specific clients
- Updated weekly, or on demand with
pihole -g
Lists - choosing¶
More domains is not more silence, it's more breakage
- Start with one good list, add only when you notice noise
- Prefer maintained lists over huge stale ones
- Overlap is free, false positives are not
- Know your household's tolerance
Lists - where to look¶
- StevenBlack/hosts - the default, a solid baseline
- HaGeZi DNS blocklists - tiered from Light to Ultimate
- OISD - big / small, focused on low false positives
- The Firebog - curated collection, ticked lists are "safe"
Custom allow / block¶
Your rules win over the lists
| Kind | Matches | Example |
|---|---|---|
| Exact | exactly that domain | s.youtube.com |
| Wildcard | domain and all subdomains | tiktok.com |
| Regex | anything matching the pattern | (^\|\.)tracking\. |
Allow beats block, exact beats regex
Custom allow / block - CLI¶
# block
pihole deny ads.example.com --comment "noisy"
pihole --wild tiktok.com
pihole --regex '(^|\.)telemetry\.'
# allow
pihole allow s.youtube.com --comment "watch history"
pihole --allow-wild example-cdn.com
# remove
pihole deny -d ads.example.com
# where did it come from?
pihole -q s.youtube.com
Or the web interface - Domains page, with groups and comments
Unbound - why?¶
Pi-hole still needs an upstream to answer the questions it doesn't block
- Recursive - asks the root, TLD and authoritative servers directly
- No single upstream provider sees all your queries
- DNSSEC validation
- Lightweight - a few MB of RAM, same Pi
- Internal names for your home-hosted services
Installing Unbound¶
server:
interface: 127.0.0.1
port: 5335
do-ip6: no
harden-glue: yes
harden-dnssec-stripped: yes
edns-buffer-size: 1232
prefetch: yes
private-address: 192.168.0.0/16
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
Wire it to Pi-hole¶
sudo unbound-checkconf
sudo systemctl restart unbound
# test Unbound directly
dig pi-hole.net @127.0.0.1 -p 5335
dig dnssec-failed.org @127.0.0.1 -p 5335 # SERVFAIL - good
# make it Pi-hole's only upstream
sudo pihole-FTL --config dns.upstreams '["127.0.0.1#5335"]'
Or in the web interface: Settings → DNS → custom upstream 127.0.0.1#5335
Full resolution vs. upstream filtering¶
| Full resolution | Forward to a filtering service | |
|---|---|---|
| Who sees all your queries | Nobody | The provider |
| Who sees each query | The servers for that zone, and your ISP | Only the provider (encrypted) |
| Extra filtering | Pi-hole lists only | Provider's malware / phishing / category blocks |
| Dependency | Root and authoritative servers | The provider being up |
| First lookup | Slower, then cached | Fast, big shared cache |
Either way - Pi-hole filters first, Unbound keeps the local zone
Unbound - forwarding upstream¶
server:
tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
forward-zone:
name: "."
forward-tls-upstream: yes
# Quad9 - malware blocking, DNS over TLS
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
sudo unbound-checkconf && sudo systemctl restart unbound
dig isitblocked.org @127.0.0.1 -p 5335 # NXDOMAIN - Quad9 is filtering
A local zone¶
Names for the things you host at home
server:
local-zone: "mytoynet.de." static
local-data: "nas.mytoynet.de. IN A 192.168.1.10"
local-data: "jellyfin.mytoynet.de. IN A 192.168.1.20"
local-data: "pihole.mytoynet.de. IN A 192.168.1.2"
local-data-ptr: "192.168.1.10 nas.mytoynet.de"
Why a dedicated domain?¶
A cheap domain, used only at home
- Real TLS certificates via ACME DNS-01 - no IPs published
- Wildcard certificate -
*.mytoynet.de - You own the resolution - no accidental answers from other networks
- Avoids the
.corp,.dev, and notoriously.localaccidents
redirect vs transparent¶
| Zone type | Name has local-data | Name has no local-data |
|---|---|---|
static |
local answer | NXDOMAIN |
transparent |
local answer | resolve normally |
redirect |
zone's answer for every name in the zone | (n/a) |
server:
local-zone: "mytoynet.de." transparent # nas is local, www is public
local-data: "nas.mytoynet.de. IN A 192.168.1.10"
local-zone: "apps.mytoynet.de." redirect # *.apps -> reverse proxy
local-data: "apps.mytoynet.de. IN A 192.168.1.30"
WireGuard - on the road¶
Take the silence (and your home services) with you
- VPN tunnel from your phone / laptop back home
- Client uses the home Pi-hole as its DNS
AllowedIPsdecides what goes through the tunnel
[Interface]
DNS = 192.168.1.2
[Peer]
Endpoint = home.example.com:51820
AllowedIPs = 192.168.1.0/24, 10.8.0.0/24 # home only
# AllowedIPs = 0.0.0.0/0, ::/0 # everything
Glossary - DNS & Pi-hole¶
| Term | Meaning |
|---|---|
| DNS | The internet's phone book - names to IP addresses |
| Resolver | The server that answers a device's DNS questions |
| Upstream / forwarder | A resolver that passes questions on to another resolver |
| Recursive resolver | Asks the root, TLD and authoritative servers itself |
| Sinkhole | Answers blocked names with a dead address (0.0.0.0) |
| Gravity | Pi-hole's compiled database of all subscribed lists |
| DHCP | Hands devices their IP address, gateway and DNS server |
| DoH | DNS over HTTPS - can bypass the network's resolver |
Glossary - Zones, TLS & tunnels¶
| Term | Meaning |
|---|---|
| A / PTR / TXT | Name → IPv4 / IP → name / free text (used for verification) |
| Zone | A domain and everything under it |
| Split horizon | Same name, different answers inside and outside |
| DNSSEC | Signatures proving DNS answers weren't tampered with |
| ACME DNS-01 | Prove domain control with a TXT record, get a certificate |
| CT logs | Public logs of every certificate issued |
| Reverse proxy | One entry point, routes requests to services by hostname |
| Split tunnel | VPN carries only some traffic, the rest goes direct |
ATAQ?¶
Links - Pi-hole & DNS¶
- Pi-hole - pi-hole.net
- Pi-hole + Unbound guide - docs.pi-hole.net/guides/dns/unbound
- Raspberry Pi Imager - raspberrypi.com/software
- Unbound - nlnetlabs.nl/projects/unbound
- StevenBlack hosts - github.com/StevenBlack/hosts
- HaGeZi - github.com/hagezi/dns-blocklists
- OISD - oisd.nl
- The Firebog - firebog.net
Links - TLS, VPN & friends¶
- WireGuard - wireguard.com
- wg-easy - github.com/wg-easy/wg-easy
- Let's Encrypt - letsencrypt.org
- certbot - certbot.eff.org
- acme.sh - github.com/acmesh-official/acme.sh
- lego - go-acme.github.io/lego
- uBlock Origin - ublockorigin.com
- OpenDNS - opendns.com
- NextDNS - nextdns.io
- Quad9 - quad9.net