1.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2..
3.. SPDX-License-Identifier: MPL-2.0
4..
5.. This Source Code Form is subject to the terms of the Mozilla Public
6.. License, v. 2.0.  If a copy of the MPL was not distributed with this
7.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
8..
9.. See the COPYRIGHT file distributed with this work for additional
10.. information regarding copyright ownership.
11
12.. _ns_operations:
13
14Name Server Operations
15----------------------
16
17.. _tools:
18
19Tools for Use With the Name Server Daemon
20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22This section describes several indispensable diagnostic, administrative,
23and monitoring tools available to the system administrator for
24controlling and debugging the name server daemon.
25
26.. _diagnostic_tools:
27
28Diagnostic Tools
29^^^^^^^^^^^^^^^^
30
31The :iscman:`dig`, :iscman:`host`, and :iscman:`nslookup` programs are all command-line
32tools for manually querying name servers. They differ in style and
33output format.
34
35:iscman:`dig`
36   :iscman:`dig` is the most versatile and complete of these lookup tools. It
37   has two modes: simple interactive mode for a single query, and batch
38   mode, which executes a query for each in a list of several query
39   lines. All query options are accessible from the command line.
40
41   For more information and a list of available commands and options,
42   see :ref:`man_dig`.
43
44:iscman:`host`
45   The :iscman:`host` utility emphasizes simplicity and ease of use. By
46   default, it converts between host names and Internet addresses, but
47   its functionality can be extended with the use of options.
48
49   For more information and a list of available commands and options,
50   see :ref:`man_host`.
51
52:iscman:`nslookup`
53   :iscman:`nslookup` has two modes: interactive and non-interactive.
54   Interactive mode allows the user to query name servers for
55   information about various hosts and domains, or to print a list of
56   hosts in a domain. Non-interactive mode is used to print just the
57   name and requested information for a host or domain.
58
59   Due to its arcane user interface and frequently inconsistent
60   behavior, we do not recommend the use of :iscman:`nslookup`. Use :iscman:`dig`
61   instead.
62
63.. _admin_tools:
64
65Administrative Tools
66^^^^^^^^^^^^^^^^^^^^
67
68Administrative tools play an integral part in the management of a
69server.
70
71:iscman:`named-checkconf`
72   The :iscman:`named-checkconf` program checks the syntax of a :iscman:`named.conf`
73   file.
74
75   For more information and a list of available commands and options,
76   see :ref:`man_named-checkconf`.
77
78:iscman:`named-checkzone`
79   The :iscman:`named-checkzone` program checks a zone file for syntax and
80   consistency.
81
82   For more information and a list of available commands and options,
83   see :ref:`man_named-checkzone`.
84
85:iscman:`named-compilezone`
86   This tool is similar to :iscman:`named-checkzone` but it always dumps the zone content
87   to a specified file (typically in a different format).
88
89   For more information and a list of available commands and options,
90   see :ref:`man_named-compilezone`.
91
92.. _ops_rndc:
93
94:iscman:`rndc`
95   The remote name daemon control (:iscman:`rndc`) program allows the system
96   administrator to control the operation of a name server.
97
98   See :ref:`man_rndc` for details of the available :iscman:`rndc`
99   commands.
100
101   :iscman:`rndc` requires a configuration file, since all communication with
102   the server is authenticated with digital signatures that rely on a
103   shared secret, and there is no way to provide that secret other than
104   with a configuration file. The default location for the :iscman:`rndc`
105   configuration file is |rndc_conf|, but an alternate location
106   can be specified with the :option:`-c <rndc -c>` option. If the configuration file is
107   not found, :iscman:`rndc` also looks in |rndc_key| (or whatever
108   ``sysconfdir`` was defined when the BIND build was configured). The
109   ``rndc.key`` file is generated by running :option:`rndc-confgen -a` as
110   described in :any:`controls`.
111
112   The format of the configuration file is similar to that of
113   :iscman:`named.conf`, but is limited to only three blocks: the :rndcconf:ref:`options`,
114   :rndcconf:ref:`key`, :rndcconf:ref:`server`, and the :ref:`include_grammar`. These blocks are
115   what associate the secret keys to the servers with which they are
116   meant to be shared. The order of blocks is not significant.
117
118.. rndcconf:statement:: options
119
120   .. rndcconf:statement:: default-server
121
122      :any:`default-server` takes a
123      host name or address argument and represents the server that is
124      contacted if no :option:`-s <rndc -s>` option is provided on the command line.
125
126   .. rndcconf:statement:: default-key
127
128      :any:`default-key` takes the name of a key as its argument, as defined
129      by a :rndcconf:ref:`key` block.
130
131   .. rndcconf:statement:: default-port
132
133      :any:`default-port` specifies the port to which
134      :iscman:`rndc` should connect if no port is given on the command line or in
135      a :rndcconf:ref:`server` block.
136
137   .. rndcconf:statement:: default-source-address
138   .. rndcconf:statement:: default-source-address-v6
139
140      :any:`default-source-address` and :any:`default-source-address-v6` specify
141      the IPv4 and IPv6 source address used to communicate with the server
142      if no address is given on the command line or in a
143      :rndcconf:ref:`server` block.
144
145.. rndcconf:statement:: key
146
147   The :rndcconf:ref:`key` block defines a key to be used by :iscman:`rndc` when
148   authenticating with :iscman:`named`. Its syntax is identical to the :namedconf:ref:`key`
149   statement in :iscman:`named.conf`. The keyword :rndcconf:ref:`key` is followed by a key
150   name, which must be a valid domain name, though it need not actually
151   be hierarchical; thus, a string like ``rndc_key`` is a valid name.
152   The :rndcconf:ref:`key` block has two statements: :rndcconf:ref:`algorithm` and :rndcconf:ref:`secret`.
153
154   .. rndcconf:statement:: algorithm
155
156      While the configuration parser accepts any string as the argument
157      to :rndcconf:ref:`algorithm`, currently only the strings ``hmac-md5``,
158      ``hmac-sha1``, ``hmac-sha224``, ``hmac-sha256``,
159      ``hmac-sha384``, and ``hmac-sha512`` have any meaning.
160
161   .. rndcconf:statement:: secret
162
163      The secret
164      is a Base64-encoded string as specified in :rfc:`3548`.
165
166.. rndcconf:statement:: server
167
168   The :rndcconf:ref:`server` block specifies connection parameters for a given server.
169   The server can be specified as a host name or address.
170
171   .. rndcconf:statement:: addresses
172
173      Specifies one or more addresses to use when communicating with this
174      server.
175
176   :rndcconf:ref:`key`
177      Associates a key defined using the :rndcconf:ref:`key` statement with a
178      server.
179
180   .. rndcconf:statement:: port
181
182      Specifes the port :iscman:`rndc` should connect to on the server.
183
184   .. rndcconf:statement:: source-address
185   .. rndcconf:statement:: source-address-v6
186
187      Overrides :rndcconf:ref:`default-source-address` and
188      :rndcconf:ref:`default-source-address-v6` for this specific server.
189
190   A sample minimal configuration file is as follows:
191
192   ::
193
194      key rndc_key {
195           algorithm "hmac-sha256";
196           secret
197             "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
198      };
199      options {
200           default-server 127.0.0.1;
201           default-key    rndc_key;
202      };
203
204   This file, if installed as |rndc_conf|, allows the
205   command:
206
207   :option:`rndc reload`
208
209   to connect to 127.0.0.1 port 953 and causes the name server to reload,
210   if a name server on the local machine is running with the following
211   controls statements:
212
213   ::
214
215      controls {
216          inet 127.0.0.1
217              allow { localhost; } keys { rndc_key; };
218      };
219
220   and it has an identical key block for ``rndc_key``.
221
222   Running the :iscman:`rndc-confgen` program conveniently creates an
223   :iscman:`rndc.conf` file, and also displays the corresponding
224   :any:`controls` statement needed to add to :iscman:`named.conf`.
225   Alternatively, it is possible to run :option:`rndc-confgen -a` to set up an
226   ``rndc.key`` file and not modify :iscman:`named.conf` at all.
227
228Signals
229~~~~~~~
230
231Certain Unix signals cause the name server to take specific actions, as
232described in the following table. These signals can be sent using the
233``kill`` command.
234
235+--------------+-------------------------------------------------------------+
236| ``SIGHUP``   | Causes the server to read :iscman:`named.conf` and reload   |
237|              | the database.                                               |
238+--------------+-------------------------------------------------------------+
239| ``SIGTERM``  | Causes the server to clean up and exit.                     |
240+--------------+-------------------------------------------------------------+
241| ``SIGINT``   | Causes the server to clean up and exit.                     |
242+--------------+-------------------------------------------------------------+
243
244