Lab / FreeBSD / DNS / Privacy / Security / Networking
FreeBSD Local Unbound: DNSSEC with Quad9 DoT
By Loopback 8 min read

FreeBSD local Unbound can send DNS queries directly to Quad9 over DNS over TLS, or DoT. It caches answers and validates DNSSEC locally. Unbound handles the encrypted upstream connection itself.
This guide uses Quad9's unfiltered service at 9.9.9.10 and 149.112.112.10, authenticated as dns10.quad9.net. It configures DNS for the FreeBSD host itself. Quad9's FreeBSD guide describes this use of the base local_unbound service. For a resolver serving other machines, use the full Unbound package and configure network access separately.
DoT versus DoH: what changes?
Both protocols encrypt DNS traffic between a client and its chosen resolver. DNS over TLS sends DNS messages through a TLS connection, normally on TCP port 853. DNS over HTTPS puts DNS messages inside HTTPS requests, normally using port 443.
| Detail | DoT | DoH |
|---|---|---|
| Transport | DNS directly over TLS | DNS inside HTTPS |
| Usual port | TCP 853 | HTTPS 443 |
| Unbound forwarding to Quad9 | Native support | Requires a separate DoH forwarder |
| Network policy | Dedicated port is easy to identify or block | Shares the HTTPS port, though endpoints can still be blocked |
| Typical configuration | System or network resolver | System resolver, application or browser |
Unbound added downstream DoH in version 1.12.0. That lets clients send HTTPS queries to Unbound. Its DoH documentation describes receiving those requests. Forwarding from Unbound to Quad9 is the opposite direction, where native DoT avoids the extra proxy service.
The selected resolver can read queries with either protocol. Encrypting DNS alone does not hide the destination IP addresses of later connections. Browser-level DoH can also bypass a system resolver, so check browser and VPN settings when testing this setup.
DoT is simpler here because Unbound already supports the required upstream transport. That does not establish that DoT is always faster. Connection reuse, resolver load, routing and cache state all affect lookup time.
Unfiltered DNS still has DNSSEC
Quad9's service table identifies dns10.quad9.net as its unfiltered encrypted-DNS hostname. This service omits threat blocking and EDNS Client Subnet. It can return a malicious domain's valid DNS answer because malware filtering is outside this service's scope.
Older descriptions of the .10 service as non-validating are out of date. Quad9 enabled DNSSEC across its endpoints from June 15, 2026. Unfiltered does not mean accepting invalid DNSSEC signatures.
TLS authenticates the resolver and encrypts the connection. DNSSEC authenticates signed DNS data through a chain of trust. Unsigned zones remain unsigned. This configuration keeps Unbound's local validator and root trust anchor even though Quad9 also validates, adding local checks and some processing overhead.
The query path is short:
Applications -> local Unbound on 127.0.0.1:53
-> Quad9 over authenticated TLS on TCP 853
The first hop stays on loopback. Only the upstream connection needs TLS.
Prepare FreeBSD and save the current configuration
These instructions target FreeBSD 15.1. Use a test host with console access, working DNS and an accurate clock. Run configuration commands as root. Do not replace an existing resolver configuration without checking its local zones, forwarding rules and service state.
We checked the configuration with Unbound 1.25.1 on FreeBSD 15.1-RELEASE-p6 and started a temporary resolver on a separate loopback port. Queries did not complete. Direct TLS probes to both Quad9 addresses on port 853 timed out, while certificate verification on port 443 succeeded. Full DoT resolution and reboot testing remain unverified from that host.
Check the OS, current listener and CA bundle:
freebsd-version -kru
service local_unbound status
sockstat -46 -l
test -s /etc/ssl/cert.pem
Port 53 must be available or already belong to the local Unbound instance you intend to reconfigure. Stop if the CA bundle check fails. Repair the system's certificate store before proceeding. TLS verification also depends on the clock being correct.
Save the original files and record whether local Unbound was running and enabled:
backup=$(mktemp -d /root/unbound-dot.XXXXXX)
cp -p /etc/rc.conf /etc/resolv.conf "$backup/"
[ ! -e /etc/resolvconf.conf ] || cp -p /etc/resolvconf.conf "$backup/"
cp -a /var/unbound "$backup/"
printf '%s\n' "$backup"
Keep that printed path for recovery.
Configure native DoT to Quad9
FreeBSD's local_unbound service exposes TLS and forwarder settings. Prepare the DNSSEC root anchor while the original DNS path still works:
service local_unbound anchor
test -s /var/unbound/root.key
Stop if no nonempty key file exists. Keep that file owned and writable as required by the unbound service account so trust-anchor maintenance can work.
Create /var/unbound/conf.d if necessary. Add /var/unbound/conf.d/dot.conf with:
server:
interface: 127.0.0.1
access-control: 127.0.0.0/8 allow
do-ip6: no
module-config: "validator iterator"
This example uses IPv4 transport and a loopback-only listener. It can still return AAAA records. The upstream connection goes directly to the remote servers.
Set both upstream addresses and enable TLS:
sysrc local_unbound_tls="YES"
sysrc local_unbound_forwarders="9.9.9.10@853#dns10.quad9.net 149.112.112.10@853#dns10.quad9.net"
service local_unbound setup
service local_unbound configtest
The setup command changes /etc/resolv.conf to use local Unbound. Complete the checks and start the service promptly. Restore the saved resolver files if configuration fails.
The FreeBSD setup helper generates the trust-anchor, control-socket and include settings. With TLS enabled it also selects /etc/ssl/cert.pem. Check /var/unbound/unbound.conf for those settings and the conf.d include instead of replacing the generated file with a smaller example.
Inspect /var/unbound/forward.conf. It should contain this zone, with forward-first: no made explicit:
forward-zone:
name: "."
forward-tls-upstream: yes
forward-first: no
forward-addr: 9.9.9.10@853#dns10.quad9.net
forward-addr: 149.112.112.10@853#dns10.quad9.net
The #dns10.quad9.net suffix supplies the certificate name to authenticate. Keep it on both addresses. Numeric upstream addresses avoid needing a DNS lookup to locate Quad9 before DNS is working.
The Unbound forwarding reference documents forward-first: no as disabling recursive fallback. A blocked or failed TLS upstream should produce a lookup failure instead of a retry through ordinary recursion. Both listed addresses belong to Quad9, so they do not provide provider diversity.
Supplying forwarders explicitly makes the helper select static DNS configuration. Check /etc/resolvconf.conf for libc="NO" and ensure an old unbound_conf rule is not left rewriting the forwarding file from DHCP data. Re-running setup regenerates files, so inspect them again after doing so.
Start the resolver and verify the result
Check the final configuration before enabling and starting the service:
service local_unbound configtest
sysrc local_unbound_enable="YES"
service local_unbound start
sockstat -4 -l
Use restart instead of start if local Unbound is already running. Expect a listener on 127.0.0.1:53, without a wildcard DNS listener. The host and network firewalls must allow outbound TCP 853. If the network blocks that port, this configuration cannot reach Quad9.
Query the resolver explicitly, then check ordinary application resolution:
drill -D dnssec.works @127.0.0.1
drill -D dnssec-failed.org @127.0.0.1
drill TXT proto.on.quad9.net @127.0.0.1
getent hosts example.com
Expect an ad flag for the valid signed domain, SERVFAIL for the deliberately broken signature and dot. from Quad9's protocol test. The final command tests the system's host lookup path.
Quad9 also validates DNSSEC, so SERVFAIL alone does not prove the local validator rejected an answer. Inspect the local module configuration and trust anchor too. A successful TLS connection only establishes transport and certificate verification, not DNSSEC validation.
Test again after a controlled reboot with console access. Repeat the protocol and application lookups, and check that DHCP renewals preserve the chosen resolver. Boot behavior still needs verification on your installation.

