Unbound

On this page 7

Unbound is an open-source validating, recursive and caching DNS resolver developed by NLnet Labs. It answers queries from clients by walking the DNS hierarchy from the root servers, validating DNSSEC signatures along the way and caching the results, which makes it a common choice for ISP resolvers, enterprise networks, firewalls and privacy-minded home setups.

Unbound is deliberately resolver-only: it does not act as a full authoritative name server for public zones. This narrow focus, a compact C code base and a security-first design distinguish it from multipurpose servers such as BIND.

How Unbound resolves and caches queries

When a stub resolver on a client asks Unbound for a name, Unbound first checks its message and RRset caches. On a cache miss, it performs iterative resolution: it queries a root server for the top-level domain delegation, then the top-level domain servers, then the authoritative servers of the zone, following referrals until it obtains an answer.

Unbound is built around a modular pipeline. The validator module checks DNSSEC signatures against a configured trust anchor, usually the root key maintained by the unbound-anchor utility under the RFC 5011 rollover procedure. The iterator module performs the actual recursion. Answers that fail validation are returned to the client as SERVFAIL, so tampered data never reaches applications.

Unbound runs multiple threads, each with its own event loop, and shares caches between them. Cached records live until their time to live expires, but features such as prefetching refresh popular records shortly before expiry, so frequently requested names are almost always answered from memory in well under a millisecond.

Key features and configuration options

Unbound is configured through a single text file, unbound.conf, organized in clauses such as server, forward-zone, stub-zone and remote-control. The table below summarizes the options that most strongly affect security, privacy and performance.

SettingPurposeTypical value or choice
auto-trust-anchor-fileEnables DNSSEC validation with root keyPath to root.key
QNAME minimizationSends only needed labels upstreamyes (default in modern releases)
prefetchRefreshes popular records before expiryyes on busy resolvers
serve-expiredAnswers from stale cache if upstream failsyes with a short limit
aggressive-nsecSynthesizes negative answers from NSEC recordsyes for fewer upstream queries
access-controlRestricts which networks may queryAllow internal ranges only
num-threadsWorker threadsUsually one per CPU core
msg-cache-sizeMemory for cached messagesTens to hundreds of megabytes
Important Unbound settings and their effect

The privacy technique QNAME minimization (RFC 9156) reduces what each authoritative server learns about the full queried name, which improves privacy without changing answers in most cases.

Beyond recursion, Unbound supports local zones and local data for internal names, forward zones that send selected domains to another resolver, Response Policy Zones for blocking malicious domains and encrypted transports: it can serve clients and forward upstream over DNS over TLS, and recent versions also accept DNS over HTTPS queries.

Unbound compared with other DNS servers

Unbound is best understood as a specialized recursive resolver, whereas several alternatives combine recursion with authoritative service or plug-in architectures. The comparison below shows where it fits among neighboring DNS software and services.

SoftwarePrimary roleStrengthConsideration
UnboundRecursive validating resolverSecurity focus, small footprintNot an authoritative server
BINDAuthoritative and recursiveFeature-complete reference softwareLarger attack surface
CoreDNSPlug-in DNS serverKubernetes service discoveryUsually forwards recursion
Knot ResolverRecursive resolverLua-scriptable policiesSmaller community in some regions
Public resolversHosted recursive serviceNo maintenance, anycast reachQueries leave the organization
Unbound and related DNS software

Unbound pairs well with an authoritative-only server such as NSD, also from NLnet Labs, following the operational principle of separating recursive and authoritative roles. Running them separately limits cache poisoning risks and simplifies hardening of each service.

Where Unbound is deployed

Unbound is the default resolver in the base systems of FreeBSD and OpenBSD, is shipped in firewall distributions such as pfSense and OPNsense and is widely used by internet service providers and public DNS operators. Its library form, libunbound, lets applications embed validating resolution directly.

Choosing a deployment mode depends on trust, privacy and network constraints. The decision table below outlines common patterns.

SituationRecommended modeReason
Home network with ad blockerFull recursion behind the filterNo third-party resolver sees all queries
Restrictive firewall blocks port 53Forwarding over DNS over TLSEncrypted upstream on port 853
Enterprise with internal domainsRecursion plus stub zonesInternal names go to internal servers
ISP serving many customersMulti-threaded recursion with prefetchHigh cache hit rate and low latency
Application needing DNSSEC answersEmbedded libunboundValidation inside the program
Choosing an Unbound deployment mode

Operational limitations and common mistakes

The most serious misconfiguration is an open resolver: an Unbound instance that answers queries from the whole internet can be abused for DNS amplification attacks. The default access control refuses non-local clients, but administrators sometimes widen it carelessly when exposing a server.

  • Clock errors break DNSSEC validation, because signatures carry validity periods; keep time synchronized.
  • Disabling validation to fix one broken domain removes protection for all others; use a negative trust anchor instead.
  • Undersized caches on busy resolvers lower hit rates and increase upstream traffic.
  • Forwarding to a non-validating upstream while trusting its answers weakens the DNSSEC chain.

Administrators manage a running instance with unbound-control, which can reload configuration, flush cache entries and print statistics. Monitoring the cache hit ratio, SERVFAIL rate and recursion time quickly reveals upstream problems or validation failures.

A non-technical view

Every website has a name and a numeric address. Your device must find the address before it can connect. Unbound is a program that does this lookup work for you. It asks the internet’s directory servers step by step. It remembers the answers for later. It also checks a digital seal to confirm that no one has tampered with them.

Think of it as a careful personal librarian. It finds the right book, verifies that it is genuine and keeps a copy on the desk. The next request is then answered instantly.

A concrete example

A regional hospital network with about 3,000 devices previously sent all DNS queries to a public resolver. Its security team wanted internal control, DNSSEC validation and the ability to block known malware domains. They deployed two Unbound servers on virtual machines, each with four threads and a 256 MB message cache.

The servers resolve public names through full recursion with QNAME minimization, send the internal hospital domain to the Active Directory DNS servers through a stub zone and load a threat-intelligence Response Policy Zone that is refreshed hourly. Access control allows only internal address ranges.

After one month, the cache hit ratio stabilized near 85 percent, median lookup time for cached names was below one millisecond and the policy zone blocked several hundred attempts to reach malicious domains. When an external domain’s DNSSEC keys were misconfigured, the team added a temporary negative trust anchor rather than disabling validation for the whole network.