|
|
Subscribe / Log in / New account

Knot DNS: A high-performance, authoritative DNS server

August 6, 2014

This article was contributed by Ondřej Surý

There was a time when BIND was the only open-source DNS server, but those times have changed and now there are more alternative DNS servers available. If you are looking for more speed, less memory used, better security, or just adding diversity to your DNS infrastructure, you might want to check out Knot DNS. It has just reached version 1.5.0, which brings memory and performance improvements, along with dynamic processing modules that can help with IPv6 network management. Knot DNS is now able to process more than half a million queries per second while keeping the memory usage below that of BIND 9.

What is Knot DNS?

Knot DNS started out as an open-source project licensed under GNU GPLv3 at CZ.NIC, the Czech Republic national domain registry. When CZ.NIC started to run its own name servers for the .CZ top-level domain (TLD), there were only two usable open-source DNS servers with full standard coverage and the ability to run a TLD: BIND and NSD. In due course, CZ.NIC Labs, an R&D department, was formed and the decision to create a fast, modern. and open DNS server was made. The decision was based on the idea that DNS protocol is one of the most important protocols of the Internet, and thus it's stability, security, and reliability would benefit from another DNS server implementation that was written from scratch with full standards compliance in mind.

[Knot DNS Logo]

The first public release of Knot DNS (0.8) was published in 2011 and the project has gone a long way since then. New features have been implemented, the performance was further improved, and the code has been refactored to also focus development on memory requirements. Knot DNS is now able to cater to TLD and root zone operators' needs, but it has also been successfully deployed in DNS-hosting scenarios. For a full list of features and configuration options, see the documentation, but let's just focus on the most notable features and improvements.

Features

Knot DNS is written in pure C as a threaded daemon. As the zone file data is shared among the server threads, there was a need to handle updates to the zones that could come from various sources: manual updates, incoming transfers (AXFR and IXFR), dynamic DNS, or DNSSEC signing. The updates must not leave the zone in an inconsistent state, so you need to ensure that the whole update, such as incoming AXFR, is applied atomically. Knot DNS utilizes a technique you might know from the Linux kernel: Read-Copy-Update (RCU) via the userspace RCU library. This allows Knot DNS to maintain its response speed even when the zone contents are being updated. This can, of course, be rather expensive memory-wise. Even though Knot DNS tries to mitigate this by using shallow copies whenever possible, the incoming zone transfer can still consume double the amount of memory.

Knot DNS is fully standards-compliant and interoperable with other DNS servers. The server can receive and send data via both IPv4 and IPv6, using UDP or TCP. Zone contents can be updated by editing the zone files, incoming and outgoing full (AXFR) and incremental (IXFR) zone transfers, or by Dynamic DNS. The update policy is controlled by IP access lists or cryptographic (TSIG) signatures. Support for Name Server Identifier (NSID), which is important for people running DNS in anycast mode, is also included. While the new releases track and implement new DNS standards, the server also implements RFC 3597 and thus it can handle unknown (future) DNS Resource Records.

Dynamic processing modules are code hooks that can plug into the query-response processing chain and alter the incoming and outgoing DNS messages according to a configured rule. This feature, introduced in version 1.5.0, makes Knot DNS into more than just a simple DNS server. Right now, there are two modules: synth_record and dnstap, and the team plans to add more to support geolocation and high-availability.

The dnstap module implements a flexible, structured binary log format for DNS software. It uses Protocol Buffers to encode events that occur inside DNS software in an implementation-neutral format.

IPv6 reverse (PTR) and forward (AAAA) zones management can be a troublesome task, especially for ISPs with lots of residential customers. The IPv6 address space is vast and it's simply not possible to keep all reverse records in memory. The synth_record module has been developed as an answer to these troubles, as it can generate missing reverse (PTR) and forward records (A, AAAA) on the fly while maintaining the ability to serve real data if it is available.

The only drawback of the current implementation is that DNSSEC cannot be used to sign the generated resource records since the records need to be signed on the fly as they are generated. This will be addressed in the next release.

In Knot DNS 1.3.0, the zone file parser was migrated from a venerable Flex+Bison parser to a more modern Ragel State Machine Compiler parser, which brought much needed speed into zone parsing. For example, the new zone parser is able to process the .net zone, with 35 million records, in under ten seconds. The old parser would still be crunching the zone for another 1000 seconds. The zone file format is surprisingly permissive in terms of syntax, which you can see in the Ragel zone parser in the upstream Git repository.

[Response rate graph]

When talking about performance, we can look at the response performance and speed. Knot DNS outperforms any other open-source DNS server available, with peak numbers exceeding 500,000 responses per second over UDP with a 10GbE network connection. Now, the famous Winston Churchill's quote may have come to your mind: "I only believe in statistics that I doctored myself". The DNS benchmarking scripts used to calculate this are freely available and everybody is thus able to reproduce the results. We discovered one important thing while benchmarking DNS: the network card chipset can make a huge difference. As a rule of thumb, the Intel server NIC chipsets are never a bad choice.

