Skip to content

Knot DNS Authoritative — install and operate

Installing Knot DNS on Ubuntu, configuring zones via knotc, and the operational patterns that make this fast authoritative server practical in production.

Knot DNS is the CZ.NIC authoritative server — small, fast, and engineered for the kind of workloads where BIND struggles (very high QPS, signed zones with frequent updates). This article is the install + first-zone procedure on Ubuntu: package, config layout, zone setup, and the knotc runtime commands that replace BIND’s rndc. The deliverable is a Knot instance answering authoritative queries with auto-DNSSEC signing on, ready for production traffic.

How to verify

Before installing, confirm port 53 is free and identify any existing DNS daemons that would conflict:

ss -lunp | grep ':53\b'
dpkg -l | grep -E 'knot|bind9|nsd|pdns'
systemctl status systemd-resolved
which knotc kdig keymgr

If Knot is already installed, knotc status confirms it is alive. If port 53 is owned by systemd-resolved, disable the stub before continuing.

What’s happening

Knot DNS is an authoritative-only server. It does not do recursion — for that you want Knot Resolver (a different project from the same team). The daemon stores zones either as flat files (BIND-style) or in an internal LMDB database, and signs them on-the-fly with the built-in DNSSEC engine. Configuration is YAML in /etc/knot/knot.conf, which is more readable than BIND’s named.conf syntax but unforgiving about indentation.

Operationally, Knot has two strong design choices:

  1. knotc for runtime control. Reload, zone refresh, zone freeze, signing rollover state — all via the same CLI. There is no separate rndc analogue and a separate signing tool; everything is in knotc and keymgr.
  2. auto-dnssec policies. Define a policy once, attach it to zones, and Knot manages the entire KSK/ZSK lifecycle including parent DS submission via CDS/CDNSKEY. The operator’s job shrinks to “watch the rollover state.”

The Ubuntu package puts config in /etc/knot/, zone files in /var/lib/knot/zones/, and the daemon runs as knot.service under user knot.

The procedure

  1. Install Knot. The Ubuntu archive carries a recent enough version for most use; CZ.NIC also publishes a PPA for the latest stable:

    sudo apt update
    sudo apt install -y knot
    sudo systemctl status knot
    knotd -V
  2. Configure the daemon. Edit /etc/knot/knot.conf. Knot YAML is whitespace-sensitive; use spaces, not tabs:

    server:
        listen: [ "127.0.0.1@53", "::1@53", "10.0.5.10@53" ]
        user: knot:knot
        rundir: "/run/knot"
    
    log:
      - target: syslog
        any: info
    
    key:
      - id: transfer-key
        algorithm: hmac-sha256
        secret: BASE64-SECRET-HERE
    
    remote:
      - id: secondary-ns
        address: 203.0.113.20@53
        key: transfer-key
    
    acl:
      - id: allow-transfer
        address: [ 203.0.113.20 ]
        key: transfer-key
        action: transfer
      - id: allow-notify
        address: [ 203.0.113.10 ]
        action: notify
    
    policy:
      - id: dnssec-default
        algorithm: ecdsap256sha256
        ksk-lifetime: 365d
        zsk-lifetime: 90d
        cds-cdnskey-publish: always
    
    template:
      - id: default
        storage: "/var/lib/knot/zones"
        file: "%s.zone"
        dnssec-signing: on
        dnssec-policy: dnssec-default
        notify: secondary-ns
        acl: [ allow-transfer ]
    
    zone:
      - domain: example.com
        template: default
  3. Drop the zone file. Knot uses the same RFC 1035 master file format as BIND. Place it at /var/lib/knot/zones/example.com.zone:

    $TTL 300
    @       SOA  ns1.example.com. hostmaster.example.com. (
                    2026060201 3600 600 1209600 300 )
            NS   ns1.example.com.
            NS   ns2.example.com.
    www     A    203.0.113.10
    mail    A    203.0.113.11
    @       MX   10 mail.example.com.

    Owner must be knot:knot, mode 0640.

  4. Validate and start. Knot has a config checker built in:

    sudo knotc conf-check
    sudo systemctl restart knot
    sudo knotc status
    sudo knotc zone-status example.com
  5. Verify queries and signing. Knot signs the zone the first time it loads. Wait a few seconds, then:

    kdig @127.0.0.1 example.com SOA +dnssec
    kdig @127.0.0.1 example.com DNSKEY +short
    sudo keymgr example.com list

    keymgr list shows the KSK/ZSK pair Knot generated. The CDS/CDNSKEY records are also published so a registrar with CDS automation can pick up DS changes automatically.

  6. Confirm the secondary picks up via NOTIFY. Run knotc zone-status example.com on the secondary and watch for the AXFR-completed event in the log.

Common pitfalls

  • YAML indentation errors. conf-check catches most, but some unindented keys parse as siblings rather than children, producing surprising behaviour. Re-read the diff before reloading.
  • knotc reload vs restart. A reload is enough for zone or template changes; daemon restart is required only for server: block changes (listen address, user, control socket).
  • Frozen zones from failed signing. If signing fails (clock skew, missing keys, KASP database lock), Knot freezes the zone and stops serving updates. Check knotc zone-status and journalctl -u knot for the cause.
  • CDS-only registrar handoff. Knot publishes CDS by default but the registrar must actively scan for it. Many registrars do not — you still need to submit DS manually unless your registrar implements CDS scanning (RFC 8078).
  • LMDB DB lock. The KASP DB (/var/lib/knot/keys/) is LMDB. Concurrent keymgr and knotc operations can lock — keep them serial.

In the engagements we run, Knot is the answer when the client needs high-QPS authoritative answers with frequent zone changes and automatic DNSSEC. It is faster than BIND on the same hardware and operationally smaller; the tradeoff is a smaller community and a sharper learning curve on the YAML. We codify the policy and zone definitions in configuration management, run paired primary/secondary, and bake the rollover into the operational rhythm. See our managed operations service for the broader operating model.