Home » Raspberry Pi users can now block ads and hide DNS history with Pi-hole and Unbound

Raspberry Pi users can now block ads and hide DNS history with Pi-hole and Unbound

By

–

Raspberry Pi users can now block ads and hide DNS history with Pi-hole and Unbound

Raspberry Pi users can now build a fully private DNS stack that removes public resolvers from the loop by pairing Pi-hole with Unbound on a single board. A new guide demonstrates how the combination creates a local recursive DNS server that queries root and authoritative servers directly, though it requires a WireGuard tunnel to encrypt the traffic leaving the device.

The Privacy Gap in Standard Pi-hole Setups

Pi-hole filters incoming DNS requests against blocklists to strip out ads and trackers, but it cannot complete resolution on its own. It must forward allowed queries to an upstream resolver such as Google DNS or Cloudflare. That handoff means a third party still receives the full list of domains a household visits. The guide notes that switching from an ISP resolver to a public one only changes which company logs the usage patterns.

When a computer requests a website, the query travels to the router, which forwards it to the Pi-hole. The Pi-hole checks the domain against its blocklists, then sends the cleaned query to the public resolver. The resolver returns the IP address, and the page loads. Throughout this chain, the public resolver sees every domain the user allows.

How Unbound Enables Local Recursive Resolution

Unbound runs alongside Pi-hole as a recursive caching resolver. Instead of asking a public provider, it walks the DNS hierarchy itself: it queries the root servers, which refer it to the top-level domain servers for extensions such as .com, which in turn point to the authoritative server that holds the final IP address. The answer is cached locally so repeat lookups are faster.

Raspberry Pi 4 on a network switch.jpg
Photo: RAIL P (RAIL.PHOTOGRAPHY) (CC0)

The author deployed both services on a Raspberry Pi Zero 2 W. With this arrangement, the DNS sinkholing and the resolution happen on the same hardware. No public resolver sits in the middle. However, Unbound sends its queries in plaintext by default. An ISP or any network observer can still monitor the domains being resolved, which undermines the privacy goal.

WireGuard Adds the Missing Encryption Layer

To close that exposure, the guide recommends routing traffic through a WireGuard VPN tunnel. An encrypted tunnel from the client device to the Pi-hole server protects the query on the first leg. Routing Unbound’s own outbound queries through the same tunnel secures the second leg, hiding the recursive walk from the ISP. The author describes this as a configuration meant for users who prioritize privacy above convenience.

Step-by-Step Configuration on Raspberry Pi Zero 2 W

The setup begins with a standard Pi-hole installation on the Zero 2 W. Unbound is then installed and configured to listen on a port that does not conflict with Pi-hole’s DNS service. The Pi-hole upstream DNS setting is pointed at the local Unbound instance. Once the cache warms up, the initial latency fades and browsing speeds normalize.

Performance tests in the guide show that rarely visited sites load slightly slower on the first request because Unbound must traverse the full recursion path. As the cache populates, subsequent lookups resolve quickly from local memory.

Alternative: Running the Stack on Windows 11

A second guide demonstrates that the same architecture works without a Raspberry Pi. AdGuard Home and Unbound both provide Windows builds and can run as services on Windows 11. To avoid a port conflict — both tools default to port 53 — Unbound is configured to listen on port 5335. AdGuard Home keeps port 53 and is told to use 127.0.0.1:5335 as its upstream resolver.

The author reports the Windows setup takes roughly four minutes. A DNS leak test should identify the ISP as the resolver, confirming that no public provider is in the path. If a public resolver appears, the guide suggests checking for a second network adapter still using an old DNS address or a browser configured to use encrypted DNS independently.

Cache Building and QNAME Minimization

Both guides note that the recursive approach distributes lookups across the DNS hierarchy. With QNAME minimization enabled, root and top-level domain servers see only the portion of the domain name needed to direct the query. The authoritative server for the destination domain sees the full query originating from the home IP. No single company receives the complete history.

The Windows guide highlights a practical catch: blocking dns.msftncsi.com, the domain Windows uses to verify internet connectivity, causes the operating system to report “no internet” even when the connection is working. The author advises running AdGuard Home’s default filter list for at least a week to understand the log before adding custom blocks.

Limitations and What Comes Next

Neither setup replaces a full VPN. The ISP still sees the IP addresses the user connects to after resolution. The recursive DNS layer only owns the lookup history. Users who want to extend the protection to other devices can point them at the local resolver, though the WireGuard tunnel must be configured on each client for end-to-end encryption.

Sources

Photo: Laserlicht (CC BY-SA 4.0)

Get breaking stories first on our Telegram channel.

More stories by

Most read

Education

How-To & DIY

Family & Relationships

World News