Sub topic 4
BIND or Unbound: which one for which job
This chapter helps you pick the right DNS daemon for each job on your network. It assumes you already know the difference between authoritative servers, recursive resolvers and forwarders from the previous chapter. It also assumes you are comfortable with a Linux shell, systemd and basic firewalling. Configuration details come in later chapters. Here the goal is a decision you can defend.
The short answer
BIND (the named daemon) can do almost every DNS job. Unbound does one job well: recursive resolving with a cache and DNSSEC validation. It can also serve a small amount of local data, but it cannot act as a full authoritative server for zones that use zone transfers.
The practical rule is this:
- Use Unbound when the server only answers questions for your own clients by looking up other people's data.
- Use BIND when the server must publish your zones to the world or to other servers.
- Use both, on separate addresses or machines, when you need both jobs.
What each program is
BIND is the long-standing reference implementation from ISC. A single named process can be authoritative, recursive, or both. It supports primary and secondary zones, NOTIFY, AXFR and IXFR transfers, TSIG, views, dynamic updates and DNSSEC signing. It is controlled with rndc.
Unbound is a validating, recursive, caching resolver from NLnet Labs. It was designed to be small and secure, and its configuration is a single flat file. It is controlled with unbound-control. It has no concept of primary or secondary zones, and it cannot sign zones.
Feature comparison
| Capability | BIND | Unbound |
|---|---|---|
| Authoritative zones (primary) | Yes | No, only static local data |
| Secondary zones with AXFR/IXFR | Yes | Limited. It can mirror a zone with `auth-zone`, but it is not a full secondary. |
| Recursive caching resolver | Yes | Yes, its main purpose |
| DNSSEC validation | Yes | Yes |
| DNSSEC signing of zones | Yes | No |
| Views (split horizon) | Yes, `view` blocks | Partly, with `view:` and `access-control-view` |
| Dynamic updates (RFC 2136) | Yes | No |
| Control tool | `rndc` | `unbound-control` |
| Config check tools | `named-checkconf`, `named-checkzone` | `unbound-checkconf` |
| Configuration size | Large, many blocks | Small, one `server:` block plus a few others |
The Unbound auth-zone feature can hold a copy of a zone, for example a copy of the root zone, so a resolver can answer from local data. Treat it as a resolver optimisation. Do not treat it as a replacement for a real secondary server.
Why roles matter more than products
Mixing authoritative and recursive service in one daemon is the classic source of DNS trouble. Three problems follow.
- Open recursion. A server that answers recursive queries for anyone can be used in amplification attacks. A public authoritative server should have recursion turned off.
- Cache poisoning exposure. A resolver that is also authoritative holds both its own data and cached data from outside. Mistakes in access rules can mix the two.
- Different audiences. An authoritative server must answer anyone on the internet. A resolver must answer only your own clients. Those are opposite access policies.
BIND can keep these apart with recursion no;, ACLs and views. Doing so is a configuration discipline you must maintain. Running a dedicated resolver and a dedicated authoritative server makes the separation structural.
Decision criteria
Choose Unbound when
- You need a resolver for a LAN, a lab or a set of servers.
- You want DNSSEC validation with little setup. Validation needs a trust anchor, and Unbound's packages typically configure one for you.
- You want a small attack surface and low memory use.
- The only local names are a handful of static hosts.
local-zoneandlocal-datahandle these in a few lines. - You want a forwarder that sends one internal domain to a specific upstream server, using
forward-zone.
Choose BIND when
- You are the authoritative source for a domain, such as
example.com. - You need a secondary server that receives zones from a primary, authenticated with TSIG.
- You need the zone to be signed with DNSSEC.
- You need different answers for different clients, which BIND does with views.
- You need dynamic DNS updates, for example from a DHCP server.
- You must run a single daemon for a mixed small site and accept the added care that requires.
Choose both when
- You publish public zones and also resolve for internal clients. Put BIND on the public address with
recursion no;and Unbound on the internal address. Alternatively, run them on different machines. - You want the resolver to forward queries for your own internal zone to the BIND server. In Unbound, that is a
forward-zoneentry. Later chapters build exactly this layout.
Operational differences you will notice
Configuration style
BIND's named.conf uses nested blocks with semicolons, and a missing semicolon stops it from loading. Zone data lives in separate zone files. Unbound uses key: value lines, and local data can sit in the same file or in an included file.
Reloading
BIND reloads a single zone with rndc reload example.com. Unbound reloads with unbound-control reload, which drops its cache. For cache-preserving changes, unbound-control offers commands such as local_data to add records at run time. Those changes do not survive a restart unless you also write them to the configuration.
Package names and paths
The names differ across distribution families, which matters for scripts and documentation.
| Item | Debian/Ubuntu | RHEL family |
|---|---|---|
| BIND package | `bind9` | `bind` |
| BIND service | `named` or `bind9` (alias) | `named` |
| Config file | `/etc/bind/named.conf` | `/etc/named.conf` |
| Unbound package | `unbound` | `unbound` |
| Unbound config | `/etc/unbound/unbound.conf` | `/etc/unbound/unbound.conf` |
Security record
Both programs have had security advisories. BIND is larger, so it has more code to audit and has historically had more reported issues. Its release cycle is well-run, and ISC publishes advisories with fixes. Whichever you choose, subscribe to the project's announcements and apply updates promptly. Your distribution's security channel is usually enough.
Common mistakes
- Using BIND for a plain LAN resolver and leaving defaults. A default install may allow recursion for more clients than you intend. Restrict it with
allow-recursionor choose Unbound. - Expecting Unbound to be a secondary. Teams sometimes plan to replicate their zones to Unbound and find that it cannot take part in NOTIFY and TSIG-authenticated transfers the way BIND does.
- Running both daemons on the same address and port. Only one process can bind to port 53 on a given address. Give each daemon its own address, or use different machines. The install chapter covers how to find the conflict.
- Choosing by habit. BIND's familiarity can lead people to use it for everything. Start from the job, not the tool.
A sample plan
Suppose you run a small company with example.com, an office LAN on 192.0.2.0/24, and two spare servers.
ns1andns2run BIND withrecursion no;.ns1is the primary.ns2is the secondary and receives transfers over TSIG.- A third small host runs Unbound for the office LAN, with
access-controllimited to192.0.2.0/24. - Unbound forwards nothing special for public names and resolves them itself with validation. If an internal zone exists, a
forward-zonepoints it at the BIND server.
This plan keeps the public-facing daemon free of recursion, and it gives the internal clients a fast cache.
Exercise
A company wants one server to publish its public zone example.com to the internet and also to resolve names for its office computers. Which design follows the guidance in this chapter, and why?
Show answer
Run two daemons with separate roles: BIND as an authoritative server with recursion no; on the public address, and Unbound as a caching resolver restricted by access-control to the office network, on a different address or machine. Separate daemons keep open recursion off the public server, which prevents amplification abuse. They also give each service an access policy that matches its audience.
Exercise
Why is Unbound a poor choice for a secondary server that must receive example.com from a BIND primary by NOTIFY and TSIG-authenticated transfers?
Show answer
Unbound is a resolver. It has no primary or secondary zone types. Its auth-zone feature can fetch and hold a zone copy for the resolver's own use, but it is not a full authoritative secondary, so use BIND for that role.