Commit 51733eda authored by Ondřej Surý's avatar Ondřej Surý

First preparation for sphinx generated documentation (probably broken)

parent 3336f97f
......@@ -368,6 +368,21 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sched.h>]], [[cpuset_t* set = cpuset
# Add code coverage macro
AC_PATH_PROG([SPHINXBUILD], [sphinx-build], [false])
AS_IF([test "$SPHINXBUILD" = "false"],
[AC_MSG_WARN([Could not find the 'sphinx-build' executable, you will be unable to regenerate documentation.])],
[AC_PATH_PROG([PDFLATEX], [pdflatex], [false])
AS_IF([test "$PDFLATEX" = ""],
[AC_MSG_WARN([Could not find the 'pdflatex' executable, you will be unable to generate PDF documentation.])])
AC_PATH_PROG([MAKEINFO], [makeinfo], [false])
AS_IF([test "$MAKEINFO" = "false"],
[AC_MSG_WARN([Could not find the 'makeinfo' executable, you will be unable to generate info documentation.])])
......@@ -377,6 +392,7 @@ AC_CONFIG_FILES([Makefile
info_TEXINFOS = knot.texi
knot_TEXINFOS = \
configuration.texi \
indices.texi \
installation.texi \
introduction.texi \
knot.texi \
migration.texi \
reference.texi \
requirements.texi \
running.texi \
security.texi \
synth_record.texi \
troubleshooting.texi \
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
.PHONY: help html dirhtml singlehtml pdf info doctest
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
@echo "You need to install pdflatex and re-run configure to be"
@echo "able to generate PDF documentation."
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@echo "You need to install GNU Texinfo and re-run configure to be"
@echo "able to generate info pages."
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
html pdf info doctest:
@echo "Please install sphinx (python-sphinx) to generate Knot DNS documentation."
#info_TEXINFOS = knot.texi
#knot_TEXINFOS = \
# configuration.texi \
# indices.texi \
# installation.texi \
# introduction.texi \
# knot.texi \
# migration.texi \
# reference.texi \
# requirements.texi \
# running.texi \
# security.texi \
# synth_record.texi \
# troubleshooting.texi \
# version.texi
# -*- coding: utf-8 -*-
# Knot DNS documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 15 13:48:28 2014.
# This file is execfile()d with the current directory set to its containing dir.
# Note that not all possible configuration values are present in this
# autogenerated file.
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'knot'
# General information about the project.
project = u'Knot DNS'
copyright = u'2014, CZ.NIC, z.s.p.o.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The short X.Y version.
version = '@VERSION@'
# The full version, including alpha/beta/rc tags.
release = '@VERSION@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
today = '@RELEASE_DATE@'
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'KnotDNSdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('knot', 'KnotDNS.tex', u'Knot DNS Documentation',
u'CZ.NIC, z.s.p.o.', 'manual'),
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
#man_pages = [
# ('index', 'knotdns', u'Knot DNS Documentation',
# [u'CZ.NIC, z.s.p.o.'], 1)
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('knot', 'KnotDNS', u'Knot DNS Documentation',
u'CZ.NIC, z.s.p.o.', 'KnotDNS', 'One line description of project.',
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
Knot DNS Configuration
In this chapter we provide suggested configurations and explain the
meaning of individual configuration options.
Knot DNS Installation
Required build environment
GCC at least 4.1 is strictly required for atomic built-ins, but 4.2 or
newer is recommended. Another requirement is ``_GNU_SOURCE`` support,
otherwise it adapts to the compiler available features. LLVM clang
works, but it is not officially supported.
Knot DNS build system relies on these standard tools:
* make
* libtool
* autoconf >= 2.65
* flex >= 2.5.31
* bison >= 2.3
Required libraries
Knot DNS requires few libraries to be compiled:
* OpenSSL, at least 0.9.8
* zlib
* Userspace RCU, at least 0.5.4
* libcap-ng, at least 0.6.4 (optional library)
If libcap-ng library is available, Knot DNS will take advantage of the
POSIX 1003.1e capabilites(7) by sandboxing the exposed threads. Most
rights are stripped from the exposed threads for security reasons.
You can probably find OpenSSL and zlib libraries already included in
your system or distribution. If not, zlib resides at,
and OpenSSL can be found at
Userspace RCU
liburcu is a LGPLv2.1 userspace RCU (read-copy-update) library. This
data synchronization library provides read-side access which scales
linearly with the number of cores. It does so by allowing multiple
copies of a given data structure to live at the same time, and by
monitoring the data structure accesses to detect grace periods after
which memory reclamation is possible. `Userspace RSU <>`
Binary packages for Debian can be found under ``liburcu1`` for the
library and ``liburcu-dev`` for development files.
Minimum supported version of Userspace RCU library is 0.5.4,
but we recommend using latest available version.
It is crucial especially on non-Linux systems, as we got some compatibility
patches accepted to later releases of Userspace RCU.
OpenBSD, NetBSD and OS X platforms are supported from version 0.7.0.
Installation from the sources
You can find the source files for the latest release on ` <>`.
Alternatively, you can fetch the sources from git repository `<git://>`.
After unpacking the sources, the compilation and installation is a
quite straightforward process using autotools.
Configuring and generating Makefiles
If you want to compile from Git sources, you need to bootstrap the ``./configure`` file first.::
$ autoreconf -i -f
For all available configure options run::
$ ./configure --help
If you have trouble with unknown syscalls under valgrind, disable recvmmsg by
adding a parameter ``--enable-recvmmsg=no`` to configure.
Knot DNS has also support for link time optimizations. You can enable
it by the configure parameter ``./configure --enable-lto=yes``. It is
however disabled by default as it is known to be broken in some
compiler versions and may result in an unexpected behaviour. Link
time optimizations also disables the possibility to debug the
resulting binaries.
If you want to add debug messages, there are two steps to do that.
First you have to enable modules you are interested in.
Available are: ``server, zones, xfr, packet, dname, rr, ns, hash, compiler``.
You can combine multiple modules as a comma-separated list.
Then you can narrow the verbosity of the debugging message by specifying the
verbosity as ``brief, verbose, details``.
For example::
$ ./configure --enable-debug=server,packet --enable-debuglevel=brief
$ ./configure --enable-debug=server,packet --enable-debuglevel=verbose
For more detailed information, see @ref{Debug messages}.
In most simple case you can just run configure without any options::
$ ./configure
(After running ``./configure`` you can compile Knot DNS by running
``make`` command, which will produce binaries and other related
$ make
Knot DNS build process is safe to parallelize using ``make -j N``,
where N is number of concurrent processes. Using this option can
increase speed of the compilation.
For example to use maximum 8 concurrent processes you would use::
$ make -j 8
When you have finished building the Knot DNS, it's time to install the
binaries and configuration files into the operation system hierarchy.
You can do so by executing ``make install`` command. When installing
as a non-root user you might have to gain elevated privileges by
switching to root user, e.g. ``sudo make install`` or ``su -c 'make install'``::
$ make install
Installation from packages
In addition to providing the packages in .DEB and .RPM format, the
Knot DNS might already be available in your favourite distribution, or
in a ports tree.
Installing Knot DNS packages on Debian
Knot DNS is already available from Debian wheezy upwards. In addition
to the official packages we also provide custom repository, which can
be used by adding::
deb @url{} <codename> main
deb-src @url{} <codename> main
to your ``/etc/apt/sources.list`` or into separate file in
As an example, for Debian squeeze (current stable) the Knot DNS
packages can be added by executing following command as the root user::
$ cat >/etc/apt/sources.list.d/knot.list <<EOF
deb <codename> main
deb-src <codename> main
$ apt-get update
$ apt-get install knot
Installing Knot DNS packages on Ubuntu
Prepackaged version of the Knot DNS can be found in Ubuntu from
version 12.10 (Quantal Quetzal). In addition to the package included
in the main archive, we provide Personal Package Archive (PPA) as an
option to upgrade to last stable version of the Knot DNS or to install
it on older versions of Ubuntu Linux.
We typically provide packages for all supported versions of Ubuntu
Linux including 5 year support for `LTS <>`
versions of Ubuntu Linux. At the time of writing this manual this
includes Ubuntu 10.04 LTS, 11.04, 11.10 and 12.04 LTS.
Adding official PPA repository for Knot DNS
To start installing and using software from a Personal Package
Archive, you first need to tell Ubuntu where to find the PPA::
$ sudo add-apt-repository ppa:cz.nic-labs/knot-dns
$ sudo apt-get update
$ sudo apt-get install knot
Running this sequence of commands will ensure that you will
install Knot DNS on your system and keep it up-to-date
in the future, when new versions are released.
Installing Knot DNS packages on Fedora
The RPM packages for ``Knot DNS`` are available in official Fedora
repositories since Fedora@tie{}18 (Spherical Cow). Look for
``knot`` package in your package manager. To install the package
using Yum, run a following command as the root user::
# yum install knot
Using official distribution repository is highly recommended, however you may
want to run ``Knot DNS`` on older releases of Fedora. In this case you can
set up an unofficial repository by creating @file{/etc/yum.repos.d/knot.conf}
file with the following content::
name=Network.CZ Repository
After performing this action, you can install ``knot`` package the same way
as described above. Please note that the unofficial repository contains only
builds for i686 and x86_64 architecture.
When upgrading to Fedora 18 or higher, backup the configuration and
switch to the latest package provided in the official repository by running the
following command as the root user:
# yum distro-sync knot
Installing Knot DNS from ports on FreeBSD
Knot DNS is in ports tree under ``dns/knot``::
$ cd /usr/ports/dns/knot
$ sudo make install
Installing Knot DNS on Arch Linux
Installing Knot DNS on Gentoo Linux
The reader of this document is assumed to know the principles of
Domain Name System.
What is Knot DNS
Knot DNS is a high-performance open source DNS server. It
implements only authoritative domain name service. Knot DNS
is best suited for use on TLD domains but can reliably serve
any other zones as well.
Knot DNS benefits from its multi-threaded and mostly lock-free
implementation which allows it to scale well on SMP systems and
operate non-stop even when adding or removing zones.
Knot DNS features
Knot DNS supports the following DNS features:
* TCP/UDP protocols
* AXFR, IXFR - master, slave
* DNSSEC, including NSEC3
* Unknown RR types
Server features:
* Adding/removing zones on-the-fly
* Reconfiguring server instance on-the-fly
* IPv4 / IPv6 support
* Semantic checks of zones
For more info and downloads see ` <>`.
Git repository: `git://`
Git repository browser: ` <>`
Knot DNS issue tracker: ` <>`
Knot DNS users mailing list: ` <>`
Scope of this document
This document covers the basic information on installing, configuring
and troubleshooting the Knot DNS server.
Welcome to Knot DNS's documentation!
This manual is for Knot DNS (version @VERSION@, @RELEASE_DATE@),
which is a high-performance authoritative-only DNS server.::
Copyright @copyright{} 2012 CZ.NIC, z.s.p.o.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <>.
.. toctree::
:maxdepth: 2
Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Migration from other DNS servers
Knot DNS Configuration Reference
This reference describes every configuration option in Knot DNS server.
Knot DNS Resource Requirements
Hardware requirements
Knot DNS requirements are not very demanding for typical
installations, and a commodity server or a virtual solution will be
sufficient in most cases.
However please note that there are some scenarios that will require
administrator attention and testing of exact requirements before
deploying Knot DNS in production. These cases include deployment for a
large number of zones (DNS hosting), a large number of records in one
or more zones (TLD) or large number of requests.
CPU requirements
Knot DNS scales with processing power and also with the number of
available cores/CPUs.
There is no lower bound on the CPU requirements, but it should support
memory barriers and CAS (i586 and newer).
Memory requirements
Knot DNS implementation focuses on performance and thus can be quite
demanding for memory. The rough estimate for memory requirements is
5-7 times of the size of the zone in text format. Again this is only
an estimate and you are advised to do your own measurements before
deploying Knot DNS into production.
Also note that to ensure uninterrupted serving of the zone, Knot DNS
employs a Read-Copy-Update mechanism instead of locking and thus
requires twice the amount of memory for the duration of incoming
Supported operating system
Knot DNS itself is written in a portable way, but it depends on
several libraries. Namely userspace-rcu, which could be a constraint
when it comes to the operating system support. As far as we know the
Knot DNS can be compiled and run on Linux, FreeBSD, OpenBSD, NetBSD
and Mac OS X.
Running Knot DNS
Knot DNS can run either in the foreground or in a background, with the @code{-d}
option. When run in foreground, it doesn't create a PID file. Other than that,
there are no differences and you can control it just the same way.
Usage: knotd [parameters]
-c, --config <file> Select configuration file.
-d, --daemonize=[dir] Run server as a daemon. Working directory may