Knot DNS Server

Introduction

Knot DNS server is a high-performance authoritative-only DNS server which supports all of the key features of the domain name system including zone transfers and DNSSEC. It was developed by the CZ.NIC. Knot DNS is open-source and multi-threaded. Current features include:

  • Full and incremental zone transfers (AXFR/IXFR)
  • Dynamic DNS updates
  • EDNS0 and DNSSEC extensions, including NSEC3
  • Response Rate Limiting
  • NSID
  • TSIG
  • and all of the standard features you’d expect with an authoritative-only nameserver implementation

Knot used to require zone files to be compiled (like NSD), but this requirement was removed as of Knot 1.3.0.

For this article, I’ll be running the latest stable version of Knot, 1.3.3, on CentOS 6.4. The test environment will comprise two hosts - venus (master) on 192.168.122.12 and earth (slave) on 192.168.122.13.

Knot 1.4.0-rc1 was also available at the time of writing which supports experimental DNSSEC auto-signing, so that may be worth checking out if relevant to your needs.

Software Compilation

First, install the pre-requisite packages to prepare the build environment and fetch the appropriate libraries:

Knot uses the Userspace RCU data-synchronisation library, so download and compile. The latest version at the time of writing was 0.8.1.

Next, compile and install Knot. Note, that as per the information on this page, we disable recvmmsg as we’re running glibc 2.12 and kernel 2.6.32:

Knot is now installed. As we don’t want to run Knot as root, create an unprivileged user and group:

Taking a look under /usr/local/etc/knot you will find two files, example.com.zone and knot.sample.conf. Using the sample file, and the documentation, you can build your knot.conf.

Configuration

In this configuration example, I’ll configure earth to slave the example.com zone from venus. TSIG keys could also be employed to secure the transfer.

First, copy the example.com zone file into place:

On your master server, create knot.conf as follows. You will see that I have commented all appropriate configuration options and the documentation can be consulted for further information:

On the slave server:

Knot is now configured.

Controlling Knot and Verifying

Start the Knot daemon in the foreground with:

If no errors are noted, hit Ctrl-C, then start in daemon mode:

To control Knot, use knotc. For example, to stop the Knot daemon:

Or to update the configuration, or add/update zones:

Looking at the messages file on the master (venus) we can see that the slave has successfully AXFR’d the zone:

And on the slave:

Make a change to example.com zone, and issue the knotc reload command. On the slave, you should see messages along the lines of the following:

Troubleshooting

If you receive messages such as:

Check for connectivity issues (e.g. iptables not being updated on the master).

Conclusion

This article has been a brief introcuction on getting the Knot DNS server up and running. There are still a few features I want to investigate, such as rate-limiting and the DNSSEC extensions. I will definitely be keeping an eye on Knot as an alternative to NSD, and perhaps BIND 10.