Field notes · DNS

Encrypting your home DNS: what it really hides (Pi-hole + Unbound + DoT)

I wanted my internet provider to stop seeing the DNS queries of my home network. This is the chain I built, how I checked it, and, just as important, what it still leaves visible.

What I wanted

Every time a device looks up a site, it sends a DNS query: “what is the address of this name?”. By default these queries travel in plain text through the provider’s network, which can read them.

My goal was narrow: stop my internet provider from seeing the DNS queries of my home network. Nothing more. It is not about making my browsing invisible, and I will explain below why this setup cannot do that.

The chain

In words, hop by hop:

  1. My PC asks Pi-hole, a server at home. This first hop stays in plain text, but it never leaves the local network.
  2. Pi-hole passes the query to Unbound, another service on the same home machine, running in a Docker container.
  3. Unbound sends it to a second Unbound running on a small rented server, using DNS over TLS (DoT) on port 853. This is the only leg that leaves the house, and it is encrypted.
  4. That server forwards it to Cloudflare 1.1.1.1, again over DoT.

The queries do not disappear, they move. Cloudflare still answers them. I moved the trust from my provider to a resolver I chose; I did not remove it.

The settings that mattered

  • forward-tls-upstream: yes in Unbound, so it talks TLS to its upstream instead of plain DNS.
  • The server’s name after its address, as in forward-addr: <address>#<name>, so that Unbound checks the server’s certificate against the system certificate bundle.
  • A Let’s Encrypt certificate for the DoT server.
  • Access to port 853 limited, by the firewall, to my home’s IP address. A DoT port open to everyone would make the server a public resolver.
  • No query log, so there is no history of my lookups sitting on a server.

How I checked it

A chain that looks right is not a test, so I looked at the traffic.

  • Capture on the rented server. I ran tcpdump on port 53 for 40 seconds and, at the same time, did an nslookup for a made-up name. No plain DNS packet left the server. The only thing I saw was an incoming scan.
  • Listening ports. On that server, port 53 listens only on the local addresses of systemd-resolved.
  • Cloudflare’s test page. one.one.one.one/help shows “DNS over HTTPS: No” and “DNS over TLS: Yes”, which is what this chain should look like from their side.
  • The home server. On my home server, no plain port 53 traffic goes out to the Internet, except the separate resolver of my mail server, which I deliberately left in plain text for spam blocklist lookups.
  • The server’s certificate. I checked it with openssl s_client: “Verification: OK”, server name confirmed, return code 0.
  • IPv6, on my PC. My home server has a public IPv6 address, while the Unbound on it listens on IPv4 only. On my PC (Linux), resolvectl status shows only one DNS server, my home server, and no IPv6 DNS server announced by my provider’s router. I checked only this PC, not my other devices.

These are spot checks, not a proof. Forty seconds of capture tells you about those forty seconds.

What this does not hide

My provider can no longer read my DNS queries. It still sees plenty:

  • the IP addresses I connect to;
  • volumes and timings;
  • the name of the site, in the HTTPS connection itself. This is the SNI, the site name sent at the start of a TLS connection. It stays readable as long as the site does not publish ECH (Encrypted Client Hello). Whether ECH is available also depends on the browser, the resolver and how they are configured.

So I closed one door. The traffic itself is as visible as before.

A small ECH measurement

To see whether ECH is something I can count on, I ran dig HTTPS on nine popular sites and looked for an ech= key in the answer: cloudflare.com, google.com, youtube.com, wikipedia.org, tiktok.com, x.com, amazon.fr, github.com and lemonde.fr.

None of the nine publishes an ech= key. By contrast, crypto.cloudflare.com, Cloudflare’s own test site, does.

I also checked that my chain was not the cause: the two answers are identical when I query 1.1.1.1 directly. The chain removes nothing.

This is a small sample that I picked myself, not a study. It says nothing about the web as a whole. For these nine sites, it means the site name stays visible in the connection.

The Firefox trap

Firefox can use its own DNS over HTTPS (DoH) to Cloudflare. When it does, it goes around Pi-hole and the whole chain: the queries leave directly, and Pi-hole’s filtering no longer applies.

To keep the filtering, turn it off: Settings > Privacy & Security > DNS over HTTPS.

It can be a trade-off: turning DoH off may also mean going without ECH in the browser. I have not verified this in Firefox, and it may depend on the version.

The fragile point

With forward-first, if the DoT link fails, Unbound can fall back to resolving directly, in plain text, without any alert. Everything keeps working, which is exactly the problem: the privacy leaves silently while the browsing carries on.

My forward zone does have forward-first: yes: if the rented server stops answering, Unbound can resolve names itself, in plain text, without warning me. For me this is a real risk. I have not tested this fallback.

Two things can break the link:

  • My home’s public IP address changes. The firewall on the rented server only allows the old one.
  • The certificate expires. The renewal hook must reload the service, otherwise the renewed certificate is not used.

So both have to be watched on purpose: the public IP of the house and the certificate renewal.

Check it yourself

Three generic commands. Replace the placeholders with your own values:

dig HTTPS <site>
sudo tcpdump -ni <interface> 'port 53'
curl -4 https://ifconfig.me
  • dig HTTPS <site> shows the site’s HTTPS record. Look for ech= in the answer.
  • tcpdump shows the DNS traffic on an interface. Run an nslookup for a made-up name in another terminal while it captures. If DNS packets go out in plain text toward Internet addresses, something leaks.
  • curl -4 https://ifconfig.me prints your current public IPv4 address, to compare with the one your firewall allows. It asks a third-party site, so it sees that address.

In the end

I closed the DNS door. I did not make my browsing invisible.

This is not a VPN. It does not protect against a provider that reads the SNI, and it still shows IP addresses, volumes and timings. It also has a silent failure mode that I have to keep an eye on.

If the goal is the one I had, that my provider stops seeing my DNS queries, this does it, as far as my checks show. If you expect more than that, it is not there.