All weeks

Weekly entry

Tracing DNS with Unbound.

I configured Pi-hole to forward DNS to my local Unbound resolver at 127.0.0.1#5335. Using dig and tcpdump, I followed recursive DNS delegation for arnauabella.net to Cloudflare's authoritative nameservers.

On the Pi-hole host, I checked that blocking was enabled and both services were running:

sudo pihole status
systemctl status --no-pager pihole-FTL unbound

Pi-hole reported blocking enabled, and both pihole-FTL and unbound were active (running). I queried Unbound directly on its non-standard local port, then queried Pi-hole on its normal DNS port:

dig @127.0.0.1 -p 5335 arnauabella.net A
dig @127.0.0.1 arnauabella.net A

Both returned a successful answer; the address records can vary with Cloudflare's CDN. In a second terminal on the Pi-hole host, I followed the live query log:

sudo pihole -t

After running a lookup in another terminal, a cache miss showed it being forwarded to 127.0.0.1#5335; a Pi-hole cache hit had no forwarding line.

To see Unbound's upstream DNS traffic, I ran this in another terminal and then generated a fresh lookup:

sudo tcpdump -ni any 'port 53'

On a cache miss, packets to and from DNS servers on port 53 showed Unbound doing the upstream work. This capture does not include Pi-hole's local forwarding connection on port 5335. Repeating a cached lookup may show no upstream packets, so an empty capture is not by itself a fault. Ctrl-C stops the capture.

The public delegation is easy to check separately:

dig NS arnauabella.net +short

It returned Cloudflare *.ns.cloudflare.com nameservers: Cloudflare is authoritative for the public zone, which is different from being the recursive resolver used by my clients.

Checking a browser query

I also tried dnsleaktest.com from a client using Pi-hole. In one terminal on the Pi-hole host, I watched the live log:

sudo pihole -t

Then I ran the test in the client's browser. Pi-hole showed test.dnsleaktest.com from that client being forwarded to 127.0.0.1#5335.

The result reported the public egress IP and the hostname associated with its reverse PTR, often an ISP-named hostname. To look up the PTR, replace this documentation-only address with the public IP shown by the test:

dig -x 203.0.113.1 +short