This is my config - albeit on a RPi - but it works flawlessly
#
https://nlnetlabs.nl/documentation/unbound/unbound.conf/
server:
# Do not daemonize, to allow proper systemd service control and status estimation.
do-daemonize: no
# A single thread is pretty sufficient for home or small office instances.
num-threads: 4
# Logging: For the sake of privacy and performance, keep logging at a minimum!
# - Verbosity 2 and up practically contains query and reply logs.
verbosity: 0
log-queries: no
log-replies: no
# - If required, uncomment to log to a file, else logs are available via "journalctl -u unbound".
#logfile: "/var/log/unbound.log"
# Set interface to "0.0.0.0" to make Unbound listen on all network interfaces.
# Set it to "127.0.0.1" to listen on requests from the same machine only, useful in combination with Pi-hole.
interface: 127.0.0.1
# Default DNS port is "53". When used with Pi-hole, set this to e.g. "5335", since "5353" is used by mDNS already.
port: 5335
# Control IP ranges which should be able to use this Unbound instance.
# The DietPi defaults permit access from official local network IP ranges only, hence requests from www are denied.
access-control: 0.0.0.0/0 refuse
access-control: 10.0.0.0/8 allow
access-control: 127.0.0.1/8 allow
access-control: 172.16.0.0/12 allow
access-control: 192.168.0.0/16 allow
access-control: ::/0 refuse
access-control: ::1/128 allow
access-control: fd00::/8 allow
access-control: fe80::/10 allow
# Private IP ranges, which shall never be returned or forwarded as public DNS response.
# NB: 127.0.0.1/8 is sometimes used by adblock lists, hence DietPi by default allows those as response.
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: fd00::/8
private-address: fe80::/10
# Define protocols for connections to and from Unbound.
# NB: Disabling IPv6 does not disable IPv6 IP resolving, which depends on the clients request.
do-udp: yes
do-tcp: yes
do-ip4: yes
do-ip6: no
# Ratelimiting
ratelimit: 1000
ratelimit-size: 8m
ratelimit-slabs: 8
ratelimit-factor: 10
ip-ratelimit: 100
ip-ratelimit-size: 8m
ip-ratelimit-slabs: 8
ip-ratelimit-factor: 10
jostle-timeout: 1000
# Defend against and print warning when reaching unwanted reply limit.
unwanted-reply-threshold: 10000
# Set EDNS reassembly buffer size to match new upstream default, as of DNS Flag Day 2020 recommendation.
edns-buffer-size: 1232
# Maximum UDP response size (not applied to TCP response).
# Suggested values are 512 to 4096. Default is 1232. 65536 disables it.
max-udp-size: 1232
# Increase incoming and outgoing query buffer size to cover traffic peaks.
so-rcvbuf: 4m
so-sndbuf: 4m
# Hardening
harden-glue: yes
harden-dnssec-stripped: yes
harden-algo-downgrade: yes
harden-large-queries: yes
harden-short-bufsize: yes
harden-below-nxdomain: yes
harden-referral-path: yes
aggressive-nsec: yes
deny-any: yes
# Privacy
use-caps-for-id: yes # Spoof protection by randomising capitalisation
rrset-roundrobin: yes
qname-minimisation: yes
minimal-responses: yes
hide-identity: yes
identity: "Server" # Purposefully a dummy identity name
hide-version: yes
# Caching
cache-min-ttl: 3600
cache-max-ttl: 86400
serve-expired: yes
serve-expired-ttl: 86400
serve-expired-ttl-reset: yes
serve-expired-reply-ttl: 30
# serve-expired-client-timeout: 1800
prefetch: yes
prefetch-key: yes
msg-cache-size: 128m
rrset-cache-size: 256m
key-cache-size: 8m
neg-cache-size: 8m
# the number of slabs to use for cache and must be a power of 2 times the
# number of num-threads set above. more slabs reduce lock contention, but
# fragment memory usage.
msg-cache-slabs: 8
rrset-cache-slabs: 8
infra-cache-slabs: 8
key-cache-slabs: 8
# Faster UDP with multithreading (only on Linux).
so-reuseport: yes
# Should additional section of secure message also be kept clean of unsecure
# data. Useful to shield the users of this validator from potential bogus
# data in the additional section. All unsigned data in the additional section
# is removed from secure messages.
val-clean-additional: yes
# Disable subnetcache to circumvent warnings
# related to prefetch and serve-expired
# when ECS is compiled with Unbound.
module-config: "validator iterator"
# Enable extended statistics.
extended-statistics: yes
statistics-interval: 0
# Use libevent
outgoing-range: 8192
num-queries-per-thread: 4096
# fast-server-permil: <number>
# Specify how many times out of 1000 to pick from the set of fastest
# servers. 0 turns the feature off. A value of 900 would pick from
# the fastest servers 90 percent of the time, and would perform nor-
# mal exploration of random servers for the remaining time. When
# prefetch is enabled (or serve-expired), such prefetches are not
# sped up, because there is no one waiting for it, and it presents a
# good moment to perform server exploration. The fast-server-num op-
# tion can be used to specify the size of the fastest servers set.
# The default for fast-server-permil is 0.
fast-server-permil: 750
# fast-server-num: <number>
# Set the number of servers that should be used for fast server se-
# lection. Only use the fastest specified number of servers with the
# fast-server-permil option, that turns this on or off. The default
# is to use the fastest 3 servers.
fast-server-num: 3
# target-fetch-policy: <"list of numbers">
# Set the target fetch policy used by unbound to determine if it
# should fetch nameserver target addresses opportunistically. The
# policy is described per dependency depth.
# The number of values determines the maximum dependency depth
# that unbound will pursue in answering a query. A value of -1
# means to fetch all targets opportunistically for that dependency
# depth. A value of 0 means to fetch on demand only. A positive
# value fetches that many targets opportunistically.
# Enclose the list between quotes ("") and put spaces between num-
# bers. The default is "3 2 1 0 0". Setting all zeroes, "0 0 0 0
# 0" gives behaviour closer to that of BIND 9, while setting "-1
# -1 -1 -1 -1" gives behaviour rumoured to be closer to that of
# BIND 8.
target-fetch-policy: "0 0 0 0 0"