Anycast locations and measured lookup speed
Mullvad announced retirement of its public encrypted DNS service, with a November 2, 2026 migration deadline. Its endpoint still answered our November 5 tests, although a working response does not establish continued support.
Its DNS documentation listed eight cities: Frankfurt, London, Gothenburg, Malmö, Stockholm, Singapore, Dallas and New York. Some users are far from those locations. Anycast follows routing policy, and Mullvad documents ISP routes that send queries to another continent, increasing delay or causing timeouts.
Our earlier comparison used DoH, not the DoT configuration above. From one FreeBSD host we sent 20 fresh HTTPS requests and 20 requests over a reused connection per provider. All 80 answers passed HTTP and DNS checks. The reused medians exclude each first request.
| Measured DoH service | Fresh HTTPS median | Reused connection median |
|---|---|---|
| Mullvad | 33.10 ms | 6.16 ms |
| Quad9 unfiltered | 31.17 ms | 6.04 ms |
The difference was small on this route. We did not identify the answering locations, control recursive caches or randomize provider order. These figures cannot establish that limited locations caused the difference, or that DoT outperforms DoH. They do show why a new connection and an established one need separate measurements.
Compare actual DNS queries from your own connection. A ping omits TLS negotiation and DNS processing. Repeating a query through local Unbound may measure its cache rather than the upstream resolver, so distinguish first lookups from local cache hits.
Restore the original resolver if needed
Use the saved backup path. Stop local Unbound if this test introduced it, then restore the saved /var/unbound, /etc/rc.conf, /etc/resolv.conf and /etc/resolvconf.conf. Restore directories exactly rather than merging them and leaving the new dot.conf behind. If /etc/resolvconf.conf did not exist before the test, remove only the file this setup created.
Restore the original service state and verify getent hosts example.com. Keep the original DNS path documented rather than adding a public plaintext nameserver beside localhost as a silent fallback.