While the raw numbers are important if your DNS server is under attack (and that's just started to be common in last few years), it's also important to avoid becoming part of the attack in the first place. Paul Vixie and Vernon Schryver developed Response Rate Limiting (RRL) as an answer to recent Distributed Denial of Service (DDoS) attacks that use third party DNS servers with spoofed source IP addresses to reflect traffic to innocent victims. Knot DNS has implemented RRL since the 1.2.0 release to give DNS administrators the ability to be good netizens by not participating in these attacks, even inadvertently. This is especially important for high-performance DNS servers with high-speed connectivity, such as TLD servers.

CZ.NIC started DNSSEC signing in the .CZ zone back in September 2008 and has reached 37% penetration with 434,000 signed DNSSEC domains. Thus it shouldn't be really surprising that DNSSEC was on the feature list for Knot DNS from the beginning. The server will make sure that DNSSEC signatures don't expire and will maintain the SOA serial number. Knot DNS could serve DNSSEC-signed zones since its first public release, but it has also introduced the ability to sign the domains since the 1.4.0 release.

Domain signing is currently labelled as a technology preview, since the configuration, interface, and utilities might change in the future. However, the code is stable and if you want to just sign zones, you should give it a try.

Knot DNS also comes bundled with standard DNS utilities: kdig, khost and knsupdate that implement their BIND 9 counterparts.

Future Development

The upcoming Knot DNS 1.6.0 (aimed for end of 2014) will bring a reworked DNSSEC signing that will include Key and Signing Policy, its own DNSSEC key management utilities, inline (on-the-fly) signing, and migration from OpenSSL to GnuTLS. The latter switch was already planned due to much better support for PKCS#11 in GnuTLS that allows storing encryption keys in Hardware Security Modules (HSM). The recently discovered OpenSSL vulnerabilities just emphasized the need for heterogeneity in cryptographic libraries used by DNS servers.

A DNS server may be used for small personal zones, large TLD zones containing millions of records, as well as in deployments involving tens or hundreds of millions of small zones. While simple configuration files suffice for the first and second scenarios, it becomes cumbersome to read a huge configuration file with millions of configuration records when the DNS operator needs to add and remove zones from that file frequently (e.g., every second). Therefore, the need for a provisioning protocol has emerged and is on the roadmap for 2015.

Notable users

We obviously cannot list all Knot DNS users, but here is a list of some noteworthy users. As you might have guessed, we eat our own dog food, thus Knot DNS powers a whole one-third of .CZ nameservers (the rest are running BIND 9 and NSD). .CZ is not the only TLD to deploy Knot DNS; it has been handling .DK since 2012. RIPE NCC has deployed [PDF] Knot DNS to run in a slave nameserver cluster serving 77 ccTLDs and 4,200 reverse zones with a peak traffic rate of 120,000 queries per second. We got O2 Czech Republic on board with Knot DNS 1.5.0 for its reverse IPv6 zones delegations, and CESNET, Czech National Research and Educational Network, has been running Knot DNS since late last year. The latest notable addition to the user base has been Active24.cz with more than 200,000 domains.

Get it

Developers can download and compile Knot DNS sources (releases or Git), but Knot DNS also has packages for most Linux distributions: Debian, Ubuntu (in a PPA), Fedora and Fedora EPEL, OpenSUSE, Arch Linux, and Gentoo. There's also a OpenWRT metapackage and a Knot DNS formula for HomeBrew.

I hope you will give Knot DNS a try. If you run into a problem, there's an issue tracker and the knot-dns-users mailing list for assistance. There's also Twitter and Google+. The Knot DNS team would be happy to hear from you, with problems, or success stories.

[ The author is a Chief Scientist at CZ.NIC and is involved in Knot DNS development. He's also a Debian Developer and an open-source enthusiast. ]
Index entries for this article
GuestArticlesSury, Ondrej


to post comments

Knot DNS: A high-performance, authoritative DNS server

Posted Aug 7, 2014 13:33 UTC (Thu) by agwiwfpc (guest, #91130) [Link] (3 responses)

Pretty strange that they did not run their benchmarks against other fast DNS servers like tinydns or gdnsd. Beating BIND these days is quite easy.

Generally "outperforms any other open-source DNS server available" is a very strong claim. robdns using PF_RING seems to be able to deliver about 1 million packets per second *per core*.

Knot DNS: A high-performance, authoritative DNS server

Posted Aug 7, 2014 14:39 UTC (Thu) by ondrej (subscriber, #27872) [Link] (2 responses)

Hi agwiwfpc,

thank you for your remark. We have included (deliberately) only DNS servers that are DNS standard compliant, and we think that DNSSEC is important part of DNS.

Apart from missing DNSSEC, both tinydns and gdnsd support only a subset of DNS standard.

tinydns:
* no EDNS0
* needs heavy patching to be brought to the modern ages

gdnds:
* support only a limited set of RRTYPES (SOA, A, AAAA, NS, PTR, CNAME, MX, SRV, TXT, SPF, and NAPTR), but at least it supports TYPEXXXX convention.
* no AXFR/IXFR

And it's the first time I hear about robdns and it looks like a very interesting concept. Thanks for sharing that, we will certainly have a look.

Anyway as I said in the article - the benchmarks are open...

Cheers,
Ondrej

Knot DNS: A high-performance, authoritative DNS server

Posted Aug 7, 2014 15:02 UTC (Thu) by agwiwfpc (guest, #91130) [Link]

Thanks for sharing the information on how you were choosing the servers for benchmarking, that makes total sense.

Knot DNS: A high-performance, authoritative DNS server

Posted Nov 12, 2014 14:31 UTC (Wed) by blblack (guest, #99748) [Link]

Hi Ondrej :)

I'm the author of gdnsd and noticed this sub-thread here recently. Knot DNS is pretty neat, and I'm glad that there's healthy competition in open source authserver software these days :) In response to your comments about gdnsd and standards:

The DNS is defined by a plethora of RFCs of varying legitimacy, utility, and age; it's hard to argue there's a single set of absolutely-required features and behaviors that define the "DNS standard." Modulo any difference we might have about the points outlined below, I feel that gdnsd is a standards-complaint DNS authdns server. In the pragmatic sense, it is being used to serve the public authdns needs of some fairly large sites (e.g. Wikipedia), and that alone argues for its legitimacy.

* Lack of [AI]XFR: This is an intentional design choice. Not necessary for a pure authserver of limited feature scope (gdnsd doesn't intend to support DDNS updates from client-level machines), and frankly there are many superior methods for transferring data between cooperative authservers these days.
* Limited subset of RR types: I think the subset that gdnsd implements is valid. It covers all of the core RR types defined by the older RFCs, minus the ones that have fallen completely out of legitimate, modern use (e.g. MINFO, MAILA, etc). Of the newer RR-types: SPF was initially supported and then later removed (as it has been deprecated by the standards process for new implementations, so gdnsd took advantage of a major-version bump to drop it for 2.x). NAPTR is implemented because it does see broad-enough usage that it seemed prudent. As a catchall, RFC3597 generic TYPEXXX is implemented, which can be used to define data for RR types gdnsd knows nothing about. I have yet to receive a feature request for any other esoteric types (e.g. SSHFP, etc), but I'd be happy to add them if there was a legitimate demand from users.
* Lack of DNSSEC: If your definition of standards-compliant includes some (specific?) level of DNSSEC feature support, then gdnsd definitely doesn't comply there. This has been an intentional design choice from day one, as I've been rather unimpressed with both the process and results of the DNSSEC effort.
Given where the world is at today (that DNSSEC seems to be winning in spite of itself), gdnsd will probably eventually have some form of DNSSEC implementation that's appropriate to how it operates. It's on the back-burner radar for 3.x. For the time being, however, I think it's a legitimate design choice. It's definitely possible that lack of DNSSEC in the design confers an "unfair" advantage in non-DNSSEC benchmarks, but I think if anything that's an interesting thing to highlight about DNSSEC itself and how it affects simplicity of implementation.

I do take some issue with your statement "Knot DNS outperforms any other open-source DNS server available". I honestly don't know if it outperforms gdnsd (all other things being equal), as I really don't currently have the mental bandwidth to set up such a rigorous comparison environment. I'm inclined to believe it would be difficult (but not impossible!) for Knot to exceed gdnsd's performance, especially in the areas of UDP query rate, latency, and jitter. Neither of us knows that if you're not benchmarking it, though, so it seems a bit imprudent to make such a sweeping claim.

Knot DNS: A high-performance, authoritative DNS server

Posted Aug 14, 2014 15:55 UTC (Thu) by rhack (guest, #90448) [Link] (2 responses)

Hi Ondrej.

Now, the famous Winston Churchill's quote may have come to your mind: "I only believe in statistics that I doctored myself".

It wasn't Churchill but Goebbels.

"I only believe in statistics that I doctored myself. - This slanderous remark was attributed to Churchill by Nazi propaganda minister Joseph Goebbels to depict him as a liar." Randall L. Bytwerk: Bending Spines: The Propagandas of Nazi Germany

I only believe in statistics that I doctored myself

Posted Aug 15, 2014 19:47 UTC (Fri) by Wol (subscriber, #4433) [Link]

Statistics tell you how to get from A to B.

What the people quoting statistics don't tell you, is that you're all at C.

Cheers,
Wol

Knot DNS: A high-performance, authoritative DNS server

Posted Aug 18, 2014 12:15 UTC (Mon) by ondrej (subscriber, #27872) [Link]

Hey,

thanks for the clarification. Looks like I fell for the propaganda :).

(And actually I don't consider that as a "lying" - it's the very true remark that says that you should always validate the results from the data yourself.)

Ondrej


Copyright © 2014, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds