4. Name Server Operations
4.1. Tools for Use With the Name Server Daemon
This section describes several indispensable diagnostic, administrative, and monitoring tools available to the system administrator for controlling and debugging the name server daemon.
4.1.1. Diagnostic Tools
The dig
, host
, and nslookup
programs are all command-line
tools for manually querying name servers. They differ in style and
output format.
dig
dig
is the most versatile and complete of these lookup tools. It has two modes: simple interactive mode for a single query, and batch mode, which executes a query for each in a list of several query lines. All query options are accessible from the command line.For more information and a list of available commands and options, see dig - DNS lookup utility.
host
The
host
utility emphasizes simplicity and ease of use. By default, it converts between host names and Internet addresses, but its functionality can be extended with the use of options.For more information and a list of available commands and options, see host - DNS lookup utility.
nslookup
nslookup
has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains, or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.Due to its arcane user interface and frequently inconsistent behavior, we do not recommend the use of
nslookup
. Usedig
instead.
4.1.2. Administrative Tools
Administrative tools play an integral part in the management of a server.
named-checkconf
The
named-checkconf
program checks the syntax of anamed.conf
file.For more information and a list of available commands and options, see named-checkconf - named configuration file syntax checking tool.
named-checkzone
The
named-checkzone
program checks a zone file for syntax and consistency.For more information and a list of available commands and options, see named-checkzone - zone file validation tool.
named-compilezone
This tool is similar to
named-checkzone
but it always dumps the zone content to a specified file (typically in a different format).For more information and a list of available commands and options, see named-compilezone - zone file converting tool.
rndc
The remote name daemon control (
rndc
) program allows the system administrator to control the operation of a name server.See rndc - name server control utility for details of the available
rndc
commands.rndc
requires a configuration file, since all communication with the server is authenticated with digital signatures that rely on a shared secret, and there is no way to provide that secret other than with a configuration file. The default location for therndc
configuration file is/etc/rndc.conf
, but an alternate location can be specified with the-c
option. If the configuration file is not found,rndc
also looks in/etc/rndc.key
(or whateversysconfdir
was defined when the BIND build was configured). Therndc.key
file is generated by runningrndc-confgen -a
as described incontrols
.The format of the configuration file is similar to that of
named.conf
, but is limited to only three blocks: theoptions
,key
,server
, and the include Directive. These blocks are what associate the secret keys to the servers with which they are meant to be shared. The order of blocks is not significant.
- options
Grammar:
options { default-key <string>; default-port <integer>; default-server <string>; default-source-address ( <ipv4_address> | * ); default-source-address-v6 ( <ipv6_address> | * ); };
Blocks: topmost
- default-server
Grammar:
default-server <string>;
Blocks: options
default-server
takes a host name or address argument and represents the server that is contacted if no-s
option is provided on the command line.
- default-key
Grammar:
default-key <string>;
Blocks: options
default-key
takes the name of a key as its argument, as defined by akey
block.
- default-port
Grammar:
default-port <integer>;
Blocks: options
default-port
specifies the port to whichrndc
should connect if no port is given on the command line or in aserver
block.
- default-source-address
Grammar:
default-source-address ( <ipv4_address> | * );
Blocks: options
- default-source-address-v6
Grammar:
default-source-address-v6 ( <ipv6_address> | * );
Blocks: options
default-source-address
anddefault-source-address-v6
specify the IPv4 and IPv6 source address used to communicate with the server if no address is given on the command line or in aserver
block.
- key
Grammar server:
key <string>;
Grammar topmost:
key <string> { algorithm <string>; secret <string>; }; // may occur multiple times
Blocks: topmost, server
The
key
block defines a key to be used byrndc
when authenticating withnamed
. Its syntax is identical to thekey
statement innamed.conf
. The keywordkey
is followed by a key name, which must be a valid domain name, though it need not actually be hierarchical; thus, a string likerndc_key
is a valid name. Thekey
block has two statements:algorithm
andsecret
.
- server
Grammar:
server <string> { addresses { ( <quoted_string> [ port <integer> ] | <ipv4_address> [ port <integer> ] | <ipv6_address> [ port <integer> ] ); ... }; key <string>; port <integer>; source-address ( <ipv4_address> | * ); source-address-v6 ( <ipv6_address> | * ); }; // may occur multiple times
Blocks: topmost
The
server
block specifies connection parameters for a given server. The server can be specified as a host name or address.- addresses
Grammar:
addresses { ( <quoted_string> [ port <integer> ] | <ipv4_address> [ port <integer> ] | <ipv6_address> [ port <integer> ] ); ... };
Blocks: server
Specifies one or more addresses to use when communicating with this server.
- port
Grammar:
port <integer>;
Blocks: server
Specifes the port
rndc
should connect to on the server.
- source-address
Grammar:
source-address ( <ipv4_address> | * );
Blocks: server
- source-address-v6
Grammar:
source-address-v6 ( <ipv6_address> | * );
Blocks: server
Overrides
default-source-address
anddefault-source-address-v6
for this specific server.
A sample minimal configuration file is as follows:
key rndc_key { algorithm "hmac-sha256"; secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K"; }; options { default-server 127.0.0.1; default-key rndc_key; };
This file, if installed as
/etc/rndc.conf
, allows the command:to connect to 127.0.0.1 port 953 and causes the name server to reload, if a name server on the local machine is running with the following controls statements:
controls { inet 127.0.0.1 allow { localhost; } keys { rndc_key; }; };
and it has an identical key block for
rndc_key
.Running the
rndc-confgen
program conveniently creates anrndc.conf
file, and also displays the correspondingcontrols
statement needed to add tonamed.conf
. Alternatively, it is possible to runrndc-confgen -a
to set up anrndc.key
file and not modifynamed.conf
at all.
4.2. Signals
Certain Unix signals cause the name server to take specific actions, as
described in the following table. These signals can be sent using the
kill
command.
|
Causes the server to read |
|
Causes the server to clean up and exit. |
|
Causes the server to clean up and exit. |
4.3. Plugins
Plugins are a mechanism to extend the functionality of named
using
dynamically loadable libraries. By using plugins, core server
functionality can be kept simple for the majority of users; more complex
code implementing optional features need only be installed by users that
need those features.
The plugin interface is a work in progress, and is expected to evolve as more plugins are added. Currently, only “query plugins” are supported; these modify the name server query logic. Other plugin types may be added in the future.
The only plugin currently included in BIND is filter-aaaa.so
, which
replaces the filter-aaaa
feature that previously existed natively as
part of named
. The code for this feature has been removed from
named
and can no longer be configured using standard named.conf
syntax, but linking in the filter-aaaa.so
plugin provides identical
functionality.
4.4. Configuring Plugins
- plugin
Grammar:
plugin ( query ) <string> [ { <unspecified-text> } ]; // may occur multiple times
Blocks: topmost, view
Tags: server
Configures plugins in
named.conf
.
A plugin is configured with the plugin
statement in named.conf
:
plugin query "library.so" {
parameters
};
In this example, file library.so
is the plugin library. query
indicates that this is a query plugin.
Multiple plugin
statements can be specified, to load different
plugins or multiple instances of the same plugin.
parameters
are passed as an opaque string to the plugin’s initialization
routine. Configuration syntax differs depending on the module.
4.5. Developing Plugins
Each plugin implements four functions:
plugin_register
to allocate memory, configure a plugin instance, and attach to hook points withinnamed
,plugin_destroy
to tear down the plugin instance and free memory,plugin_version
to check that the plugin is compatible with the current version of the plugin API,plugin_check
to test syntactic correctness of the plugin parameters.
At various locations within the named
source code, there are “hook
points” at which a plugin may register itself. When a hook point is
reached while named
is running, it is checked to see whether any
plugins have registered themselves there; if so, the associated “hook
action” - a function within the plugin library - is called. Hook
actions may examine the runtime state and make changes: for example,
modifying the answers to be sent back to a client or forcing a query to
be aborted. More details can be found in the file
lib/ns/include/ns/hooks.h
.