DNS over TLS and ESNI in Unbound

Inuit inuit at libmail.eu
Tue Nov 2 09:04:04 UTC 2021

Hello everyone,

Unbound user since some time (associated with pi-hole) and I'm trying
to make a proper configuration for DoT and ESNI. I have some questions:

The howtos I found on enabling DNS over TLS all prescribe to forward
DoT queries to public resolvers (e.g Cloudflare, Quad9); the interest
of using Unbound is precisely to not have to use these public resolvers
but to directly contact the authoritative servers. What exactly is
forwarded ? Is it the entire query on only a TLS key exchange ? Why
can't we contact directly authoritative servers in DoT ?

Other question, I tried to enable encrypted SNI on Firefox (and I did
it) but the cloudflare's browser test tells that ESNI is not enabled,
it is related to Unbound configuration ? I didn't find a howto about
enabling ESNI in Unbound, or maybe this test can only see if ESNI is
used when using Cloudflare's DNS (I saw that it couldn't determine if I
was using DoT).

Last question, since I enabled DoT I frequently receive BOGUS errors,
these errors occur mostly massively in brief moments before everything
returns to normal. It was not occuring on the previous configuration
(where I was forwarding requests to stubby, I didn't know that Unbound
supports natively DoT).

Thanks for your help,
-------------- next part --------------
    # If no logfile is specified, syslog is used
    logfile: "/var/log/unbound/unbound.log"
    verbosity: 3

    port: 5335
    do-ip4: yes
    do-udp: yes
    do-tcp: yes

    # May be set to yes if you have IPv6 connectivity
    do-ip6: no

    # You want to leave this to no unless you have *native* IPv6. With 6to4 and
    # Terredo tunnels your web browser should favor IPv4 for the same reasons
    prefer-ip6: no

    # Use this only when you downloaded the list of primary root servers!
    # If you use the default dns-root-data package, unbound will find it automatically
    #root-hints: "/var/lib/unbound/root.hints"

    # Trust glue only if it is within the server's authority
    harden-glue: yes

    # Require DNSSEC data for trust-anchored zones, if such data is absent, the zone becomes BOGUS
    harden-dnssec-stripped: yes

    # Don't use Capitalization randomization as it known to cause DNSSEC issues sometimes
    # see https://discourse.pi-hole.net/t/unbound-stubby-or-dnscrypt-proxy/9378 for further details
    use-caps-for-id: no

    # Reduce EDNS reassembly buffer size.
    # Suggested by the unbound man page to reduce fragmentation reassembly problems
    edns-buffer-size: 1472

    # Perform prefetching of close to expired message cache entries
    # This only applies to domains that have been frequently queried
    prefetch: yes

    # One thread should be sufficient, can be increased on beefy machines. In reality for most users running on small networks or on a single machine, it should be unnecessary to seek performance enhancement by increasing num-threads above 1.
    num-threads: 2

    # Ensure kernel buffer is large enough to not lose messages in traffic spikes
    so-rcvbuf: 1m

    # Ensure privacy of local IP ranges
    private-address: fd00::/8
    private-address: fe80::/10

-------------- next part --------------
  tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt

  name: "."
  forward-tls-upstream: yes
  # Quad9
#  forward-addr: 2620:fe::fe at 853
  forward-addr: at 853
#  forward-addr: 2620:fe::9 at 853
  forward-addr: at 853
  # Cloudflare DNS
#  forward-addr: 2606:4700:4700::1111 at 853
#  forward-addr: at 853
#  forward-addr: 2606:4700:4700::1001 at 853
#  forward-addr: at 853

More information about the Unbound-users mailing list