Skip to content
article

Pi-hole + Unbound on an old Pi 3B: my setup after 2 year, full config

Your own recursive DNS at home. No more sending every query to Google or to the ISP

May 27, 2026 · 3 min read

Hi all, this is my first long post here. My Pi 3B is the oldest thing in my homelab and still the most important, because when it is down the whole house have no internet and my wife know exactly who to blame :)

Why Unbound and not only Pi-hole

Pi-hole alone block ads, but it still forward every query to some upstream (Google, Cloudflare, or your ISP). My ISP DNS here sometimes is slow, and when I type a domain wrong it redirect me to their own search page with ads. Very annoying. With Unbound, the Pi talk directly to the root servers, then the TLD servers, then the real authoritative server. No single company see all my queries.

Hardware

  • Raspberry Pi 3B (1GB), from 2017
  • Boot from USB SSD, not SD card (I learn this the hard way, like Matt say in his SD card post)
  • Small UPS for router + Pi, because power cut

Step 1: Pi-hole

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

Give the Pi a static IP first (DHCP reservation on router is best). In the installer, the upstream does not matter, we change it later.

Step 2: Unbound

sudo apt install unbound

Create /etc/unbound/unbound.conf.d/pi-hole.conf. This is close to the one in the Pi-hole docs, I only change small things:

server:
    verbosity: 0
    interface: 127.0.0.1
    port: 5335
    do-ip4: yes
    do-udp: yes
    do-tcp: yes
    do-ip6: no
    prefer-ip6: no
    harden-glue: yes
    harden-dnssec-stripped: yes
    use-caps-for-id: no
    edns-buffer-size: 1232
    prefetch: yes
    num-threads: 1
    so-rcvbuf: 1m
    private-address: 192.168.0.0/16
    private-address: 169.254.0.0/16
    private-address: 172.16.0.0/12
    private-address: 10.0.0.0/8
    private-address: fd00::/8
    private-address: fe80::/10

Unbound listen only on localhost port 5335, so only Pi-hole can use it.

Step 3: the Debian gotcha

On Bookworm, the unbound package also bring a service that push Unbound into resolvconf, and then strange things happen (Pi-hole start, then DNS stop working after reboot). Disable it:

sudo systemctl disable --now unbound-resolvconf.service

And in /etc/resolvconf.conf comment out the line unbound_conf=... if you have it. Then:

sudo systemctl restart unbound

Step 4: test before you switch

dig pi-hole.net @127.0.0.1 -p 5335
# first time slow (100-300ms from Vietnam), second time ~0ms because cache

dig fail01.dnssec.works @127.0.0.1 -p 5335
# must be SERVFAIL. this domain has broken DNSSEC on purpose

dig +ad dnssec.works @127.0.0.1 -p 5335
# must be NOERROR and you see "ad" in the flags line

If the second one say NOERROR, DNSSEC is not working, stop and check.

Step 5: point Pi-hole to Unbound

Pi-hole admin, Settings, DNS. Untick all upstream servers. In custom upstream put 127.0.0.1#5335. Save.

Then on the router, DHCP should give the Pi-hole IP as DNS to every device. My ISP router does not allow to change the DNS (very very common in VN), so I turn off DHCP on the router and use the DHCP server inside Pi-hole. Works fine for 2 years.

Numbers after 2 year

  • Around 28-34% of queries blocked, most of it is smart TV and one Android phone that I will not name (my mother in law)
  • Cache hit average ~0-1 ms, cache miss 80-300 ms. Prefetch help a lot for the domains you use every day
  • Pi 3B load average 0.05. It does not care

Please do NOT

Do not open port 53 to the internet. An open resolver on the internet will be used in DNS amplification attacks within days, and your ISP will be not happy with you. For DNS outside home, use VPN back to home.

hope this help :)

Written by

Nguyễn Minh Hiếu

Proxmox, Docker, ZFS, and a power bill my wife asks about. HCMC 🇻🇳 Backend dev by day, homelab by night. Founder of Self Hosted. Back up your data, seriously.

Get the best of #raspberry_pi_lab weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.

Comments

8

Sign in to join the conversation.

Sign in to comment
Matt O'Brien@pi_tinker_matt#1 in Pi Lab
Beauty Hieu. The dnssec.works test is the bit everyone skips. Mine said NOERROR the first time and I'd have never known
3 net votes
Lena Hoffmann@arch_btw_lena3 rep in Pi Lab
small note for germans and everyone on DS-Lite: you have almost no real ipv4, so do-ip6: yes or unbound will have a bad time. otherwise exactly my setup, or?
3 net votes
Nguyễn Minh Hiếu@homelab_hieu#4 in Pi Lab
good point Lena, thank you. in VN most ISP give v4 still so I turn off v6 to make it simple
2 net votes
Graham Whitfield@greybeard_graham#7 in Pi Lab
A Pi 3B doing important work for years on end is the best advertisement the Pi people never paid for. Good write-up, and the bit about port 53 should be in bold. Cheers, G.
3 net votes
Wolfgang Engel@dsgvo_wolf1 rep in Pi Lab
Good post. One privacy nuance people should understand: recursive resolution is better than handing everything to Google, but the queries to the authoritative servers still go out unencrypted, so your ISP can still see them. Forwarding over DoT to a provider hides them from the ISP but then you trust that provider. Neither is "private". Pick your adversary.
3 net votes
Nguyễn Minh Hiếu@homelab_hieu#4 in Pi Lab
yes this is fair. my adversary is the ISP ads page :D
2 net votes
Trần Phương Thảo@thao_qa1 rep in Pi Lab
anh Hiếu ơi em làm theo được rồi nha, phải tắt cái unbound-resolvconf mới chạy 😅 cảm ơn anh nhiều
2 net votes
Nguyễn Minh Hiếu@homelab_hieu#4 in Pi Lab
hihi tốt quá, nhớ đặt IP tĩnh cho Pi nha, không thì mai mốt router đổi IP là cả nhà mất mạng :D
1 net votes