xref: /netbsd-src/external/mpl/bind/dist/doc/arm/reference.rst (revision 9fd8799cb5ceb66c69f2eb1a6d26a1d587ba1f1e)
1..
2   Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3
4   This Source Code Form is subject to the terms of the Mozilla Public
5   License, v. 2.0. If a copy of the MPL was not distributed with this
6   file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8   See the COPYRIGHT file distributed with this work for additional
9   information regarding copyright ownership.
10
11..
12   Copyright (C) Internet Systems Consortium, Inc. ("ISC")
13
14   This Source Code Form is subject to the terms of the Mozilla Public
15   License, v. 2.0. If a copy of the MPL was not distributed with this
16   file, You can obtain one at http://mozilla.org/MPL/2.0/.
17
18   See the COPYRIGHT file distributed with this work for additional
19   information regarding copyright ownership.
20
21.. Reference:
22
23BIND 9 Configuration Reference
24==============================
25
26.. _configuration_file_elements:
27
28Configuration File Elements
29---------------------------
30
31Following is a list of elements used throughout the BIND configuration
32file documentation:
33
34.. glossary::
35
36    ``acl_name``
37        The name of an ``address_match_list`` as defined by the ``acl`` statement.
38
39    ``address_match_list``
40        A list of one or more ``ip_addr``, ``ip_prefix``, ``key_id``, or ``acl_name`` elements, see :ref:`address_match_lists`.
41
42    ``masters_list``
43        A named list of one or more ``ip_addr`` with optional ``key_id`` and/or ``ip_port``. A ``masters_list`` may include other ``masters_lists``.
44
45    ``domain_name``
46        A quoted string which is used as a DNS name, for example "``my.test.domain``".
47
48    ``namelist``
49        A list of one or more ``domain_name`` elements.
50
51    ``dotted_decimal``
52        One to four integers valued 0 through 255 separated by dots ('.'), such as ``123``, ``45.67`` or ``89.123.45.67``.
53
54    ``ip4_addr``
55        An IPv4 address with exactly four elements in ``dotted_decimal`` notation.
56
57    ``ip6_addr``
58        An IPv6 address, such as ``2001:db8::1234``. IPv6 scoped addresses that have ambiguity on their scope zones must be disambiguated by an appropriate zone ID with the percent character ('%') as delimiter. It is strongly recommended to use string zone names rather than numeric identifiers, to be robust against system configuration changes. However, since there is no standard mapping for such names and identifier values, currently only interface names as link identifiers are supported, assuming one-to-one mapping between interfaces and links. For example, a link-local address ``fe80::1`` on the link attached to the interface ``ne0`` can be specified as ``fe80::1%ne0``. Note that on most systems link-local addresses always have ambiguity and need to be disambiguated.
59
60    ``ip_addr``
61        An ``ip4_addr`` or ``ip6_addr``.
62
63    ``ip_dscp``
64        A ``number`` between 0 and 63, used to select a differentiated services code point (DSCP) value for use with outgoing traffic on operating systems that support DSCP.
65
66    ``ip_port``
67        An IP port ``number``. The ``number`` is limited to 0 through 65535, with values below 1024 typically restricted to use by processes running as root. In some cases, an asterisk (``*``) character can be used as a placeholder to select a random high-numbered port.
68
69    ``ip_prefix``
70        An IP network specified as an ``ip_addr``, followed by a slash ('/') and then the number of bits in the netmask. Trailing zeros in an``ip_addr`` may omitted. For example, ``127/8`` is the network ``127.0.0.0`` with network ``1.2.3.0`` with netmask ``255.255.255.240``.
71        When specifying a prefix involving a IPv6 scoped address the scope may be omitted. In that case the prefix matches packets from any scope.
72
73    ``key_id``
74        A ``domain_name`` representing the name of a shared key, to be used for transaction security.
75
76    ``key_list``
77        A list of one or more ``key_id``\ s, separated by semicolons and ending with a semicolon.
78
79    ``number``
80        A non-negative 32-bit integer (i.e., a number between 0 and 4294967295, inclusive). Its acceptable value might be further limited by the context in which it is used.
81
82    ``fixedpoint``
83        A non-negative real number that can be specified to the nearest one-hundredth. Up to five digits can be specified before a decimal point, and up to two digits after, so the maximum value is 99999.99. Acceptable values might be further limited by the contexts in which they are used.
84
85    ``path_name``
86        A quoted string which is used as a pathname, such as ``zones/master/my.test.domain``.
87
88    ``port_list``
89        A list of an ``ip_port`` or a port range. A port range is specified in the form of ``range`` followed by two ``ip_port``\ s, ``port_low`` and ``port_high``, which represents port numbers from ``port_low`` through ``port_high``, inclusive. ``port_low`` must not be larger than ``port_high``. For example, ``range 1024 65535`` represents ports from 1024 through 65535. In either case an asterisk ('\*') character is not allowed as a valid ``ip_port``.
90
91    ``size_spec``
92        A 64-bit unsigned integer, or the keywords ``unlimited`` or ``default``. Integers may take values 0 <= value <= 18446744073709551615, though certain parameters (such as ``max-journal-size``) may use a more limited range within these extremes. In most cases, setting a value to 0 does not literally mean zero; it means "undefined" or "as big as possible", depending on the context. See the explanations of particular parameters that use ``size_spec`` for details on how they interpret its use. Numeric values can optionally be followed by a scaling factor: ``K`` or ``k`` for kilobytes, ``M`` or ``m`` for megabytes, and ``G`` or ``g`` for gigabytes, which scale by 1024, 1024*1024, and 1024*1024*1024 respectively.
93        ``unlimited`` generally means "as big as possible," and is usually the best way to safely set a very large number.
94        ``default`` uses the limit that was in force when the server was started.
95
96    ``size_or_percent``
97         A ``size_spec`` or integer value followed by '%' to represent percent. The behavior is exactly the same as ``size_spec``, but ``size_or_percent`` also allows specifying a positive integer value followed by the '%' sign to represent percent.
98
99    ``yes_or_no``
100        Either ``yes`` or ``no``. The words ``true`` and ``false`` are also accepted, as are the numbers ``1`` and ``0``.
101
102    ``dialup_option``
103        One of ``yes``, ``no``, ``notify``, ``notify-passive``, ``refresh``, or  ``passive``. When used in a zone, ``notify-passive``, ``refresh``, and ``passive`` are restricted to secondary and stub zones.
104
105.. _address_match_lists:
106
107Address Match Lists
108~~~~~~~~~~~~~~~~~~~
109
110Syntax
111^^^^^^
112
113::
114
115   address_match_list = address_match_list_element ; ...
116
117   address_match_list_element = [ ! ] ( ip_address | ip_prefix |
118        key key_id | acl_name | { address_match_list } )
119
120Definition and Usage
121^^^^^^^^^^^^^^^^^^^^
122
123Address match lists are primarily used to determine access control for
124various server operations. They are also used in the ``listen-on`` and
125``sortlist`` statements. The elements which constitute an address match
126list can be any of the following:
127
128-  an IP address (IPv4 or IPv6)
129
130-  an IP prefix (in '/' notation)
131
132-  a key ID, as defined by the ``key`` statement
133
134-  the name of an address match list defined with the ``acl`` statement
135
136-  a nested address match list enclosed in braces
137
138Elements can be negated with a leading exclamation mark (``!``), and the
139match list names "any", "none", "localhost", and "localnets" are
140predefined. More information on those names can be found in the
141description of the ``acl`` statement.
142
143The addition of the key clause made the name of this syntactic element
144something of a misnomer, since security keys can be used to validate
145access without regard to a host or network address. Nonetheless, the
146term "address match list" is still used throughout the documentation.
147
148When a given IP address or prefix is compared to an address match list,
149the comparison takes place in approximately O(1) time. However, key
150comparisons require that the list of keys be traversed until a matching
151key is found, and therefore may be somewhat slower.
152
153The interpretation of a match depends on whether the list is being used
154for access control, defining ``listen-on`` ports, or in a ``sortlist``,
155and whether the element was negated.
156
157When used as an access control list, a non-negated match allows access
158and a negated match denies access. If there is no match, access is
159denied. The clauses ``allow-notify``, ``allow-recursion``,
160``allow-recursion-on``, ``allow-query``, ``allow-query-on``,
161``allow-query-cache``, ``allow-query-cache-on``, ``allow-transfer``,
162``allow-update``, ``allow-update-forwarding``, ``blackhole``, and
163``keep-response-order`` all use address match lists. Similarly, the
164``listen-on`` option causes the server to refuse queries on any of
165the machine's addresses which do not match the list.
166
167Order of insertion is significant. If more than one element in an ACL is
168found to match a given IP address or prefix, preference is given to
169the one that came *first* in the ACL definition. Because of this
170first-match behavior, an element that defines a subset of another
171element in the list should come before the broader element, regardless
172of whether either is negated. For example, in ``1.2.3/24; ! 1.2.3.13;``
173the 1.2.3.13 element is completely useless because the algorithm
174matches any lookup for 1.2.3.13 to the 1.2.3/24 element. Using
175``! 1.2.3.13; 1.2.3/24`` fixes that problem by having 1.2.3.13 blocked
176by the negation, but all other 1.2.3.\* hosts pass through.
177
178.. _comment_syntax:
179
180Comment Syntax
181~~~~~~~~~~~~~~
182
183The BIND 9 comment syntax allows for comments to appear anywhere that
184whitespace may appear in a BIND configuration file. To appeal to
185programmers of all kinds, they can be written in the C, C++, or
186shell/perl style.
187
188Syntax
189^^^^^^
190
191::
192
193   /* This is a BIND comment as in C */
194
195::
196
197   // This is a BIND comment as in C++
198
199::
200
201   # This is a BIND comment as in common Unix shells
202   # and perl
203
204Definition and Usage
205^^^^^^^^^^^^^^^^^^^^
206
207Comments may appear anywhere that whitespace may appear in a BIND
208configuration file.
209
210C-style comments start with the two characters /\* (slash, star) and end
211with \*/ (star, slash). Because they are completely delimited with these
212characters, they can be used to comment only a portion of a line or to
213span multiple lines.
214
215C-style comments cannot be nested. For example, the following is not
216valid because the entire comment ends with the first \*/:
217
218::
219
220   /* This is the start of a comment.
221      This is still part of the comment.
222   /* This is an incorrect attempt at nesting a comment. */
223      This is no longer in any comment. */
224
225C++-style comments start with the two characters // (slash, slash) and
226continue to the end of the physical line. They cannot be continued
227across multiple physical lines; to have one logical comment span
228multiple lines, each line must use the // pair. For example:
229
230::
231
232   // This is the start of a comment.  The next line
233   // is a new comment, even though it is logically
234   // part of the previous comment.
235
236Shell-style (or perl-style, if you prefer) comments start with the
237character ``#`` (number sign) and continue to the end of the physical
238line, as in C++ comments. For example:
239
240::
241
242   # This is the start of a comment.  The next line
243   # is a new comment, even though it is logically
244   # part of the previous comment.
245
246..
247
248.. warning::
249
250   The semicolon (``;``) character cannot start a comment, unlike
251   in a zone file. The semicolon indicates the end of a
252   configuration statement.
253
254.. _Configuration_File_Grammar:
255
256Configuration File Grammar
257--------------------------
258
259A BIND 9 configuration consists of statements and comments. Statements
260end with a semicolon; statements and comments are the only elements that
261can appear without enclosing braces. Many statements contain a block of
262sub-statements, which are also terminated with a semicolon.
263
264The following statements are supported:
265
266    ``acl``
267        Defines a named IP address matching list, for access control and other uses.
268
269    ``controls``
270        Declares control channels to be used by the ``rndc`` utility.
271
272    ``dnssec-policy``
273        Describes a DNSSEC key and signing policy for zones. See :ref:`dnssec-policy Grammar <dnssec_policy_grammar>` for details.
274
275    ``include``
276        Includes a file.
277
278    ``key``
279        Specifies key information for use in authentication and authorization using TSIG.
280
281    ``logging``
282        Specifies what the server logs, and where the log messages are sent.
283
284    ``masters``
285        Defines a named masters list for inclusion in stub and secondary zones' ``masters`` or ``also-notify`` lists.
286
287    ``options``
288        Controls global server configuration options and sets defaults for other statements.
289
290    ``server``
291        Sets certain configuration options on a per-server basis.
292
293    ``statistics-channels``
294        Declares communication channels to get access to ``named`` statistics.
295
296    ``trust-anchors``
297        Defines DNSSEC trust anchors: if used with the ``initial-key`` or ``initial-ds`` keyword, trust anchors are kept up-to-date using :rfc:`5011` trust anchor maintenance; if used with ``static-key`` or ``static-ds``, keys are permanent.
298
299    ``managed-keys``
300        Is identical to ``trust-anchors``; this option is deprecated in favor of ``trust-anchors`` with the ``initial-key`` keyword, and may be removed in a future release.
301
302    ``trusted-keys``
303        Defines permanent trusted DNSSEC keys; this option is deprecated in favor of ``trust-anchors`` with the ``static-key`` keyword, and may be removed in a future release.
304
305    ``view``
306        Defines a view.
307
308    ``zone``
309        Defines a zone.
310
311The ``logging`` and ``options`` statements may only occur once per
312configuration.
313
314.. _acl_grammar:
315
316``acl`` Statement Grammar
317~~~~~~~~~~~~~~~~~~~~~~~~~
318
319.. include:: ../misc/acl.grammar.rst
320
321.. _acl:
322
323``acl`` Statement Definition and Usage
324~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325
326The ``acl`` statement assigns a symbolic name to an address match list.
327It gets its name from a primary use of address match lists: Access
328Control Lists (ACLs).
329
330The following ACLs are built-in:
331
332    ``any``
333        Matches all hosts.
334
335    ``none``
336        Matches no hosts.
337
338    ``localhost``
339        Matches the IPv4 and IPv6 addresses of all network interfaces on the system. When addresses are added or removed, the ``localhost`` ACL element is updated to reflect the changes.
340
341    ``localnets``
342        Matches any host on an IPv4 or IPv6 network for which the system has an interface. When addresses are added or removed, the ``localnets`` ACL element is updated to reflect the changes. Some systems do not provide a way to determine the prefix lengths of local IPv6  addresses; in such a case, ``localnets`` only matches the local IPv6 addresses, just like ``localhost``.
343
344.. _controls_grammar:
345
346``controls`` Statement Grammar
347~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348
349.. include:: ../misc/controls.grammar.rst
350
351.. _controls_statement_definition_and_usage:
352
353``controls`` Statement Definition and Usage
354~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355
356The ``controls`` statement declares control channels to be used by
357system administrators to control the operation of the name server. These
358control channels are used by the ``rndc`` utility to send commands to
359and retrieve non-DNS results from a name server.
360
361An ``inet`` control channel is a TCP socket listening at the specified
362``ip_port`` on the specified ``ip_addr``, which can be an IPv4 or IPv6
363address. An ``ip_addr`` of ``*`` (asterisk) is interpreted as the IPv4
364wildcard address; connections are accepted on any of the system's
365IPv4 addresses. To listen on the IPv6 wildcard address, use an
366``ip_addr`` of ``::``. If ``rndc`` is only used on the local host,
367using the loopback address (``127.0.0.1`` or ``::1``) is recommended for
368maximum security.
369
370If no port is specified, port 953 is used. The asterisk "``*``" cannot
371be used for ``ip_port``.
372
373The ability to issue commands over the control channel is restricted by
374the ``allow`` and ``keys`` clauses. Connections to the control channel
375are permitted based on the ``address_match_list``. This is for simple IP
376address-based filtering only; any ``key_id`` elements of the
377``address_match_list`` are ignored.
378
379A ``unix`` control channel is a Unix domain socket listening at the
380specified path in the file system. Access to the socket is specified by
381the ``perm``, ``owner``, and ``group`` clauses. Note that on some platforms
382(SunOS and Solaris), the permissions (``perm``) are applied to the parent
383directory as the permissions on the socket itself are ignored.
384
385The primary authorization mechanism of the command channel is the
386``key_list``, which contains a list of ``key_id``\ s. Each ``key_id`` in
387the ``key_list`` is authorized to execute commands over the control
388channel. See :ref:`admin_tools` for information about
389configuring keys in ``rndc``.
390
391If the ``read-only`` clause is enabled, the control channel is limited
392to the following set of read-only commands: ``nta -dump``, ``null``,
393``status``, ``showzone``, ``testgen``, and ``zonestatus``. By default,
394``read-only`` is not enabled and the control channel allows read-write
395access.
396
397If no ``controls`` statement is present, ``named`` sets up a default
398control channel listening on the loopback address 127.0.0.1 and its IPv6
399counterpart, ::1. In this case, and also when the ``controls`` statement
400is present but does not have a ``keys`` clause, ``named`` attempts
401to load the command channel key from the file ``rndc.key`` in ``/etc``
402(or whatever ``sysconfdir`` was specified as when BIND was built). To
403create a ``rndc.key`` file, run ``rndc-confgen -a``.
404
405To disable the command channel, use an empty ``controls`` statement:
406``controls { };``.
407
408.. _include_grammar:
409
410``include`` Statement Grammar
411~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412
413::
414
415   include filename;
416
417.. _include_statement:
418
419``include`` Statement Definition and Usage
420~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421
422The ``include`` statement inserts the specified file (or files if a valid glob
423expression is detected) at the point where the ``include`` statement is
424encountered. The ``include`` statement facilitates the administration of
425configuration files by permitting the reading or writing of some things but not
426others. For example, the statement could include private keys that are readable
427only by the name server.
428
429.. _key_grammar:
430
431``key`` Statement Grammar
432~~~~~~~~~~~~~~~~~~~~~~~~~
433
434.. include:: ../misc/key.grammar.rst
435
436.. _key_statement:
437
438``key`` Statement Definition and Usage
439~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440
441The ``key`` statement defines a shared secret key for use with TSIG (see
442:ref:`tsig`) or the command channel (see :ref:`controls_statement_definition_and_usage`).
443
444The ``key`` statement can occur at the top level of the configuration
445file or inside a ``view`` statement. Keys defined in top-level ``key``
446statements can be used in all views. Keys intended for use in a
447``controls`` statement (see :ref:`controls_statement_definition_and_usage`)
448must be defined at the top level.
449
450The key_id, also known as the key name, is a domain name uniquely
451identifying the key. It can be used in a ``server`` statement to cause
452requests sent to that server to be signed with this key, or in address
453match lists to verify that incoming requests have been signed with a key
454matching this name, algorithm, and secret.
455
456The algorithm_id is a string that specifies a security/authentication
457algorithm. The ``named`` server supports ``hmac-md5``, ``hmac-sha1``,
458``hmac-sha224``, ``hmac-sha256``, ``hmac-sha384``, and ``hmac-sha512``
459TSIG authentication. Truncated hashes are supported by appending the
460minimum number of required bits preceded by a dash, e.g.,
461``hmac-sha1-80``. The secret_string is the secret to be used by the
462algorithm, and is treated as a Base64 encoded string.
463
464.. _logging_grammar:
465
466``logging`` Statement Grammar
467~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468
469.. include:: ../misc/logging.grammar.rst
470
471.. _logging_statement:
472
473``logging`` Statement Definition and Usage
474~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
475
476The ``logging`` statement configures a wide variety of logging options
477for the name server. Its ``channel`` phrase associates output methods,
478format options, and severity levels with a name that can then be used
479with the ``category`` phrase to select how various classes of messages
480are logged.
481
482Only one ``logging`` statement is used to define as many channels and
483categories as desired. If there is no ``logging`` statement, the
484logging configuration is:
485
486::
487
488   logging {
489        category default { default_syslog; default_debug; };
490        category unmatched { null; };
491   };
492
493If ``named`` is started with the ``-L`` option, it logs to the specified
494file at startup, instead of using syslog. In this case the logging
495configuration is:
496
497::
498
499   logging {
500        category default { default_logfile; default_debug; };
501        category unmatched { null; };
502   };
503
504The logging configuration is only established when the entire
505configuration file has been parsed. When the server starts up, all
506logging messages regarding syntax errors in the configuration file go to
507the default channels, or to standard error if the ``-g`` option was
508specified.
509
510.. _channel:
511
512The ``channel`` Phrase
513^^^^^^^^^^^^^^^^^^^^^^
514
515All log output goes to one or more ``channels``; there is no limit to
516the number of channels that can be created.
517
518Every channel definition must include a destination clause that says
519whether messages selected for the channel go to a file, go to a particular
520syslog facility, go to the standard error stream, or are discarded. The definition can
521optionally also limit the message severity level that is accepted
522by the channel (the default is ``info``), and whether to include a
523``named``-generated time stamp, the category name, and/or severity level
524(the default is not to include any).
525
526The ``null`` destination clause causes all messages sent to the channel
527to be discarded; in that case, other options for the channel are
528meaningless.
529
530The ``file`` destination clause directs the channel to a disk file. It
531can include additional arguments to specify how large the file is
532allowed to become before it is rolled to a backup file (``size``), how
533many backup versions of the file are saved each time this happens
534(``versions``), and the format to use for naming backup versions
535(``suffix``).
536
537The ``size`` option is used to limit log file growth. If the file ever
538exceeds the specified size, then ``named`` stops writing to the file
539unless it has a ``versions`` option associated with it. If backup
540versions are kept, the files are rolled as described below. If there is
541no ``versions`` option, no more data is written to the log until
542some out-of-band mechanism removes or truncates the log to less than the
543maximum size. The default behavior is not to limit the size of the file.
544
545File rolling only occurs when the file exceeds the size specified with
546the ``size`` option. No backup versions are kept by default; any
547existing log file is simply appended. The ``versions`` option specifies
548how many backup versions of the file should be kept. If set to
549``unlimited``, there is no limit.
550
551The ``suffix`` option can be set to either ``increment`` or
552``timestamp``. If set to ``timestamp``, then when a log file is rolled,
553it is saved with the current timestamp as a file suffix. If set to
554``increment``, then backup files are saved with incrementing numbers as
555suffixes; older files are renamed when rolling. For example, if
556``versions`` is set to 3 and ``suffix`` to ``increment``, then when
557``filename.log`` reaches the size specified by ``size``,
558``filename.log.1`` is renamed to ``filename.log.2``, ``filename.log.0``
559is renamed to ``filename.log.1``, and ``filename.log`` is renamed to
560``filename.log.0``, whereupon a new ``filename.log`` is opened.
561
562Example usage of the ``size``, ``versions``, and ``suffix`` options:
563
564::
565
566   channel an_example_channel {
567       file "example.log" versions 3 size 20m suffix increment;
568       print-time yes;
569       print-category yes;
570   };
571
572The ``syslog`` destination clause directs the channel to the system log.
573Its argument is a syslog facility as described in the ``syslog`` man
574page. Known facilities are ``kern``, ``user``, ``mail``, ``daemon``,
575``auth``, ``syslog``, ``lpr``, ``news``, ``uucp``, ``cron``,
576``authpriv``, ``ftp``, ``local0``, ``local1``, ``local2``, ``local3``,
577``local4``, ``local5``, ``local6``, and ``local7``; however, not all
578facilities are supported on all operating systems. How ``syslog``
579handles messages sent to this facility is described in the
580``syslog.conf`` man page. On a system which uses a very old
581version of ``syslog``, that only uses two arguments to the ``openlog()``
582function, this clause is silently ignored.
583
584On Windows machines syslog messages are directed to the EventViewer.
585
586The ``severity`` clause works like ``syslog``'s "priorities", except
587that they can also be used when writing straight to a file rather
588than using ``syslog``. Messages which are not at least of the severity
589level given are not selected for the channel; messages of higher
590severity levels are accepted.
591
592When using ``syslog``, the ``syslog.conf`` priorities
593also determine what eventually passes through. For example, defining a
594channel facility and severity as ``daemon`` and ``debug``, but only
595logging ``daemon.warning`` via ``syslog.conf``, causes messages of
596severity ``info`` and ``notice`` to be dropped. If the situation were
597reversed, with ``named`` writing messages of only ``warning`` or higher,
598then ``syslogd`` would print all messages it received from the channel.
599
600The ``stderr`` destination clause directs the channel to the server's
601standard error stream. This is intended for use when the server is
602running as a foreground process, for example when debugging a
603configuration.
604
605The server can supply extensive debugging information when it is in
606debugging mode. If the server's global debug level is greater than zero,
607debugging mode is active. The global debug level is set either
608by starting the ``named`` server with the ``-d`` flag followed by a
609positive integer, or by running ``rndc trace``. The global debug level
610can be set to zero, and debugging mode turned off, by running ``rndc
611notrace``. All debugging messages in the server have a debug level;
612higher debug levels give more detailed output. Channels that specify a
613specific debug severity, for example:
614
615::
616
617   channel specific_debug_level {
618       file "foo";
619       severity debug 3;
620   };
621
622get debugging output of level 3 or less any time the server is in
623debugging mode, regardless of the global debugging level. Channels with
624``dynamic`` severity use the server's global debug level to determine
625what messages to print.
626
627``print-time`` can be set to ``yes``, ``no``, or a time format
628specifier, which may be one of ``local``, ``iso8601``, or
629``iso8601-utc``. If set to ``no``, the date and time are not
630logged. If set to ``yes`` or ``local``, the date and time are logged in
631a human-readable format, using the local time zone. If set to
632``iso8601`` the local time is logged in ISO 8601 format. If set to
633``iso8601-utc``, the date and time are logged in ISO 8601 format,
634with time zone set to UTC. The default is ``no``.
635
636``print-time`` may be specified for a ``syslog`` channel, but it is
637usually pointless since ``syslog`` also logs the date and time.
638
639If ``print-category`` is requested, then the category of the message
640is logged as well. Finally, if ``print-severity`` is on, then the
641severity level of the message is logged. The ``print-`` options may
642be used in any combination, and are always printed in the following
643order: time, category, severity. Here is an example where all three
644``print-`` options are on:
645
646``28-Feb-2000 15:05:32.863 general: notice: running``
647
648If ``buffered`` has been turned on, the output to files is not
649flushed after each log entry. By default all log messages are flushed.
650
651There are four predefined channels that are used for ``named``'s default
652logging, as follows. If ``named`` is started with ``-L`` then a fifth
653channel ``default_logfile`` is added. How they are used is described in
654:ref:`the_category_phrase`.
655
656::
657
658   channel default_syslog {
659       // send to syslog's daemon facility
660       syslog daemon;
661       // only send priority info and higher
662       severity info;
663   };
664
665   channel default_debug {
666       // write to named.run in the working directory
667       // Note: stderr is used instead of "named.run" if
668       // the server is started with the '-g' option.
669       file "named.run";
670       // log at the server's current debug level
671       severity dynamic;
672   };
673
674   channel default_stderr {
675       // writes to stderr
676       stderr;
677       // only send priority info and higher
678       severity info;
679   };
680
681   channel null {
682      // toss anything sent to this channel
683      null;
684   };
685
686   channel default_logfile {
687       // this channel is only present if named is
688       // started with the -L option, whose argument
689       // provides the file name
690       file "...";
691       // log at the server's current debug level
692       severity dynamic;
693   };
694
695The ``default_debug`` channel has the special property that it only
696produces output when the server's debug level is nonzero. It normally
697writes to a file called ``named.run`` in the server's working directory.
698
699For security reasons, when the ``-u`` command line option is used, the
700``named.run`` file is created only after ``named`` has changed to the
701new UID, and any debug output generated while ``named`` is starting up
702and still running as root is discarded. To capture this
703output, run the server with the ``-L`` option to specify a
704default logfile, or the ``-g`` option to log to standard error which can
705be redirected to a file.
706
707Once a channel is defined, it cannot be redefined. The
708built-in channels cannot be altered directly, but the default logging
709can be modified by pointing categories at defined channels.
710
711.. _the_category_phrase:
712
713The ``category`` Phrase
714^^^^^^^^^^^^^^^^^^^^^^^
715
716There are many categories, so desired logs can be sent anywhere
717while unwanted logs are ignored. If
718a list of channels is not specified for a category, log messages in that
719category are sent to the ``default`` category instead. If no
720default category is specified, the following "default default" is used:
721
722::
723
724   category default { default_syslog; default_debug; };
725
726If ``named`` is started with the ``-L`` option then the default category
727is:
728
729::
730
731   category default { default_logfile; default_debug; };
732
733As an example, let's say a user wants to log security events to a file, but
734also wants to keep the default logging behavior. They would specify the
735following:
736
737::
738
739   channel my_security_channel {
740       file "my_security_file";
741       severity info;
742   };
743   category security {
744       my_security_channel;
745       default_syslog;
746       default_debug;
747   };
748
749To discard all messages in a category, specify the ``null`` channel:
750
751::
752
753   category xfer-out { null; };
754   category notify { null; };
755
756Following are the available categories and brief descriptions of the
757types of log information they contain. More categories may be added in
758future BIND releases.
759
760.. include:: logging-categories.rst
761
762.. _query_errors:
763
764The ``query-errors`` Category
765^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
766
767The ``query-errors`` category is used to indicate why and how specific queries
768resulted in responses which indicate an error.  Normally, these messages are
769logged at ``debug`` logging levels; note, however, that if query logging is
770active, some are logged at ``info``. The logging levels are described below:
771
772At ``debug`` levels of 1 or higher - or at ``info`` when query logging is
773active - each response with the rcode of SERVFAIL is logged as follows:
774
775``client 127.0.0.1#61502: query failed (SERVFAIL) for www.example.com/IN/AAAA at query.c:3880``
776
777This means an error resulting in SERVFAIL was detected at line 3880 of source
778file ``query.c``.  Log messages of this level are particularly helpful in identifying
779the cause of SERVFAIL for an authoritative server.
780
781At ``debug`` level 2 or higher, detailed context information about recursive
782resolutions that resulted in SERVFAIL is logged.  The log message looks
783like this:
784
785::
786
787   fetch completed at resolver.c:2970 for www.example.com/A
788   in 10.000183: timed out/success [domain:example.com,
789   referral:2,restart:7,qrysent:8,timeout:5,lame:0,quota:0,neterr:0,
790   badresp:1,adberr:0,findfail:0,valfail:0]
791
792The first part before the colon shows that a recursive resolution for
793AAAA records of www.example.com completed in 10.000183 seconds, and the
794final result that led to the SERVFAIL was determined at line 2970 of
795source file ``resolver.c``.
796
797The next part shows the detected final result and the latest result of
798DNSSEC validation.  The latter is always "success" when no validation attempt
799was made.  In this example, this query probably resulted in SERVFAIL because all
800name servers are down or unreachable, leading to a timeout in 10 seconds.
801DNSSEC validation was probably not attempted.
802
803The last part, enclosed in square brackets, shows statistics collected for this
804particular resolution attempt.  The ``domain`` field shows the deepest zone that
805the resolver reached; it is the zone where the error was finally detected.  The
806meaning of the other fields is summarized in the following list.
807
808``referral``
809    The number of referrals the resolver received throughout the resolution process. In the above ``example.com`` there are two.
810
811``restart``
812    The number of cycles that the resolver tried remote servers at the ``domain`` zone. In each cycle the resolver sends one query (possibly resending it, depending on the response) to each known name server of the ``domain`` zone.
813
814``qrysent``
815    The number of queries the resolver sent at the ``domain`` zone.
816
817``timeout``
818    The number of timeouts the resolver received since the last response.
819
820``lame``
821    The number of lame servers the resolver detected at the ``domain`` zone. A server is detected to be lame either by an invalid response or as a result of lookup in BIND 9's address database (ADB), where lame servers are cached.
822
823``quota``
824    The number of times the resolver was unable to send a query because it had exceeded the permissible fetch quota for a server.
825
826``neterr``
827    The number of erroneous results that the resolver encountered in sending queries at the ``domain`` zone. One common case is the remote server is unreachable and the resolver receives an ICMP unreachable error message.
828
829``badresp``
830    The number of unexpected responses (other than ``lame``) to queries sent by the resolver at the ``domain`` zone.
831
832``adberr``
833    Failures in finding remote server addresses of the``domain`` zone in the ADB. One common case of this is that the remote server's name does not have any address records.
834
835``findfail``
836    Failures of resolving remote server addresses. This is a total number of failures throughout the eesolution process.
837
838``valfail``
839    Failures of DNSSEC validation. Validation failures are counted throughout the resolution process (not limited to the ``domain`` zone), but should only happen in ``domain``.
840
841At ``debug`` level 3 or higher, the same messages as those at
842``debug`` level 1 are logged for errors other than
843SERVFAIL. Note that negative responses such as NXDOMAIN are not errors, and are
844not logged at this debug level.
845
846At ``debug`` level 4 or higher, the detailed context information logged at
847``debug`` level 2 is logged for errors other than SERVFAIL and for negative
848responses such as NXDOMAIN.
849
850.. _masters_grammar:
851
852``masters`` Statement Grammar
853~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
854
855.. include:: ../misc/masters.grammar.rst
856
857.. _masters_statement:
858
859``masters`` Statement Definition and Usage
860~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
861
862``masters`` lists allow for a common set of masters to be easily used by
863multiple stub and secondary zones in their ``masters`` or ``also-notify``
864lists.
865
866.. _options_grammar:
867
868``options`` Statement Grammar
869~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
870
871This is the grammar of the ``options`` statement in the ``named.conf``
872file:
873
874.. include:: ../misc/options.grammar.rst
875
876.. _options:
877
878``options`` Statement Definition and Usage
879~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
880
881The ``options`` statement sets up global options to be used by BIND.
882This statement may appear only once in a configuration file. If there is
883no ``options`` statement, an options block with each option set to its
884default is used.
885
886``attach-cache``
887   This option allows multiple views to share a single cache database. Each view has
888   its own cache database by default, but if multiple views have the
889   same operational policy for name resolution and caching, those views
890   can share a single cache to save memory, and possibly improve
891   resolution efficiency, by using this option.
892
893   The ``attach-cache`` option may also be specified in ``view``
894   statements, in which case it overrides the global ``attach-cache``
895   option.
896
897   The cache_name specifies the cache to be shared. When the ``named``
898   server configures views which are supposed to share a cache, it
899   creates a cache with the specified name for the first view of these
900   sharing views. The rest of the views simply refer to the
901   already-created cache.
902
903   One common configuration to share a cache would be to allow all views
904   to share a single cache. This can be done by specifying the
905   ``attach-cache`` as a global option with an arbitrary name.
906
907   Another possible operation is to allow a subset of all views to share
908   a cache while the others to retain their own caches. For example, if
909   there are three views A, B, and C, and only A and B should share a
910   cache, specify the ``attach-cache`` option as a view of A (or B)'s
911   option, referring to the other view name:
912
913   ::
914
915        view "A" {
916          // this view has its own cache
917          ...
918        };
919        view "B" {
920          // this view refers to A's cache
921          attach-cache "A";
922        };
923        view "C" {
924          // this view has its own cache
925          ...
926        };
927
928   Views that share a cache must have the same policy on configurable
929   parameters that may affect caching. The current implementation
930   requires the following configurable options be consistent among these
931   views: ``check-names``, ``dnssec-accept-expired``,
932   ``dnssec-validation``, ``max-cache-ttl``, ``max-ncache-ttl``,
933   ``max-stale-ttl``, ``max-cache-size``, ``min-cache-ttl``,
934   ``min-ncache-ttl``, and ``zero-no-soa-ttl``.
935
936   Note that there may be other parameters that may cause confusion if
937   they are inconsistent for different views that share a single cache.
938   For example, if these views define different sets of forwarders that
939   can return different answers for the same question, sharing the
940   answer does not make sense or could even be harmful. It is the
941   administrator's responsibility to ensure configuration differences in
942   different views do not cause disruption with a shared cache.
943
944``directory``
945   This sets the working directory of the server. Any non-absolute pathnames in
946   the configuration file are taken as relative to this directory.
947   The default location for most server output files (e.g.,
948   ``named.run``) is this directory. If a directory is not specified,
949   the working directory defaults to ``"."``, the directory from
950   which the server was started. The directory specified should be an
951   absolute path, and *must* be writable by the effective user ID of the
952   ``named`` process.
953
954``dnstap``
955   ``dnstap`` is a fast, flexible method for capturing and logging DNS
956   traffic. Developed by Robert Edmonds at Farsight Security, Inc., and
957   supported by multiple DNS implementations, ``dnstap`` uses
958   ``libfstrm`` (a lightweight high-speed framing library; see
959   https://github.com/farsightsec/fstrm) to send event payloads which
960   are encoded using Protocol Buffers (``libprotobuf-c``, a mechanism
961   for serializing structured data developed by Google, Inc.; see
962   https://developers.google.com/protocol-buffers/).
963
964   To enable ``dnstap`` at compile time, the ``fstrm`` and
965   ``protobuf-c`` libraries must be available, and BIND must be
966   configured with ``--enable-dnstap``.
967
968   The ``dnstap`` option is a bracketed list of message types to be
969   logged. These may be set differently for each view. Supported types
970   are ``client``, ``auth``, ``resolver``, ``forwarder``, and
971   ``update``. Specifying type ``all`` causes all ``dnstap``
972   messages to be logged, regardless of type.
973
974   Each type may take an additional argument to indicate whether to log
975   ``query`` messages or ``response`` messages; if not specified, both
976   queries and responses are logged.
977
978   Example: To log all authoritative queries and responses, recursive
979   client responses, and upstream queries sent by the resolver, use:
980
981   ::
982
983      dnstap {
984        auth;
985        client response;
986        resolver query;
987      };
988
989   Logged ``dnstap`` messages can be parsed using the ``dnstap-read``
990   utility (see :ref:`man_dnstap-read` for details).
991
992   For more information on ``dnstap``, see http://dnstap.info.
993
994   The fstrm library has a number of tunables that are exposed in
995   ``named.conf``, and can be modified if necessary to improve
996   performance or prevent loss of data. These are:
997
998   -  ``fstrm-set-buffer-hint``: The threshold number of bytes to
999      accumulate in the output buffer before forcing a buffer flush. The
1000      minimum is 1024, the maximum is 65536, and the default is 8192.
1001
1002   -  ``fstrm-set-flush-timeout``: The number of seconds to allow
1003      unflushed data to remain in the output buffer. The minimum is 1
1004      second, the maximum is 600 seconds (10 minutes), and the default
1005      is 1 second.
1006
1007   -  ``fstrm-set-output-notify-threshold``: The number of outstanding
1008      queue entries to allow on an input queue before waking the I/O
1009      thread. The minimum is 1 and the default is 32.
1010
1011   -  ``fstrm-set-output-queue-model``: The queuing semantics
1012      to use for queue objects. The default is ``mpsc`` (multiple
1013      producer, single consumer); the other option is ``spsc`` (single
1014      producer, single consumer).
1015
1016   -  ``fstrm-set-input-queue-size``: The number of queue entries to
1017      allocate for each input queue. This value must be a power of 2.
1018      The minimum is 2, the maximum is 16384, and the default is 512.
1019
1020   -  ``fstrm-set-output-queue-size``: The number of queue entries to
1021      allocate for each output queue. The minimum is 2, the maximum is
1022      system-dependent and based on ``IOV_MAX``, and the default is 64.
1023
1024   -  ``fstrm-set-reopen-interval``: The number of seconds to wait
1025      between attempts to reopen a closed output stream. The minimum is
1026      1 second, the maximum is 600 seconds (10 minutes), and the default
1027      is 5 seconds. For convenience, TTL-style time unit suffixes may be
1028      used to specify the value.
1029
1030   Note that all of the above minimum, maximum, and default values are
1031   set by the ``libfstrm`` library, and may be subject to change in
1032   future versions of the library. See the ``libfstrm`` documentation
1033   for more information.
1034
1035``dnstap-output``
1036   This configures the path to which the ``dnstap`` frame stream is sent
1037   if ``dnstap`` is enabled at compile time and active.
1038
1039   The first argument is either ``file`` or ``unix``, indicating whether
1040   the destination is a file or a Unix domain socket. The second
1041   argument is the path of the file or socket. (Note: when using a
1042   socket, ``dnstap`` messages are only sent if another process such
1043   as ``fstrm_capture`` (provided with ``libfstrm``) is listening on the
1044   socket.)
1045
1046   If the first argument is ``file``, then up to three additional
1047   options can be added: ``size`` indicates the size to which a
1048   ``dnstap`` log file can grow before being rolled to a new file;
1049   ``versions`` specifies the number of rolled log files to retain; and
1050   ``suffix`` indicates whether to retain rolled log files with an
1051   incrementing counter as the suffix (``increment``) or with the
1052   current timestamp (``timestamp``). These are similar to the ``size``,
1053   ``versions``, and ``suffix`` options in a ``logging`` channel. The
1054   default is to allow ``dnstap`` log files to grow to any size without
1055   rolling.
1056
1057   ``dnstap-output`` can only be set globally in ``options``. Currently,
1058   it can only be set once while ``named`` is running; once set, it
1059   cannot be changed by ``rndc reload`` or ``rndc reconfig``.
1060
1061``dnstap-identity``
1062   This specifies an ``identity`` string to send in ``dnstap`` messages. If
1063   set to ``hostname``, which is the default, the server's hostname
1064   is sent. If set to ``none``, no identity string is sent.
1065
1066``dnstap-version``
1067   This specifies a ``version`` string to send in ``dnstap`` messages. The
1068   default is the version number of the BIND release. If set to
1069   ``none``, no version string is sent.
1070
1071``geoip-directory``
1072   When ``named`` is compiled using the MaxMind GeoIP2 geolocation API, this
1073   specifies the directory containing GeoIP database files.  By default, the
1074   option is set based on the prefix used to build the ``libmaxminddb`` module;
1075   for example, if the library is installed in ``/usr/local/lib``, then the
1076   default ``geoip-directory`` is ``/usr/local/share/GeoIP``. On Windows,
1077   the default is the ``named`` working directory.  See :ref:`acl`
1078   for details about ``geoip`` ACLs.
1079
1080``key-directory``
1081   This is the directory where the public and private DNSSEC key files should be
1082   found when performing a dynamic update of secure zones, if different
1083   than the current working directory. (Note that this option has no
1084   effect on the paths for files containing non-DNSSEC keys such as
1085   ``bind.keys``, ``rndc.key``, or ``session.key``.)
1086
1087``lmdb-mapsize``
1088   When ``named`` is built with liblmdb, this option sets a maximum size
1089   for the memory map of the new-zone database (NZD) in LMDB database
1090   format. This database is used to store configuration information for
1091   zones added using ``rndc addzone``. Note that this is not the NZD
1092   database file size, but the largest size that the database may grow
1093   to.
1094
1095   Because the database file is memory-mapped, its size is limited by
1096   the address space of the ``named`` process. The default of 32 megabytes
1097   was chosen to be usable with 32-bit ``named`` builds. The largest
1098   permitted value is 1 terabyte. Given typical zone configurations
1099   without elaborate ACLs, a 32 MB NZD file ought to be able to hold
1100   configurations of about 100,000 zones.
1101
1102``managed-keys-directory``
1103   This specifies the directory in which to store the files that track managed DNSSEC
1104   keys (i.e., those configured using the ``initial-key`` or ``initial-ds``
1105   keywords in a ``trust-anchors`` statement). By default, this is the working
1106   directory. The directory *must* be writable by the effective user ID of the
1107   ``named`` process.
1108
1109   If ``named`` is not configured to use views, managed keys for
1110   the server are tracked in a single file called
1111   ``managed-keys.bind``. Otherwise, managed keys are tracked in
1112   separate files, one file per view; each file name is the view
1113   name (or, if it contains characters that are incompatible with use as
1114   a file name, the SHA256 hash of the view name), followed by the
1115   extension ``.mkeys``.
1116
1117   (Note: in earlier releases, file names for views always used the
1118   SHA256 hash of the view name. To ensure compatibility after upgrading,
1119   if a file using the old name format is found to exist, it is
1120   used instead of the new format.)
1121
1122``max-ixfr-ratio``
1123   This sets the size threshold (expressed as a percentage of the size of the full
1124   zone) beyond which ``named`` chooses to use an AXFR response rather than
1125   IXFR when answering zone transfer requests.  See
1126   :ref:`incremental_zone_transfers`.
1127
1128``new-zones-directory``
1129   This specifies the directory in which to store the configuration
1130   parameters for zones added via ``rndc addzone``. By default, this is
1131   the working directory. If set to a relative path, it is relative
1132   to the working directory. The directory *must* be writable by the
1133   effective user ID of the ``named`` process.
1134
1135``qname-minimization``
1136   This option controls QNAME minimization behavior in the BIND
1137   resolver. When set to ``strict``, BIND follows the QNAME
1138   minimization algorithm to the letter, as specified in :rfc:`7816`.
1139   Setting this option to ``relaxed`` causes BIND to fall back to
1140   normal (non-minimized) query mode when it receives either NXDOMAIN or
1141   other unexpected responses (e.g., SERVFAIL, improper zone cut,
1142   REFUSED) to a minimized query. ``disabled`` disables QNAME
1143   minimization completely. The current default is ``relaxed``, but it
1144   may be changed to ``strict`` in a future release.
1145
1146``tkey-gssapi-keytab``
1147   This is the KRB5 keytab file to use for GSS-TSIG updates. If this option is
1148   set and tkey-gssapi-credential is not set, updates are
1149   allowed with any key matching a principal in the specified keytab.
1150
1151``tkey-gssapi-credential``
1152   This is the security credential with which the server should authenticate
1153   keys requested by the GSS-TSIG protocol. Currently only Kerberos 5
1154   authentication is available; the credential is a Kerberos
1155   principal which the server can acquire through the default system key
1156   file, normally ``/etc/krb5.keytab``. The location keytab file can be
1157   overridden using the tkey-gssapi-keytab option. Normally this
1158   principal is of the form ``DNS/server.domain``. To use
1159   GSS-TSIG, ``tkey-domain`` must also be set if a specific keytab is
1160   not set with tkey-gssapi-keytab.
1161
1162``tkey-domain``
1163   This domain is appended to the names of all shared keys generated with
1164   ``TKEY``. When a client requests a ``TKEY`` exchange, it may or may
1165   not specify the desired name for the key. If present, the name of the
1166   shared key is ``client specified part`` + ``tkey-domain``.
1167   Otherwise, the name of the shared key is ``random hex digits``
1168   + ``tkey-domain``. In most cases, the ``domainname``
1169   should be the server's domain name, or an otherwise nonexistent
1170   subdomain like ``_tkey.domainname``. If using GSS-TSIG,
1171   this variable must be defined, unless a specific keytab
1172   is specified using ``tkey-gssapi-keytab``.
1173
1174``tkey-dhkey``
1175   This is the Diffie-Hellman key used by the server to generate shared keys
1176   with clients using the Diffie-Hellman mode of ``TKEY``. The server
1177   must be able to load the public and private keys from files in the
1178   working directory. In most cases, the ``key_name`` should be the
1179   server's host name.
1180
1181``cache-file``
1182   This is for testing only. Do not use.
1183
1184``dump-file``
1185   This is the pathname of the file the server dumps the database to, when
1186   instructed to do so with ``rndc dumpdb``. If not specified, the
1187   default is ``named_dump.db``.
1188
1189``memstatistics-file``
1190   This is the pathname of the file the server writes memory usage statistics to
1191   on exit. If not specified, the default is ``named.memstats``.
1192
1193``lock-file``
1194   This is the pathname of a file on which ``named`` attempts to acquire a
1195   file lock when starting up for the first time; if unsuccessful, the
1196   server terminates, under the assumption that another server
1197   is already running. If not specified, the default is
1198   ``none``.
1199
1200   Specifying ``lock-file none`` disables the use of a lock file.
1201   ``lock-file`` is ignored if ``named`` was run using the ``-X``
1202   option, which overrides it. Changes to ``lock-file`` are ignored if
1203   ``named`` is being reloaded or reconfigured; it is only effective
1204   when the server is first started.
1205
1206``pid-file``
1207   This is the pathname of the file the server writes its process ID in. If not
1208   specified, the default is ``/var/run/named/named.pid``. The PID file
1209   is used by programs that send signals to the running name
1210   server. Specifying ``pid-file none`` disables the use of a PID file;
1211   no file is written and any existing one is removed. Note
1212   that ``none`` is a keyword, not a filename, and therefore is not
1213   enclosed in double quotes.
1214
1215``recursing-file``
1216   This is the pathname of the file the server dumps the queries that are
1217   currently recursing, when instructed to do so with ``rndc recursing``.
1218   If not specified, the default is ``named.recursing``.
1219
1220``statistics-file``
1221   This is the pathname of the file the server appends statistics to, when
1222   instructed to do so using ``rndc stats``. If not specified, the
1223   default is ``named.stats`` in the server's current directory. The
1224   format of the file is described in :ref:`statsfile`.
1225
1226``bindkeys-file``
1227   This is the pathname of a file to override the built-in trusted keys provided
1228   by ``named``. See the discussion of ``dnssec-validation`` for
1229   details. If not specified, the default is ``/etc/bind.keys``.
1230
1231``secroots-file``
1232   This is the pathname of the file the server dumps security roots to, when
1233   instructed to do so with ``rndc secroots``. If not specified, the
1234   default is ``named.secroots``.
1235
1236``session-keyfile``
1237   This is the pathname of the file into which to write a TSIG session key
1238   generated by ``named`` for use by ``nsupdate -l``. If not specified,
1239   the default is ``/var/run/named/session.key``. (See :ref:`dynamic_update_policies`,
1240   and in particular the discussion of the ``update-policy`` statement's
1241   ``local`` option, for more information about this feature.)
1242
1243``session-keyname``
1244   This is the key name to use for the TSIG session key. If not specified, the
1245   default is ``local-ddns``.
1246
1247``session-keyalg``
1248   This is the algorithm to use for the TSIG session key. Valid values are
1249   hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, hmac-sha512, and
1250   hmac-md5. If not specified, the default is hmac-sha256.
1251
1252``port``
1253   This is the UDP/TCP port number the server uses for receiving and sending DNS
1254   protocol traffic. The default is 53. This option is mainly intended
1255   for server testing; a server using a port other than 53 is not
1256   able to communicate with the global DNS.
1257
1258``dscp``
1259   This is the global Differentiated Services Code Point (DSCP) value to
1260   classify outgoing DNS traffic, on operating systems that support DSCP.
1261   Valid values are 0 through 63. It is not configured by default.
1262
1263``random-device``
1264   This specifies a source of entropy to be used by the server; it is a
1265   device or file from which to read entropy. If it is a file,
1266   operations requiring entropy will fail when the file has been
1267   exhausted.
1268
1269   Entropy is needed for cryptographic operations such as TKEY
1270   transactions, dynamic update of signed zones, and generation of TSIG
1271   session keys. It is also used for seeding and stirring the
1272   pseudo-random number generator which is used for less critical
1273   functions requiring randomness, such as generation of DNS message
1274   transaction IDs.
1275
1276   If ``random-device`` is not specified, or if it is set to ``none``,
1277   entropy is read from the random number generation function
1278   supplied by the cryptographic library with which BIND was linked
1279   (i.e. OpenSSL or a PKCS#11 provider).
1280
1281   The ``random-device`` option takes effect during the initial
1282   configuration load at server startup time and is ignored on
1283   subsequent reloads.
1284
1285``preferred-glue``
1286   If specified, the listed type (A or AAAA) is emitted before
1287   other glue in the additional section of a query response. The default
1288   is to prefer A records when responding to queries that arrived via
1289   IPv4 and AAAA when responding to queries that arrived via IPv6.
1290
1291.. _root-delegation-only:
1292
1293``root-delegation-only``
1294   This turns on enforcement of delegation-only in TLDs (top-level domains)
1295   and root zones with an optional exclude list.
1296
1297   DS queries are expected to be made to and be answered by delegation
1298   only zones. Such queries and responses are treated as an exception to
1299   delegation-only processing and are not converted to NXDOMAIN
1300   responses, provided a CNAME is not discovered at the query name.
1301
1302   If a delegation-only zone server also serves a child zone, it is not
1303   always possible to determine whether an answer comes from the
1304   delegation-only zone or the child zone. SOA NS and DNSKEY records are
1305   apex-only records and a matching response that contains these records
1306   or DS is treated as coming from a child zone. RRSIG records are also
1307   examined to see whether they are signed by a child zone, and the
1308   authority section is examined to see if there is evidence that
1309   the answer is from the child zone. Answers that are determined to be
1310   from a child zone are not converted to NXDOMAIN responses. Despite
1311   all these checks there is still a possibility of false negatives when
1312   a child zone is being served.
1313
1314   Similarly, false positives can arise from empty nodes (no records at
1315   the name) in the delegation-only zone when the query type is not ``ANY``.
1316
1317   Note that some TLDs are not delegation-only; e.g., "DE", "LV", "US" and
1318   "MUSEUM". This list is not exhaustive.
1319
1320   ::
1321
1322      options {
1323          root-delegation-only exclude { "de"; "lv"; "us"; "museum"; };
1324      };
1325
1326``disable-algorithms``
1327   This disables the specified DNSSEC algorithms at and below the specified
1328   name. Multiple ``disable-algorithms`` statements are allowed. Only
1329   the best match ``disable-algorithms`` clause is used to
1330   determine which algorithms are used.
1331
1332   If all supported algorithms are disabled, the zones covered by the
1333   ``disable-algorithms`` setting are treated as insecure.
1334
1335   Configured trust anchors in ``trusted-anchors`` (or ``managed-keys`` or
1336   ``trusted-keys``) that match a disabled algorithm are ignored and treated
1337   as if they were not configured at all.
1338
1339``disable-ds-digests``
1340   This disables the specified DS digest types at and below the specified
1341   name. Multiple ``disable-ds-digests`` statements are allowed. Only
1342   the best match ``disable-ds-digests`` clause is used to
1343   determine the digest types.
1344
1345   If all supported digest types are disabled, the zones covered by the
1346   ``disable-ds-digests`` are treated as insecure.
1347
1348``dnssec-must-be-secure``
1349   This specifies hierarchies which must be or may not be secure (signed and
1350   validated). If ``yes``, then ``named`` only accepts answers if
1351   they are secure. If ``no``, then normal DNSSEC validation applies,
1352   allowing insecure answers to be accepted. The specified domain
1353   must be defined as a trust anchor, for instance in a ``trust-anchors``
1354   statement, or ``dnssec-validation auto`` must be active.
1355
1356``dns64``
1357   This directive instructs ``named`` to return mapped IPv4 addresses to
1358   AAAA queries when there are no AAAA records. It is intended to be
1359   used in conjunction with a NAT64. Each ``dns64`` defines one DNS64
1360   prefix. Multiple DNS64 prefixes can be defined.
1361
1362   Compatible IPv6 prefixes have lengths of 32, 40, 48, 56, 64, and 96, per
1363   :rfc:`6052`. Bits 64..71 inclusive must be zero with the most significant bit
1364   of the prefix in position 0.
1365
1366   In addition, a reverse IP6.ARPA zone is created for the prefix
1367   to provide a mapping from the IP6.ARPA names to the corresponding
1368   IN-ADDR.ARPA names using synthesized CNAMEs. ``dns64-server`` and
1369   ``dns64-contact`` can be used to specify the name of the server and
1370   contact for the zones. These can be set at the view/options
1371   level but not on a per-prefix basis.
1372
1373   Each ``dns64`` supports an optional ``clients`` ACL that determines
1374   which clients are affected by this directive. If not defined, it
1375   defaults to ``any;``.
1376
1377   Each ``dns64`` supports an optional ``mapped`` ACL that selects which
1378   IPv4 addresses are to be mapped in the corresponding A RRset. If not
1379   defined, it defaults to ``any;``.
1380
1381   Normally, DNS64 does not apply to a domain name that owns one or more
1382   AAAA records; these records are simply returned. The optional
1383   ``exclude`` ACL allows specification of a list of IPv6 addresses that
1384   are ignored if they appear in a domain name's AAAA records;
1385   DNS64 is applied to any A records the domain name owns. If not
1386   defined, ``exclude`` defaults to ::ffff:0.0.0.0/96.
1387
1388   An optional ``suffix`` can also be defined to set the bits trailing
1389   the mapped IPv4 address bits. By default these bits are set to
1390   ``::``. The bits matching the prefix and mapped IPv4 address must be
1391   zero.
1392
1393   If ``recursive-only`` is set to ``yes`` the DNS64 synthesis only
1394   happens for recursive queries. The default is ``no``.
1395
1396   If ``break-dnssec`` is set to ``yes`` the DNS64 synthesis happens
1397   even if the result, if validated, would cause a DNSSEC validation
1398   failure. If this option is set to ``no`` (the default), the DO is set
1399   on the incoming query, and there are RRSIGs on the applicable
1400   records, then synthesis does not happen.
1401
1402   ::
1403
1404          acl rfc1918 { 10/8; 192.168/16; 172.16/12; };
1405
1406          dns64 64:FF9B::/96 {
1407              clients { any; };
1408              mapped { !rfc1918; any; };
1409              exclude { 64:FF9B::/96; ::ffff:0000:0000/96; };
1410              suffix ::;
1411          };
1412
1413``dnssec-loadkeys-interval``
1414   When a zone is configured with ``auto-dnssec maintain;`` its key
1415   repository must be checked periodically to see if any new keys have
1416   been added or any existing keys' timing metadata has been updated
1417   (see :ref:`man_dnssec-keygen` and :ref:`man_dnssec-settime`).
1418   The ``dnssec-loadkeys-interval`` option
1419   sets the frequency of automatic repository checks, in minutes.  The
1420   default is ``60`` (1 hour), the minimum is ``1`` (1 minute), and
1421   the maximum is ``1440`` (24 hours); any higher value is silently
1422   reduced.
1423
1424``dnssec-policy``
1425   This specifies which key and signing policy (KASP) should be used for this zone.
1426   This is a string referring to a ``dnssec-policy`` statement.  There are two
1427   built-in policies: ``default``, which uses the default policy, and
1428   ``none``, which means no DNSSEC policy and keeps the zone unsigned.  The
1429   default is ``none``.  See :ref:`dnssec-policy Grammar
1430   <dnssec_policy_grammar>` for more details.
1431
1432``dnssec-update-mode``
1433   If this option is set to its default value of ``maintain`` in a zone
1434   of type ``master`` which is DNSSEC-signed and configured to allow
1435   dynamic updates (see :ref:`dynamic_update_policies`), and if ``named`` has access
1436   to the private signing key(s) for the zone, then ``named``
1437   automatically signs all new or changed records and maintains signatures
1438   for the zone by regenerating RRSIG records whenever they approach
1439   their expiration date.
1440
1441   If the option is changed to ``no-resign``, then ``named`` signs
1442   all new or changed records, but scheduled maintenance of signatures
1443   is disabled.
1444
1445   With either of these settings, ``named`` rejects updates to a
1446   DNSSEC-signed zone when the signing keys are inactive or unavailable
1447   to ``named``. (A planned third option, ``external``, will disable all
1448   automatic signing and allow DNSSEC data to be submitted into a zone
1449   via dynamic update; this is not yet implemented.)
1450
1451``nta-lifetime``
1452   This specifies the default lifetime, in seconds, for
1453   negative trust anchors added via ``rndc nta``.
1454
1455   A negative trust anchor selectively disables DNSSEC validation for
1456   zones that are known to be failing because of misconfiguration, rather
1457   than an attack. When data to be validated is at or below an active
1458   NTA (and above any other configured trust anchors), ``named``
1459   aborts the DNSSEC validation process and treats the data as insecure
1460   rather than bogus. This continues until the NTA's lifetime has
1461   elapsed. NTAs persist across ``named`` restarts.
1462
1463   For convenience, TTL-style time unit suffixes can be used to specify the NTA
1464   lifetime in seconds, minutes, or hours. It also accepts ISO 8601 duration
1465   formats.
1466
1467   ``nta-lifetime`` defaults to one hour; it cannot exceed one week.
1468
1469``nta-recheck``
1470   This specifies how often to check whether negative trust anchors added via
1471   ``rndc nta`` are still necessary.
1472
1473   A negative trust anchor is normally used when a domain has stopped
1474   validating due to operator error; it temporarily disables DNSSEC
1475   validation for that domain. In the interest of ensuring that DNSSEC
1476   validation is turned back on as soon as possible, ``named``
1477   periodically sends a query to the domain, ignoring negative trust
1478   anchors, to find out whether it can now be validated. If so, the
1479   negative trust anchor is allowed to expire early.
1480
1481   Validity checks can be disabled for an individual NTA by using
1482   ``rndc nta -f``, or for all NTAs by setting ``nta-recheck`` to zero.
1483
1484   For convenience, TTL-style time unit suffixes can be used to specify the NTA
1485   recheck interval in seconds, minutes, or hours. It also accepts ISO 8601
1486   duration formats.
1487
1488   The default is five minutes. It cannot be longer than ``nta-lifetime``, which
1489   cannot be longer than a week.
1490
1491``max-zone-ttl``
1492   This specifies a maximum permissible TTL value in seconds. For
1493   convenience, TTL-style time unit suffixes may be used to specify the
1494   maximum value. When loading a zone file using a ``masterfile-format``
1495   of ``text`` or ``raw``, any record encountered with a TTL higher than
1496   ``max-zone-ttl`` causes the zone to be rejected.
1497
1498   This is useful in DNSSEC-signed zones because when rolling to a new
1499   DNSKEY, the old key needs to remain available until RRSIG records
1500   have expired from caches. The ``max-zone-ttl`` option guarantees that
1501   the largest TTL in the zone is no higher than the set value.
1502
1503   (NOTE: Because ``map``-format files load directly into memory, this
1504   option cannot be used with them.)
1505
1506   The default value is ``unlimited``. A ``max-zone-ttl`` of zero is
1507   treated as ``unlimited``.
1508
1509``stale-answer-ttl``
1510   This specifies the TTL to be returned on stale answers. The default is 1
1511   second. The minimum allowed is also 1 second; a value of 0 is
1512   updated silently to 1 second.
1513
1514   For stale answers to be returned, they must be enabled, either in the
1515   configuration file using ``stale-answer-enable`` or via
1516   ``rndc serve-stale on``.
1517
1518``serial-update-method``
1519   Zones configured for dynamic DNS may use this option to set the
1520   update method to be used for the zone serial number in the SOA
1521   record.
1522
1523   With the default setting of ``serial-update-method increment;``, the
1524   SOA serial number is incremented by one each time the zone is
1525   updated.
1526
1527   When set to ``serial-update-method unixtime;``, the SOA serial number
1528   is set to the number of seconds since the Unix epoch, unless the
1529   serial number is already greater than or equal to that value, in
1530   which case it is simply incremented by one.
1531
1532   When set to ``serial-update-method date;``, the new SOA serial number
1533   is the current date in the form "YYYYMMDD", followed by two
1534   zeroes, unless the existing serial number is already greater than or
1535   equal to that value, in which case it is incremented by one.
1536
1537``zone-statistics``
1538   If ``full``, the server collects statistical data on all zones,
1539   unless specifically turned off on a per-zone basis by specifying
1540   ``zone-statistics terse`` or ``zone-statistics none`` in the ``zone``
1541   statement. The default is ``terse``, providing minimal statistics on
1542   zones (including name and current serial number, but not query type
1543   counters).
1544
1545   These statistics may be accessed via the ``statistics-channel`` or
1546   using ``rndc stats``, which dumps them to the file listed in the
1547   ``statistics-file``. See also :ref:`statsfile`.
1548
1549   For backward compatibility with earlier versions of BIND 9, the
1550   ``zone-statistics`` option can also accept ``yes`` or ``no``; ``yes``
1551   has the same meaning as ``full``. As of BIND 9.10, ``no`` has the
1552   same meaning as ``none``; previously, it was the same as ``terse``.
1553
1554.. _boolean_options:
1555
1556Boolean Options
1557^^^^^^^^^^^^^^^
1558
1559``automatic-interface-scan``
1560   If ``yes`` and supported by the operating system, this automatically rescans
1561   network interfaces when the interface addresses are added or removed.  The
1562   default is ``yes``.  This configuration option does not affect the time-based
1563   ``interface-interval`` option; it is recommended to set the time-based
1564   ``interface-interval`` to 0 when the operator confirms that automatic
1565   interface scanning is supported by the operating system.
1566
1567   The ``automatic-interface-scan`` implementation uses routing sockets for the
1568   network interface discovery; therefore, the operating system has to
1569   support the routing sockets for this feature to work.
1570
1571``allow-new-zones``
1572   If ``yes``, then zones can be added at runtime via ``rndc addzone``.
1573   The default is ``no``.
1574
1575   Newly added zones' configuration parameters are stored so that they
1576   can persist after the server is restarted. The configuration
1577   information is saved in a file called ``viewname.nzf`` (or, if
1578   ``named`` is compiled with liblmdb, in an LMDB database file called
1579   ``viewname.nzd``). "viewname" is the name of the view, unless the view
1580   name contains characters that are incompatible with use as a file
1581   name, in which case a cryptographic hash of the view name is used
1582   instead.
1583
1584   Configurations for zones added at runtime are stored either in
1585   a new-zone file (NZF) or a new-zone database (NZD), depending on
1586   whether ``named`` was linked with liblmdb at compile time. See
1587   :ref:`man_rndc` for further details about ``rndc addzone``.
1588
1589``auth-nxdomain``
1590   If ``yes``, then the ``AA`` bit is always set on NXDOMAIN responses,
1591   even if the server is not actually authoritative. The default is
1592   ``no``. If using very old DNS software, this may need to be set
1593   to ``yes``.
1594
1595``deallocate-on-exit``
1596   This option was used in BIND 8 to enable checking for memory leaks on
1597   exit. BIND 9 ignores the option and always performs the checks.
1598
1599``memstatistics``
1600   This writes memory statistics to the file specified by
1601   ``memstatistics-file`` at exit. The default is ``no`` unless '-m
1602   record' is specified on the command line, in which case it is ``yes``.
1603
1604``dialup``
1605   If ``yes``, then the server treats all zones as if they are doing
1606   zone transfers across a dial-on-demand dialup link, which can be
1607   brought up by traffic originating from this server. Although this setting has
1608   different effects according to zone type, it concentrates the zone
1609   maintenance so that everything happens quickly, once every
1610   ``heartbeat-interval``, ideally during a single call. It also
1611   suppresses some normal zone maintenance traffic. The default
1612   is ``no``.
1613
1614   If specified in the ``view`` and
1615   ``zone`` statements, the ``dialup`` option overrides the global ``dialup``
1616   option.
1617
1618   If the zone is a primary zone, the server sends out a NOTIFY
1619   request to all the secondaries (default). This should trigger the zone
1620   serial number check in the secondary (providing it supports NOTIFY),
1621   allowing the secondary to verify the zone while the connection is active.
1622   The set of servers to which NOTIFY is sent can be controlled by
1623   ``notify`` and ``also-notify``.
1624
1625   If the zone is a secondary or stub zone, the server suppresses
1626   the regular "zone up to date" (refresh) queries and only performs them
1627   when the ``heartbeat-interval`` expires, in addition to sending NOTIFY
1628   requests.
1629
1630   Finer control can be achieved by using ``notify``, which only sends
1631   NOTIFY messages; ``notify-passive``, which sends NOTIFY messages and
1632   suppresses the normal refresh queries; ``refresh``, which suppresses
1633   normal refresh processing and sends refresh queries when the
1634   ``heartbeat-interval`` expires; and ``passive``, which just disables
1635   normal refresh processing.
1636
1637   +--------------------+-----------------+-----------------+-----------------+
1638   | dialup mode        | normal refresh  | heart-beat      | heart-beat      |
1639   |                    |                 | refresh         | notify          |
1640   +--------------------+-----------------+-----------------+-----------------+
1641   | ``no``             | yes             | no              | no              |
1642   | (default)          |                 |                 |                 |
1643   +--------------------+-----------------+-----------------+-----------------+
1644   | ``yes``            | no              | yes             | yes             |
1645   +--------------------+-----------------+-----------------+-----------------+
1646   | ``notify``         | yes             | no              | yes             |
1647   +--------------------+-----------------+-----------------+-----------------+
1648   | ``refresh``        | no              | yes             | no              |
1649   +--------------------+-----------------+-----------------+-----------------+
1650   | ``passive``        | no              | no              | no              |
1651   +--------------------+-----------------+-----------------+-----------------+
1652   | ``notify-passive`` | no              | no              | yes             |
1653   +--------------------+-----------------+-----------------+-----------------+
1654
1655   Note that normal NOTIFY processing is not affected by ``dialup``.
1656
1657``flush-zones-on-shutdown``
1658   When the name server exits upon receiving SIGTERM, flush or do not
1659   flush any pending zone writes. The default is
1660   ``flush-zones-on-shutdown`` ``no``.
1661
1662``geoip-use-ecs``
1663   This option was part of an experimental implementation of the EDNS
1664   CLIENT-SUBNET for authoritative servers, but is now obsolete.
1665
1666``root-key-sentinel``
1667   If ``yes``, respond to root key sentinel probes as described in
1668   draft-ietf-dnsop-kskroll-sentinel-08. The default is ``yes``.
1669
1670``message-compression``
1671   If ``yes``, DNS name compression is used in responses to regular
1672   queries (not including AXFR or IXFR, which always use compression).
1673   Setting this option to ``no`` reduces CPU usage on servers and may
1674   improve throughput. However, it increases response size, which may
1675   cause more queries to be processed using TCP; a server with
1676   compression disabled is out of compliance with :rfc:`1123` Section
1677   6.1.3.2. The default is ``yes``.
1678
1679``minimal-responses``
1680   This option controls the addition of records to the authority and
1681   additional sections of responses. Such records may be included in
1682   responses to be helpful to clients; for example, NS or MX records may
1683   have associated address records included in the additional section,
1684   obviating the need for a separate address lookup. However, adding
1685   these records to responses is not mandatory and requires additional
1686   database lookups, causing extra latency when marshalling responses.
1687   ``minimal-responses`` takes one of four values:
1688
1689   -  ``no``: the server is as complete as possible when generating
1690      responses.
1691   -  ``yes``: the server only adds records to the authority and additional
1692      sections when such records are required by the DNS protocol (for
1693      example, when returning delegations or negative responses). This
1694      provides the best server performance but may result in more client
1695      queries.
1696   -  ``no-auth``: the server omits records from the authority section except
1697      when they are required, but it may still add records to the
1698      additional section.
1699   -  ``no-auth-recursive``: the same as ``no-auth`` when recursion is requested
1700      in the query (RD=1), or the same as ``no`` if recursion is not requested.
1701
1702   ``no-auth`` and ``no-auth-recursive`` are useful when answering stub
1703   clients, which usually ignore the authority section.
1704   ``no-auth-recursive`` is meant for use in mixed-mode servers that
1705   handle both authoritative and recursive queries.
1706
1707   The default is ``no-auth-recursive``.
1708
1709``glue-cache``
1710   When set to ``yes``, a cache is used to improve query performance
1711   when adding address-type (A and AAAA) glue records to the additional
1712   section of DNS response messages that delegate to a child zone.
1713
1714   The glue cache uses memory proportional to the number of delegations
1715   in the zone. The default setting is ``yes``, which improves
1716   performance at the cost of increased memory usage for the zone. To avoid
1717   this, set it to ``no``.
1718
1719``minimal-any``
1720   If set to ``yes``, the server replies with only one of
1721   the RRsets for the query name when generating a positive response to a
1722   query of type ANY over UDP, and its covering RRSIGs if any,
1723   instead of replying with all known RRsets for the name. Similarly, a
1724   query for type RRSIG is answered with the RRSIG records covering
1725   only one type. This can reduce the impact of some kinds of attack
1726   traffic, without harming legitimate clients. (Note, however, that the
1727   RRset returned is the first one found in the database; it is not
1728   necessarily the smallest available RRset.) Additionally,
1729   ``minimal-responses`` is turned on for these queries, so no
1730   unnecessary records are added to the authority or additional
1731   sections. The default is ``no``.
1732
1733``notify``
1734   If ``yes`` (the default), DNS NOTIFY messages are sent when a zone
1735   the server is authoritative for changes; see :ref:`notify`.
1736   The messages are sent to the servers listed in the zone's NS records
1737   (except the primary server identified in the SOA MNAME field), and to
1738   any servers listed in the ``also-notify`` option.
1739
1740   If ``master-only``, notifies are only sent for primary zones. If
1741   ``explicit``, notifies are sent only to servers explicitly listed
1742   using ``also-notify``. If ``no``, no notifies are sent.
1743
1744   The ``notify`` option may also be specified in the ``zone``
1745   statement, in which case it overrides the ``options notify``
1746   statement. It would only be necessary to turn off this option if it
1747   caused secondary zones to crash.
1748
1749``notify-to-soa``
1750   If ``yes``, do not check the name servers in the NS RRset against the
1751   SOA MNAME. Normally a NOTIFY message is not sent to the SOA MNAME
1752   (SOA ORIGIN), as it is supposed to contain the name of the ultimate
1753   primary server. Sometimes, however, a secondary server is listed as the SOA MNAME in
1754   hidden primary configurations; in that case, the
1755   ultimate primary should be set to still send NOTIFY messages to all the name servers
1756   listed in the NS RRset.
1757
1758``recursion``
1759   If ``yes``, and a DNS query requests recursion, then the server
1760   attempts to do all the work required to answer the query. If recursion
1761   is off and the server does not already know the answer, it
1762   returns a referral response. The default is ``yes``. Note that setting
1763   ``recursion no`` does not prevent clients from getting data from the
1764   server's cache; it only prevents new data from being cached as an
1765   effect of client queries. Caching may still occur as an effect of the
1766   server's internal operation, such as NOTIFY address lookups.
1767
1768``request-nsid``
1769   If ``yes``, then an empty EDNS(0) NSID (Name Server Identifier)
1770   option is sent with all queries to authoritative name servers during
1771   iterative resolution. If the authoritative server returns an NSID
1772   option in its response, then its contents are logged in the ``nsid``
1773   category at level ``info``. The default is ``no``.
1774
1775``request-sit``
1776   This experimental option is obsolete.
1777
1778``require-server-cookie``
1779   If ``yes``, require a valid server cookie before sending a full response to a UDP
1780   request from a cookie-aware client. BADCOOKIE is sent if there is a
1781   bad or nonexistent server cookie.
1782
1783   The default is ``no``.
1784
1785   Users wishing to test that DNS COOKIE clients correctly handle
1786   BADCOOKIE, or who are getting a lot of forged DNS requests with DNS COOKIES
1787   present, should set this to ``yes``. Setting this to ``yes`` results in a reduced amplification effect
1788   in a reflection attack, as the BADCOOKIE response is smaller than a full
1789   response, while also requiring a legitimate client to follow up with a second
1790   query with the new, valid, cookie.
1791
1792``answer-cookie``
1793   When set to the default value of ``yes``, COOKIE EDNS options are
1794   sent when applicable in replies to client queries. If set to ``no``,
1795   COOKIE EDNS options are not sent in replies. This can only be set
1796   at the global options level, not per-view.
1797
1798   ``answer-cookie no`` is intended as a temporary measure, for use when
1799   ``named`` shares an IP address with other servers that do not yet
1800   support DNS COOKIE. A mismatch between servers on the same address is
1801   not expected to cause operational problems, but the option to disable
1802   COOKIE responses so that all servers have the same behavior is
1803   provided out of an abundance of caution. DNS COOKIE is an important
1804   security mechanism, and should not be disabled unless absolutely
1805   necessary.
1806
1807``send-cookie``
1808   If ``yes``, then a COOKIE EDNS option is sent along with the query.
1809   If the resolver has previously communicated with the server, the COOKIE
1810   returned in the previous transaction is sent. This is used by the
1811   server to determine whether the resolver has talked to it before. A
1812   resolver sending the correct COOKIE is assumed not to be an off-path
1813   attacker sending a spoofed-source query; the query is therefore
1814   unlikely to be part of a reflection/amplification attack, so
1815   resolvers sending a correct COOKIE option are not subject to response
1816   rate limiting (RRL). Resolvers which do not send a correct COOKIE
1817   option may be limited to receiving smaller responses via the
1818   ``nocookie-udp-size`` option.
1819
1820   The default is ``yes``.
1821
1822``stale-answer-enable``
1823   If ``yes``, enable the returning of "stale" cached answers when the name servers
1824   for a zone are not answering. The default is not to return stale
1825   answers.
1826
1827   Stale answers can also be enabled or disabled at runtime via
1828   ``rndc serve-stale on`` or ``rndc serve-stale off``; these override
1829   the configured setting. ``rndc serve-stale reset`` restores the
1830   setting to the one specified in ``named.conf``. Note that if stale
1831   answers have been disabled by ``rndc``, they cannot be
1832   re-enabled by reloading or reconfiguring ``named``; they must be
1833   re-enabled with ``rndc serve-stale on``, or the server must be
1834   restarted.
1835
1836   Information about stale answers is logged under the ``serve-stale``
1837   log category.
1838
1839``nocookie-udp-size``
1840   This sets the maximum size of UDP responses that are sent to queries
1841   without a valid server COOKIE. A value below 128 is silently
1842   raised to 128. The default value is 4096, but the ``max-udp-size``
1843   option may further limit the response size.
1844
1845``sit-secret``
1846   This experimental option is obsolete.
1847
1848``cookie-algorithm``
1849   This sets the algorithm to be used when generating the server cookie; the options are
1850   "aes", "sha1", or "sha256". The default is "aes" if supported by
1851   the cryptographic library; otherwise, "sha256".
1852
1853``cookie-secret``
1854   If set, this is a shared secret used for generating and verifying
1855   EDNS COOKIE options within an anycast cluster. If not set, the system
1856   generates a random secret at startup. The shared secret is
1857   encoded as a hex string and needs to be 128 bits for AES128, 160 bits
1858   for SHA1, and 256 bits for SHA256.
1859
1860   If there are multiple secrets specified, the first one listed in
1861   ``named.conf`` is used to generate new server cookies. The others
1862   are only used to verify returned cookies.
1863
1864``response-padding``
1865   The EDNS Padding option is intended to improve confidentiality when
1866   DNS queries are sent over an encrypted channel by reducing the
1867   variability in packet sizes. If a query:
1868
1869   1. contains an EDNS Padding option,
1870   2. includes a valid server cookie or uses TCP,
1871   3. is not signed using TSIG or SIG(0), and
1872   4. is from a client whose address matches the specified ACL,
1873
1874   then the response is padded with an EDNS Padding option to a multiple
1875   of ``block-size`` bytes. If these conditions are not met, the
1876   response is not padded.
1877
1878   If ``block-size`` is 0 or the ACL is ``none;``, this feature is
1879   disabled and no padding occurs; this is the default. If
1880   ``block-size`` is greater than 512, a warning is logged and the value
1881   is truncated to 512. Block sizes are ordinarily expected to be powers
1882   of two (for instance, 128), but this is not mandatory.
1883
1884``trust-anchor-telemetry``
1885   This causes ``named`` to send specially formed queries once per day to
1886   domains for which trust anchors have been configured via, e.g.,
1887   ``dnssec-keys`` or ``dnssec-validation auto``.
1888
1889   The query name used for these queries has the form
1890   "_ta-xxxx(-xxxx)(...)".<domain>, where each "xxxx" is a group of four
1891   hexadecimal digits representing the key ID of a trusted DNSSEC key.
1892   The key IDs for each domain are sorted smallest to largest prior to
1893   encoding. The query type is NULL.
1894
1895   By monitoring these queries, zone operators are able to see which
1896   resolvers have been updated to trust a new key; this may help them
1897   decide when it is safe to remove an old one.
1898
1899   The default is ``yes``.
1900
1901``use-ixfr``
1902   *This option is obsolete*. To disable IXFR to a
1903   particular server or servers, see the information on the
1904   ``provide-ixfr`` option in :ref:`server_statement_definition_and_usage`.
1905   See also :ref:`incremental_zone_transfers`.
1906
1907``provide-ixfr``
1908   See the description of ``provide-ixfr`` in :ref:`server_statement_definition_and_usage`.
1909
1910``request-ixfr``
1911   See the description of ``request-ixfr`` in :ref:`server_statement_definition_and_usage`.
1912
1913``request-expire``
1914   See the description of ``request-expire`` in :ref:`server_statement_definition_and_usage`.
1915
1916``match-mapped-addresses``
1917   If ``yes``, then an IPv4-mapped IPv6 address matches any address
1918   match list entries that match the corresponding IPv4 address.
1919
1920   This option was introduced to work around a kernel quirk in some
1921   operating systems that causes IPv4 TCP connections, such as zone
1922   transfers, to be accepted on an IPv6 socket using mapped addresses.
1923   This caused address match lists designed for IPv4 to fail to match.
1924   However, ``named`` now solves this problem internally. The use of
1925   this option is discouraged.
1926
1927``ixfr-from-differences``
1928   When ``yes`` and the server loads a new version of a primary zone from
1929   its zone file or receives a new version of a secondary file via zone
1930   transfer, it compares the new version to the previous one and
1931   calculates a set of differences. The differences are then logged in
1932   the zone's journal file so that the changes can be transmitted to
1933   downstream secondaries as an incremental zone transfer.
1934
1935   By allowing incremental zone transfers to be used for non-dynamic
1936   zones, this option saves bandwidth at the expense of increased CPU
1937   and memory consumption at the primary server. In particular, if the new
1938   version of a zone is completely different from the previous one, the
1939   set of differences is of a size comparable to the combined size
1940   of the old and new zone versions, and the server needs to
1941   temporarily allocate memory to hold this complete difference set.
1942
1943   ``ixfr-from-differences`` also accepts ``master`` (or ``primary``)
1944   and ``slave`` (or ``secondary``) at the view and options levels,
1945   which causes ``ixfr-from-differences`` to be enabled for all primary
1946   or secondary zones, respectively. It is off for all zones by default.
1947
1948   Note: if inline signing is enabled for a zone, the user-provided
1949   ``ixfr-from-differences`` setting is ignored for that zone.
1950
1951``multi-master``
1952   This should be set when there are multiple primary servers for a zone and the
1953   addresses refer to different machines. If ``yes``, ``named`` does not
1954   log when the serial number on the primary is less than what ``named``
1955   currently has. The default is ``no``.
1956
1957``auto-dnssec``
1958   Zones configured for dynamic DNS may use this option to allow varying
1959   levels of automatic DNSSEC key management. There are three possible
1960   settings:
1961
1962   ``auto-dnssec allow;`` permits keys to be updated and the zone fully
1963   re-signed whenever the user issues the command ``rndc sign zonename``.
1964
1965   ``auto-dnssec maintain;`` includes the above, but also
1966   automatically adjusts the zone's DNSSEC keys on a schedule, according
1967   to the keys' timing metadata (see :ref:`man_dnssec-keygen` and
1968   :ref:`man_dnssec-settime`). The command ``rndc sign zonename``
1969   causes ``named`` to load keys from the key repository and sign the
1970   zone with all keys that are active. ``rndc loadkeys zonename``
1971   causes ``named`` to load keys from the key repository and schedule
1972   key maintenance events to occur in the future, but it does not sign
1973   the full zone immediately. Note: once keys have been loaded for a
1974   zone the first time, the repository is searched for changes
1975   periodically, regardless of whether ``rndc loadkeys`` is used. The
1976   recheck interval is defined by ``dnssec-loadkeys-interval``.
1977
1978   The default setting is ``auto-dnssec off``.
1979
1980``dnssec-enable``
1981   This option is obsolete and has no effect.
1982
1983.. _dnssec-validation-option:
1984
1985``dnssec-validation``
1986   This option enables DNSSEC validation in ``named``.
1987
1988   If set to ``auto``, DNSSEC validation is enabled and a default trust
1989   anchor for the DNS root zone is used.
1990
1991   If set to ``yes``, DNSSEC validation is enabled, but a trust anchor must be
1992   manually configured using a ``trust-anchors`` statement (or the
1993   ``managed-keys`` or ``trusted-keys`` statements, both deprecated). If
1994   there is no configured trust anchor, validation does not take place.
1995
1996   If set to ``no``, DNSSEC validation is disabled.
1997
1998   The default is ``auto``, unless BIND is built with
1999   ``configure --disable-auto-validation``, in which case the default is
2000   ``yes``.
2001
2002   The default root trust anchor is stored in the file ``bind.keys``.
2003   ``named`` loads that key at startup if ``dnssec-validation`` is
2004   set to ``auto``. A copy of the file is installed along with BIND 9,
2005   and is current as of the release date. If the root key expires, a new
2006   copy of ``bind.keys`` can be downloaded from
2007   https://www.isc.org/bind-keys.
2008
2009   (To prevent problems if ``bind.keys`` is not found, the current trust
2010   anchor is also compiled in ``named``. Relying on this is not
2011   recommended, however, as it requires ``named`` to be recompiled with
2012   a new key when the root key expires.)
2013
2014   .. note:: ``named`` loads *only* the root key from ``bind.keys``. The file
2015         cannot be used to store keys for other zones. The root key in
2016         ``bind.keys`` is ignored if ``dnssec-validation auto`` is not in
2017         use.
2018
2019         Whenever the resolver sends out queries to an EDNS-compliant
2020         server, it always sets the DO bit indicating it can support DNSSEC
2021         responses, even if ``dnssec-validation`` is off.
2022
2023``validate-except``
2024   This specifies a list of domain names at and beneath which DNSSEC
2025   validation should *not* be performed, regardless of the presence of a
2026   trust anchor at or above those names. This may be used, for example,
2027   when configuring a top-level domain intended only for local use, so
2028   that the lack of a secure delegation for that domain in the root zone
2029   does not cause validation failures. (This is similar to setting a
2030   negative trust anchor except that it is a permanent configuration,
2031   whereas negative trust anchors expire and are removed after a set
2032   period of time.)
2033
2034``dnssec-accept-expired``
2035   This accepts expired signatures when verifying DNSSEC signatures. The
2036   default is ``no``. Setting this option to ``yes`` leaves ``named``
2037   vulnerable to replay attacks.
2038
2039``querylog``
2040   Query logging provides a complete log of all incoming queries and all query
2041   errors. This provides more insight into the server's activity, but with a
2042   cost to performance which may be significant on heavily-loaded servers.
2043
2044   The ``querylog`` option specifies whether query logging should be active when
2045   ``named`` first starts.  If ``querylog`` is not specified, then query logging
2046   is determined by the presence of the logging category ``queries``.  Query
2047   logging can also be activated at runtime using the command ``rndc querylog
2048   on``, or deactivated with ``rndc querylog off``.
2049
2050``check-names``
2051   This option is used to restrict the character set and syntax of
2052   certain domain names in master files and/or DNS responses received
2053   from the network. The default varies according to usage area. For
2054   ``primary`` zones the default is ``fail``. For ``secondary`` zones the
2055   default is ``warn``. For answers received from the network
2056   (``response``), the default is ``ignore``.
2057
2058   The rules for legal hostnames and mail domains are derived from
2059   :rfc:`952` and :rfc:`821` as modified by :rfc:`1123`.
2060
2061   ``check-names`` applies to the owner names of A, AAAA, and MX records.
2062   It also applies to the domain names in the RDATA of NS, SOA, MX, and
2063   SRV records. It also applies to the RDATA of PTR records where the
2064   owner name indicates that it is a reverse lookup of a hostname (the
2065   owner name ends in IN-ADDR.ARPA, IP6.ARPA, or IP6.INT).
2066
2067``check-dup-records``
2068   This checks primary zones for records that are treated as different by
2069   DNSSEC but are semantically equal in plain DNS. The default is to
2070   ``warn``. Other possible values are ``fail`` and ``ignore``.
2071
2072``check-mx``
2073   This checks whether the MX record appears to refer to an IP address. The
2074   default is to ``warn``. Other possible values are ``fail`` and
2075   ``ignore``.
2076
2077``check-wildcard``
2078   This option is used to check for non-terminal wildcards. The use of
2079   non-terminal wildcards is almost always as a result of a lack of
2080   understanding of the wildcard matching algorithm (:rfc:`1034`). This option
2081   affects primary zones. The default (``yes``) is to check for
2082   non-terminal wildcards and issue a warning.
2083
2084``check-integrity``
2085   This performs post-load zone integrity checks on primary zones. It checks
2086   that MX and SRV records refer to address (A or AAAA) records and that
2087   glue address records exist for delegated zones. For MX and SRV
2088   records, only in-zone hostnames are checked (for out-of-zone hostnames
2089   use ``named-checkzone``). For NS records, only names below top-of-zone
2090   are checked (for out-of-zone names and glue consistency checks use
2091   ``named-checkzone``). The default is ``yes``.
2092
2093   The use of the SPF record to publish Sender Policy Framework is
2094   deprecated, as the migration from using TXT records to SPF records was
2095   abandoned. Enabling this option also checks that a TXT Sender Policy
2096   Framework record exists (starts with "v=spf1") if there is an SPF
2097   record. Warnings are emitted if the TXT record does not exist; they can
2098   be suppressed with ``check-spf``.
2099
2100``check-mx-cname``
2101   If ``check-integrity`` is set, then fail, warn, or ignore MX records
2102   that refer to CNAMES. The default is to ``warn``.
2103
2104``check-srv-cname``
2105   If ``check-integrity`` is set, then fail, warn, or ignore SRV records
2106   that refer to CNAMES. The default is to ``warn``.
2107
2108``check-sibling``
2109   When performing integrity checks, also check that sibling glue
2110   exists. The default is ``yes``.
2111
2112``check-spf``
2113   If ``check-integrity`` is set, check that there is a TXT Sender
2114   Policy Framework record present (starts with "v=spf1") if there is an
2115   SPF record present. The default is ``warn``.
2116
2117``zero-no-soa-ttl``
2118   If ``yes``, when returning authoritative negative responses to SOA queries, set
2119   the TTL of the SOA record returned in the authority section to zero.
2120   The default is ``yes``.
2121
2122``zero-no-soa-ttl-cache``
2123   If ``yes``, when caching a negative response to a SOA query set the TTL to zero.
2124   The default is ``no``.
2125
2126``update-check-ksk``
2127   When set to the default value of ``yes``, check the KSK bit in each
2128   key to determine how the key should be used when generating RRSIGs
2129   for a secure zone.
2130
2131   Ordinarily, zone-signing keys (that is, keys without the KSK bit set)
2132   are used to sign the entire zone, while key-signing keys (keys with
2133   the KSK bit set) are only used to sign the DNSKEY RRset at the zone
2134   apex. However, if this option is set to ``no``, then the KSK bit is
2135   ignored; KSKs are treated as if they were ZSKs and are used to sign
2136   the entire zone. This is similar to the ``dnssec-signzone -z``
2137   command line option.
2138
2139   When this option is set to ``yes``, there must be at least two active
2140   keys for every algorithm represented in the DNSKEY RRset: at least
2141   one KSK and one ZSK per algorithm. If there is any algorithm for
2142   which this requirement is not met, this option is ignored for
2143   that algorithm.
2144
2145``dnssec-dnskey-kskonly``
2146   When this option and ``update-check-ksk`` are both set to ``yes``,
2147   only key-signing keys (that is, keys with the KSK bit set) are
2148   used to sign the DNSKEY, CDNSKEY, and CDS RRsets at the zone apex.
2149   Zone-signing keys (keys without the KSK bit set) are used to sign
2150   the remainder of the zone, but not the DNSKEY RRset. This is similar
2151   to the ``dnssec-signzone -x`` command line option.
2152
2153   The default is ``no``. If ``update-check-ksk`` is set to ``no``, this
2154   option is ignored.
2155
2156``try-tcp-refresh``
2157   If ``yes``, try to refresh the zone using TCP if UDP queries fail. The default is
2158   ``yes``.
2159
2160``dnssec-secure-to-insecure``
2161   This allows a dynamic zone to transition from secure to insecure (i.e.,
2162   signed to unsigned) by deleting all of the DNSKEY records. The
2163   default is ``no``. If set to ``yes``, and if the DNSKEY RRset at the
2164   zone apex is deleted, all RRSIG and NSEC records are removed from
2165   the zone as well.
2166
2167   If the zone uses NSEC3, it is also necessary to delete the
2168   NSEC3PARAM RRset from the zone apex; this causes the removal of
2169   all corresponding NSEC3 records. (It is expected that this
2170   requirement will be eliminated in a future release.)
2171
2172   Note that if a zone has been configured with ``auto-dnssec maintain``
2173   and the private keys remain accessible in the key repository,
2174   the zone will be automatically signed again the next time ``named``
2175   is started.
2176
2177``synth-from-dnssec``
2178   This option synthesizes answers from cached NSEC, NSEC3, and other RRsets that have been
2179   proved to be correct using DNSSEC. The default is ``no``, but it will become
2180   ``yes`` again in future releases.
2181
2182   .. note:: DNSSEC validation must be enabled for this option to be effective.
2183      This initial implementation only covers synthesis of answers from
2184      NSEC records; synthesis from NSEC3 is planned for the future. This
2185      will also be controlled by ``synth-from-dnssec``.
2186
2187Forwarding
2188^^^^^^^^^^
2189
2190The forwarding facility can be used to create a large site-wide cache on
2191a few servers, reducing traffic over links to external name servers. It
2192can also be used to allow queries by servers that do not have direct
2193access to the Internet, but wish to look up exterior names anyway.
2194Forwarding occurs only on those queries for which the server is not
2195authoritative and does not have the answer in its cache.
2196
2197``forward``
2198   This option is only meaningful if the forwarders list is not empty. A
2199   value of ``first`` is the default and causes the server to query the
2200   forwarders first; if that does not answer the question, the
2201   server then looks for the answer itself. If ``only`` is
2202   specified, the server only queries the forwarders.
2203
2204``forwarders``
2205   This specifies a list of IP addresses to which queries are forwarded. The
2206   default is the empty list (no forwarding). Each address in the list can be
2207   associated with an optional port number and/or DSCP value, and a default port
2208   number and DSCP value can be set for the entire list.
2209
2210Forwarding can also be configured on a per-domain basis, allowing for
2211the global forwarding options to be overridden in a variety of ways.
2212Particular domains can be set to use different forwarders, or have a
2213different ``forward only/first`` behavior, or not forward at all; see
2214:ref:`zone_statement_grammar`.
2215
2216.. _dual_stack:
2217
2218Dual-stack Servers
2219^^^^^^^^^^^^^^^^^^
2220
2221Dual-stack servers are used as servers of last resort, to work around
2222problems in reachability due to the lack of support for either IPv4 or IPv6
2223on the host machine.
2224
2225``dual-stack-servers``
2226   This specifies host names or addresses of machines with access to both
2227   IPv4 and IPv6 transports. If a hostname is used, the server must be
2228   able to resolve the name using only the transport it has. If the
2229   machine is dual-stacked, the ``dual-stack-servers`` parameter has no
2230   effect unless access to a transport has been disabled on the command
2231   line (e.g., ``named -4``).
2232
2233.. _access_control:
2234
2235Access Control
2236^^^^^^^^^^^^^^
2237
2238Access to the server can be restricted based on the IP address of the
2239requesting system. See :ref:`address_match_lists`
2240for details on how to specify IP address lists.
2241
2242``allow-notify``
2243   This ACL specifies which hosts may send NOTIFY messages to inform
2244   this server of changes to zones for which it is acting as a secondary
2245   server. This is only applicable for secondary zones (i.e., type
2246   ``secondary`` or ``slave``).
2247
2248   If this option is set in ``view`` or ``options``, it is globally
2249   applied to all secondary zones. If set in the ``zone`` statement, the
2250   global value is overridden.
2251
2252   If not specified, the default is to process NOTIFY messages only from
2253   the configured ``masters`` for the zone. ``allow-notify`` can be used
2254   to expand the list of permitted hosts, not to reduce it.
2255
2256``allow-query``
2257   This specifies which hosts are allowed to ask ordinary DNS questions.
2258   ``allow-query`` may also be specified in the ``zone`` statement, in
2259   which case it overrides the ``options allow-query`` statement. If not
2260   specified, the default is to allow queries from all hosts.
2261
2262   .. note:: ``allow-query-cache`` is used to specify access to the cache.
2263
2264``allow-query-on``
2265   This specifies which local addresses can accept ordinary DNS questions.
2266   This makes it possible, for instance, to allow queries on
2267   internal-facing interfaces but disallow them on external-facing ones,
2268   without necessarily knowing the internal network's addresses.
2269
2270   Note that ``allow-query-on`` is only checked for queries that are
2271   permitted by ``allow-query``. A query must be allowed by both ACLs,
2272   or it is refused.
2273
2274   ``allow-query-on`` may also be specified in the ``zone`` statement,
2275   in which case it overrides the ``options allow-query-on`` statement.
2276
2277   If not specified, the default is to allow queries on all addresses.
2278
2279   .. note:: ``allow-query-cache`` is used to specify access to the cache.
2280
2281``allow-query-cache``
2282   This specifies which hosts are allowed to get answers from the cache. If
2283   ``allow-recursion`` is not set, BIND checks to see if the following parameters
2284   are set, in order: ``allow-query-cache`` and ``allow-query`` (unless ``recursion no;`` is set).
2285   If neither of those parameters is set, the default (localnets; localhost;) is used.
2286
2287``allow-query-cache-on``
2288   This specifies which local addresses can send answers from the cache. If
2289   ``allow-query-cache-on`` is not set, then ``allow-recursion-on`` is
2290   used if set. Otherwise, the default is to allow cache responses to be
2291   sent from any address. Note: Both ``allow-query-cache`` and
2292   ``allow-query-cache-on`` must be satisfied before a cache response
2293   can be sent; a client that is blocked by one cannot be allowed by the
2294   other.
2295
2296``allow-recursion``
2297   This specifies which hosts are allowed to make recursive queries through
2298   this server. BIND checks to see if the following parameters are set, in
2299   order: allow-query-cache and allow-query. If neither of those parameters
2300   is set, the default (localnets; localhost;) is used.
2301
2302``allow-recursion-on``
2303   This specifies which local addresses can accept recursive queries. If
2304   ``allow-recursion-on`` is not set, then ``allow-query-cache-on`` is
2305   used if set; otherwise, the default is to allow recursive queries on
2306   all addresses. Any client permitted to send recursive queries can
2307   send them to any address on which ``named`` is listening. Note: Both
2308   ``allow-recursion`` and ``allow-recursion-on`` must be satisfied
2309   before recursion is allowed; a client that is blocked by one cannot
2310   be allowed by the other.
2311
2312``allow-update``
2313   When set in the ``zone`` statement for a primary zone, this specifies which
2314   hosts are allowed to submit Dynamic DNS updates to that zone. The
2315   default is to deny updates from all hosts.
2316
2317   Note that allowing updates based on the requestor's IP address is
2318   insecure; see :ref:`dynamic_update_security` for details.
2319
2320   In general this option should only be set at the ``zone`` level.
2321   While a default value can be set at the ``options`` or ``view`` level
2322   and inherited by zones, this could lead to some zones unintentionally
2323   allowing updates.
2324
2325``allow-update-forwarding``
2326   When set in the ``zone`` statement for a secondary zone, this specifies which
2327   hosts are allowed to submit Dynamic DNS updates and have them be
2328   forwarded to the primary. The default is ``{ none; }``, which means
2329   that no update forwarding is performed.
2330
2331   To enable update forwarding, specify
2332   ``allow-update-forwarding { any; };`` in the ``zone`` statement.
2333   Specifying values other than ``{ none; }`` or ``{ any; }`` is usually
2334   counterproductive; the responsibility for update access control
2335   should rest with the primary server, not the secondary.
2336
2337   Note that enabling the update forwarding feature on a secondary server
2338   may expose primary servers to attacks if they rely on insecure
2339   IP-address-based access control; see :ref:`dynamic_update_security` for more details.
2340
2341   In general this option should only be set at the ``zone`` level.
2342   While a default value can be set at the ``options`` or ``view`` level
2343   and inherited by zones, this can lead to some zones unintentionally
2344   forwarding updates.
2345
2346``allow-v6-synthesis``
2347   This option was introduced for the smooth transition from AAAA to A6
2348   and from "nibble labels" to binary labels. However, since both A6 and
2349   binary labels were then deprecated, this option was also deprecated.
2350   It is now ignored with some warning messages.
2351
2352.. _allow-transfer-access:
2353
2354``allow-transfer``
2355   This specifies which hosts are allowed to receive zone transfers from the
2356   server. ``allow-transfer`` may also be specified in the ``zone``
2357   statement, in which case it overrides the ``allow-transfer``
2358   statement set in ``options`` or ``view``. If not specified, the
2359   default is to allow transfers to all hosts.
2360
2361``blackhole``
2362   This specifies a list of addresses which the server does not accept queries
2363   from or use to resolve a query. Queries from these addresses are not
2364   be responded to. The default is ``none``.
2365
2366``keep-response-order``
2367   This specifies a list of addresses to which the server sends responses
2368   to TCP queries, in the same order in which they were received. This
2369   disables the processing of TCP queries in parallel. The default is
2370   ``none``.
2371
2372``no-case-compress``
2373   This specifies a list of addresses which require responses to use
2374   case-insensitive compression. This ACL can be used when ``named``
2375   needs to work with clients that do not comply with the requirement in
2376   :rfc:`1034` to use case-insensitive name comparisons when checking for
2377   matching domain names.
2378
2379   If left undefined, the ACL defaults to ``none``: case-insensitive
2380   compression is used for all clients. If the ACL is defined and
2381   matches a client, then case is ignored when compressing domain
2382   names in DNS responses sent to that client.
2383
2384   This can result in slightly smaller responses; if a response contains
2385   the names "example.com" and "example.COM", case-insensitive
2386   compression treats the second one as a duplicate. It also
2387   ensures that the case of the query name exactly matches the case of
2388   the owner names of returned records, rather than matching the case of
2389   the records entered in the zone file. This allows responses to
2390   exactly match the query, which is required by some clients due to
2391   incorrect use of case-sensitive comparisons.
2392
2393   Case-insensitive compression is *always* used in AXFR and IXFR
2394   responses, regardless of whether the client matches this ACL.
2395
2396   There are circumstances in which ``named`` does not preserve the case
2397   of owner names of records: if a zone file defines records of
2398   different types with the same name, but the capitalization of the
2399   name is different (e.g., "www.example.com/A" and
2400   "WWW.EXAMPLE.COM/AAAA"), then all responses for that name use
2401   the *first* version of the name that was used in the zone file. This
2402   limitation may be addressed in a future release. However, domain
2403   names specified in the rdata of resource records (i.e., records of
2404   type NS, MX, CNAME, etc) always have their case preserved unless
2405   the client matches this ACL.
2406
2407``resolver-query-timeout``
2408   This is the amount of time in milliseconds that the resolver spends
2409   attempting to resolve a recursive query before failing. The default
2410   and minimum is ``10000`` and the maximum is ``30000``. Setting it to
2411   ``0`` results in the default being used.
2412
2413   This value was originally specified in seconds. Values less than or
2414   equal to 300 are treated as seconds and converted to
2415   milliseconds before applying the above limits.
2416
2417Interfaces
2418^^^^^^^^^^
2419
2420The interfaces and ports that the server answers queries from may be
2421specified using the ``listen-on`` option. ``listen-on`` takes an
2422optional port and an ``address_match_list`` of IPv4 addresses. (IPv6
2423addresses are ignored, with a logged warning.) The server listens on
2424all interfaces allowed by the address match list. If a port is not
2425specified, port 53 is used.
2426
2427Multiple ``listen-on`` statements are allowed. For example,
2428
2429::
2430
2431   listen-on { 5.6.7.8; };
2432   listen-on port 1234 { !1.2.3.4; 1.2/16; };
2433
2434enables the name server on port 53 for the IP address 5.6.7.8, and
2435on port 1234 of an address on the machine in net 1.2 that is not
24361.2.3.4.
2437
2438If no ``listen-on`` is specified, the server listens on port 53 on
2439all IPv4 interfaces.
2440
2441The ``listen-on-v6`` option is used to specify the interfaces and the
2442ports on which the server listens for incoming queries sent using
2443IPv6. If not specified, the server listens on port 53 on all IPv6
2444interfaces.
2445
2446Multiple ``listen-on-v6`` options can be used. For example,
2447
2448::
2449
2450   listen-on-v6 { any; };
2451   listen-on-v6 port 1234 { !2001:db8::/32; any; };
2452
2453enables the name server on port 53 for any IPv6 addresses (with a
2454single wildcard socket), and on port 1234 of IPv6 addresses that are not
2455in the prefix 2001:db8::/32 (with separate sockets for each matched
2456address).
2457
2458To make the server not listen on any IPv6 address, use
2459
2460::
2461
2462   listen-on-v6 { none; };
2463
2464.. _query_address:
2465
2466Query Address
2467^^^^^^^^^^^^^
2468
2469If the server does not know the answer to a question, it queries other
2470name servers. ``query-source`` specifies the address and port used for
2471such queries. For queries sent over IPv6, there is a separate
2472``query-source-v6`` option. If ``address`` is ``*`` (asterisk) or is
2473omitted, a wildcard IP address (``INADDR_ANY``) is used.
2474
2475If ``port`` is ``*`` or is omitted, a random port number from a
2476pre-configured range is picked up and used for each query. The
2477port range(s) is specified in the ``use-v4-udp-ports`` (for IPv4)
2478and ``use-v6-udp-ports`` (for IPv6) options, excluding the ranges
2479specified in the ``avoid-v4-udp-ports`` and ``avoid-v6-udp-ports``
2480options, respectively.
2481
2482The defaults of the ``query-source`` and ``query-source-v6`` options
2483are:
2484
2485::
2486
2487   query-source address * port *;
2488   query-source-v6 address * port *;
2489
2490If ``use-v4-udp-ports`` or ``use-v6-udp-ports`` is unspecified,
2491``named`` checks whether the operating system provides a programming
2492interface to retrieve the system's default range for ephemeral ports. If
2493such an interface is available, ``named`` uses the corresponding
2494system default range; otherwise, it uses its own defaults:
2495
2496::
2497
2498   use-v4-udp-ports { range 1024 65535; };
2499   use-v6-udp-ports { range 1024 65535; };
2500
2501.. note:: Make sure the ranges are sufficiently large for security. A
2502   desirable size depends on various parameters, but we generally recommend
2503   it contain at least 16384 ports (14 bits of entropy). Note also that the
2504   system's default range when used may be too small for this purpose, and
2505   that the range may even be changed while ``named`` is running; the new
2506   range is automatically applied when ``named`` is reloaded. Explicit
2507   configuration of use-v4-udp-ports and use-v6-udp-ports is encouraged,
2508   so that the ranges are sufficiently large and are reasonably
2509   independent from the ranges used by other applications.
2510
2511.. note:: The operational configuration where ``named`` runs may prohibit
2512   the use of some ports. For example, Unix systems do not allow
2513   ``named``, if run without a root privilege, to use ports less than 1024.
2514   If such ports are included in the specified (or detected) set of query
2515   ports, the corresponding query attempts will fail, resulting in
2516   resolution failures or delay. It is therefore important to configure the
2517   set of ports that can be safely used in the expected operational
2518   environment.
2519
2520The defaults of the ``avoid-v4-udp-ports`` and ``avoid-v6-udp-ports``
2521options are:
2522
2523::
2524
2525   avoid-v4-udp-ports {};
2526   avoid-v6-udp-ports {};
2527
2528.. note:: BIND 9.5.0 introduced the ``use-queryport-pool`` option to support
2529   a pool of such random ports, but this option is now obsolete because
2530   reusing the same ports in the pool may not be sufficiently secure. For
2531   the same reason, it is generally strongly discouraged to specify a
2532   particular port for the ``query-source`` or ``query-source-v6`` options;
2533   it implicitly disables the use of randomized port numbers.
2534
2535``use-queryport-pool``
2536   This option is obsolete.
2537
2538``queryport-pool-ports``
2539   This option is obsolete.
2540
2541``queryport-pool-updateinterval``
2542   This option is obsolete.
2543
2544   .. note:: The address specified in the ``query-source`` option is used for both
2545      UDP and TCP queries, but the port applies only to UDP queries. TCP
2546      queries always use a random unprivileged port.
2547
2548   .. note:: Solaris 2.5.1 and earlier does not support setting the source address
2549      for TCP sockets.
2550
2551   .. note:: See also ``transfer-source`` and ``notify-source``.
2552
2553.. _zone_transfers:
2554
2555Zone Transfers
2556^^^^^^^^^^^^^^
2557
2558BIND has mechanisms in place to facilitate zone transfers and set limits
2559on the amount of load that transfers place on the system. The following
2560options apply to zone transfers.
2561
2562``also-notify``
2563   This option defines a global list of IP addresses of name servers that are also
2564   sent NOTIFY messages whenever a fresh copy of the zone is loaded, in
2565   addition to the servers listed in the zone's NS records. This helps
2566   to ensure that copies of the zones quickly converge on stealth
2567   servers. Optionally, a port may be specified with each
2568   ``also-notify`` address to send the notify messages to a port other
2569   than the default of 53. An optional TSIG key can also be specified
2570   with each address to cause the notify messages to be signed; this can
2571   be useful when sending notifies to multiple views. In place of
2572   explicit addresses, one or more named ``masters`` lists can be used.
2573
2574   If an ``also-notify`` list is given in a ``zone`` statement, it
2575   overrides the ``options also-notify`` statement. When a
2576   ``zone notify`` statement is set to ``no``, the IP addresses in the
2577   global ``also-notify`` list are not sent NOTIFY messages for that
2578   zone. The default is the empty list (no global notification list).
2579
2580``max-transfer-time-in``
2581   Inbound zone transfers running longer than this many minutes are
2582   terminated. The default is 120 minutes (2 hours). The maximum value
2583   is 28 days (40320 minutes).
2584
2585``max-transfer-idle-in``
2586   Inbound zone transfers making no progress in this many minutes are
2587   terminated. The default is 60 minutes (1 hour). The maximum value
2588   is 28 days (40320 minutes).
2589
2590``max-transfer-time-out``
2591   Outbound zone transfers running longer than this many minutes are
2592   terminated. The default is 120 minutes (2 hours). The maximum value
2593   is 28 days (40320 minutes).
2594
2595``max-transfer-idle-out``
2596   Outbound zone transfers making no progress in this many minutes are
2597   terminated. The default is 60 minutes (1 hour). The maximum value
2598   is 28 days (40320 minutes).
2599
2600``notify-rate``
2601   This specifies the rate at which NOTIFY requests are sent during normal zone
2602   maintenance operations. (NOTIFY requests due to initial zone loading
2603   are subject to a separate rate limit; see below.) The default is 20
2604   per second. The lowest possible rate is one per second; when set to
2605   zero, it is silently raised to one.
2606
2607``startup-notify-rate``
2608   This is the rate at which NOTIFY requests are sent when the name server
2609   is first starting up, or when zones have been newly added to the
2610   name server. The default is 20 per second. The lowest possible rate is
2611   one per second; when set to zero, it is silently raised to one.
2612
2613``serial-query-rate``
2614   Secondary servers periodically query primary servers to find out if
2615   zone serial numbers have changed. Each such query uses a minute
2616   amount of the secondary server's network bandwidth. To limit the amount
2617   of bandwidth used, BIND 9 limits the rate at which queries are sent.
2618   The value of the ``serial-query-rate`` option, an integer, is the
2619   maximum number of queries sent per second. The default is 20 per
2620   second. The lowest possible rate is one per second; when set to zero,
2621   it is silently raised to one.
2622
2623``transfer-format``
2624   Zone transfers can be sent using two different formats,
2625   ``one-answer`` and ``many-answers``. The ``transfer-format`` option
2626   is used on the primary server to determine which format it sends.
2627   ``one-answer`` uses one DNS message per resource record transferred.
2628   ``many-answers`` packs as many resource records as possible into a
2629   message. ``many-answers`` is more efficient; the default is ``many-answers``.
2630   ``transfer-format`` may be overridden on a per-server basis by using
2631   the ``server`` statement.
2632
2633``transfer-message-size``
2634   This is an upper bound on the uncompressed size of DNS messages used
2635   in zone transfers over TCP. If a message grows larger than this size,
2636   additional messages are used to complete the zone transfer.
2637   (Note, however, that this is a hint, not a hard limit; if a message
2638   contains a single resource record whose RDATA does not fit within the
2639   size limit, a larger message will be permitted so the record can be
2640   transferred.)
2641
2642   Valid values are between 512 and 65535 octets; any values outside
2643   that range are adjusted to the nearest value within it. The
2644   default is ``20480``, which was selected to improve message
2645   compression; most DNS messages of this size will compress to less
2646   than 16536 bytes. Larger messages cannot be compressed as
2647   effectively, because 16536 is the largest permissible compression
2648   offset pointer in a DNS message.
2649
2650   This option is mainly intended for server testing; there is rarely
2651   any benefit in setting a value other than the default.
2652
2653``transfers-in``
2654   This is the maximum number of inbound zone transfers that can be running
2655   concurrently. The default value is ``10``. Increasing
2656   ``transfers-in`` may speed up the convergence of secondary zones, but it
2657   also may increase the load on the local system.
2658
2659``transfers-out``
2660   This is the maximum number of outbound zone transfers that can be running
2661   concurrently. Zone transfer requests in excess of the limit are
2662   refused. The default value is ``10``.
2663
2664``transfers-per-ns``
2665   This is the maximum number of inbound zone transfers that can be concurrently
2666   transferring from a given remote name server. The default value is
2667   ``2``. Increasing ``transfers-per-ns`` may speed up the convergence
2668   of secondary zones, but it also may increase the load on the remote name
2669   server. ``transfers-per-ns`` may be overridden on a per-server basis
2670   by using the ``transfers`` phrase of the ``server`` statement.
2671
2672``transfer-source``
2673   ``transfer-source`` determines which local address is bound to
2674   IPv4 TCP connections used to fetch zones transferred inbound by the
2675   server. It also determines the source IPv4 address, and optionally
2676   the UDP port, used for the refresh queries and forwarded dynamic
2677   updates. If not set, it defaults to a system controlled value which
2678   is usually the address of the interface "closest to" the remote
2679   end. This address must appear in the remote end's ``allow-transfer``
2680   option for the zone being transferred, if one is specified. This
2681   statement sets the ``transfer-source`` for all zones, but can be
2682   overridden on a per-view or per-zone basis by including a
2683   ``transfer-source`` statement within the ``view`` or ``zone`` block
2684   in the configuration file.
2685
2686   .. note:: Solaris 2.5.1 and earlier does not support setting the source
2687      address for TCP sockets.
2688
2689``transfer-source-v6``
2690   This option is the same as ``transfer-source``, except zone transfers are performed
2691   using IPv6.
2692
2693``alt-transfer-source``
2694   This indicates an alternate transfer source if the one listed in ``transfer-source``
2695   fails and ``use-alt-transfer-source`` is set.
2696
2697   .. note:: To avoid using the alternate transfer source,
2698      set ``use-alt-transfer-source`` appropriately and
2699      do not depend upon getting an answer back to the first refresh
2700      query.
2701
2702``alt-transfer-source-v6``
2703   This indicates an alternate transfer source if the one listed in
2704   ``transfer-source-v6`` fails and ``use-alt-transfer-source`` is set.
2705
2706``use-alt-transfer-source``
2707   This indicates whether the alternate transfer sources should be used. If views are specified,
2708   this defaults to ``no``; otherwise, it defaults to ``yes``.
2709
2710``notify-source``
2711   ``notify-source`` determines which local source address, and
2712   optionally UDP port, is used to send NOTIFY messages. This
2713   address must appear in the secondary server's ``masters`` zone clause or
2714   in an ``allow-notify`` clause. This statement sets the
2715   ``notify-source`` for all zones, but can be overridden on a per-zone
2716   or per-view basis by including a ``notify-source`` statement within
2717   the ``zone`` or ``view`` block in the configuration file.
2718
2719   .. note:: Solaris 2.5.1 and earlier does not support setting the source
2720      address for TCP sockets.
2721
2722``notify-source-v6``
2723   This option acts like ``notify-source``, but applies to notify messages sent to IPv6
2724   addresses.
2725
2726.. _port_lists:
2727
2728UDP Port Lists
2729^^^^^^^^^^^^^^
2730
2731``use-v4-udp-ports``, ``avoid-v4-udp-ports``, ``use-v6-udp-ports``, and
2732``avoid-v6-udp-ports`` specify a list of IPv4 and IPv6 UDP ports that
2733are or are not used as source ports for UDP messages. See
2734:ref:`query_address` about how the available ports are
2735determined. For example, with the following configuration:
2736
2737::
2738
2739   use-v6-udp-ports { range 32768 65535; };
2740   avoid-v6-udp-ports { 40000; range 50000 60000; };
2741
2742UDP ports of IPv6 messages sent from ``named`` are in one of the
2743following ranges: 32768 to 39999, 40001 to 49999, and 60001 to 65535.
2744
2745``avoid-v4-udp-ports`` and ``avoid-v6-udp-ports`` can be used to prevent
2746``named`` from choosing as its random source port a port that is blocked
2747by a firewall or a port that is used by other applications; if a
2748query went out with a source port blocked by a firewall, the answer
2749would not get by the firewall and the name server would have to query
2750again. Note: the desired range can also be represented only with
2751``use-v4-udp-ports`` and ``use-v6-udp-ports``, and the ``avoid-``
2752options are redundant in that sense; they are provided for backward
2753compatibility and to possibly simplify the port specification.
2754
2755.. _resource_limits:
2756
2757Operating System Resource Limits
2758^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2759
2760The server's usage of many system resources can be limited. Scaled
2761values are allowed when specifying resource limits. For example, ``1G``
2762can be used instead of ``1073741824`` to specify a limit of one
2763gigabyte. ``unlimited`` requests unlimited use, or the maximum available
2764amount. ``default`` uses the limit that was in force when the server was
2765started. See the description of ``size_spec`` in :ref:`configuration_file_elements`.
2766
2767The following options set operating system resource limits for the name
2768server process. Some operating systems do not support some or any of the
2769limits; on such systems, a warning is issued if an unsupported
2770limit is used.
2771
2772``coresize``
2773   This sets the maximum size of a core dump. The default is ``default``.
2774
2775``datasize``
2776   This sets the maximum amount of data memory the server may use. The default is
2777   ``default``. This is a hard limit on server memory usage; if the
2778   server attempts to allocate memory in excess of this limit, the
2779   allocation will fail, which may in turn leave the server unable to
2780   perform DNS service. Therefore, this option is rarely useful as a way
2781   to limit the amount of memory used by the server, but it can be
2782   used to raise an operating system data size limit that is too small
2783   by default. To limit the amount of memory used by the
2784   server, use the ``max-cache-size`` and ``recursive-clients`` options
2785   instead.
2786
2787``files``
2788   This sets the maximum number of files the server may have open concurrently.
2789   The default is ``unlimited``.
2790
2791``stacksize``
2792   This sets the maximum amount of stack memory the server may use. The default is
2793   ``default``.
2794
2795.. _server_resource_limits:
2796
2797Server Resource Limits
2798^^^^^^^^^^^^^^^^^^^^^^
2799
2800The following options set limits on the server's resource consumption
2801that are enforced internally by the server rather than by the operating
2802system.
2803
2804``max-journal-size``
2805   This sets a maximum size for each journal file (see :ref:`journal`),
2806   expressed in bytes or, if followed by an
2807   optional unit suffix ('k', 'm', or 'g'), in kilobytes, megabytes, or
2808   gigabytes. When the journal file approaches the specified size, some
2809   of the oldest transactions in the journal are automatically
2810   removed. The largest permitted value is 2 gigabytes. Very small
2811   values are rounded up to 4096 bytes. It is possible to specify ``unlimited``,
2812   which also means 2 gigabytes. If the limit is set to ``default`` or
2813   left unset, the journal is allowed to grow up to twice as large
2814   as the zone. (There is little benefit in storing larger journals.)
2815
2816   This option may also be set on a per-zone basis.
2817
2818``max-records``
2819   This sets the maximum number of records permitted in a zone. The default is
2820   zero, which means the maximum is unlimited.
2821
2822``recursive-clients``
2823   This sets the maximum number (a "hard quota") of simultaneous recursive lookups
2824   the server performs on behalf of clients. The default is
2825   ``1000``. Because each recursing client uses a fair bit of memory (on
2826   the order of 20 kilobytes), the value of the ``recursive-clients``
2827   option may have to be decreased on hosts with limited memory.
2828
2829   ``recursive-clients`` defines a "hard quota" limit for pending
2830   recursive clients; when more clients than this are pending, new
2831   incoming requests are not accepted, and for each incoming request
2832   a previous pending request is dropped.
2833
2834   A "soft quota" is also set. When this lower quota is exceeded,
2835   incoming requests are accepted, but for each one, a pending request
2836   is dropped. If ``recursive-clients`` is greater than 1000, the
2837   soft quota is set to ``recursive-clients`` minus 100; otherwise it is
2838   set to 90% of ``recursive-clients``.
2839
2840``tcp-clients``
2841   This is the maximum number of simultaneous client TCP connections that the
2842   server accepts. The default is ``150``.
2843
2844.. _clients-per-query:
2845
2846``clients-per-query``; \ ``max-clients-per-query``
2847   These set the initial value (minimum) and maximum number of recursive
2848   simultaneous clients for any given query (<qname,qtype,qclass>) that
2849   the server accepts before dropping additional clients. ``named``
2850   attempts to self-tune this value and changes are logged. The
2851   default values are 10 and 100.
2852
2853   This value should reflect how many queries come in for a given name
2854   in the time it takes to resolve that name. If the number of queries
2855   exceeds this value, ``named`` assumes that it is dealing with a
2856   non-responsive zone and drops additional queries. If it gets a
2857   response after dropping queries, it raises the estimate. The
2858   estimate is then lowered in 20 minutes if it has remained
2859   unchanged.
2860
2861   If ``clients-per-query`` is set to zero, there is no limit on
2862   the number of clients per query and no queries are dropped.
2863
2864   If ``max-clients-per-query`` is set to zero, there is no upper
2865   bound other than that imposed by ``recursive-clients``.
2866
2867``fetches-per-zone``
2868   This sets the maximum number of simultaneous iterative queries to any one
2869   domain that the server permits before blocking new queries for
2870   data in or beneath that zone. This value should reflect how many
2871   fetches would normally be sent to any one zone in the time it would
2872   take to resolve them. It should be smaller than
2873   ``recursive-clients``.
2874
2875   When many clients simultaneously query for the same name and type,
2876   the clients are all attached to the same fetch, up to the
2877   ``max-clients-per-query`` limit, and only one iterative query is
2878   sent. However, when clients are simultaneously querying for
2879   *different* names or types, multiple queries are sent and
2880   ``max-clients-per-query`` is not effective as a limit.
2881
2882   Optionally, this value may be followed by the keyword ``drop`` or
2883   ``fail``, indicating whether queries which exceed the fetch quota for
2884   a zone are dropped with no response, or answered with SERVFAIL.
2885   The default is ``drop``.
2886
2887   If ``fetches-per-zone`` is set to zero, then there is no limit on the
2888   number of fetches per query and no queries are dropped. The
2889   default is zero.
2890
2891   The current list of active fetches can be dumped by running
2892   ``rndc recursing``. The list includes the number of active fetches
2893   for each domain and the number of queries that have been passed or
2894   dropped as a result of the ``fetches-per-zone`` limit. (Note: these
2895   counters are not cumulative over time; whenever the number of active
2896   fetches for a domain drops to zero, the counter for that domain is
2897   deleted, and the next time a fetch is sent to that domain, it is
2898   recreated with the counters set to zero.)
2899
2900``fetches-per-server``
2901   This sets the maximum number of simultaneous iterative queries that the server
2902   allows to be sent to a single upstream name server before
2903   blocking additional queries. This value should reflect how many
2904   fetches would normally be sent to any one server in the time it would
2905   take to resolve them. It should be smaller than
2906   ``recursive-clients``.
2907
2908   Optionally, this value may be followed by the keyword ``drop`` or
2909   ``fail``, indicating whether queries are dropped with no
2910   response, or answered with SERVFAIL, when all of the servers
2911   authoritative for a zone are found to have exceeded the per-server
2912   quota. The default is ``fail``.
2913
2914   If ``fetches-per-server`` is set to zero, then there is no limit on
2915   the number of fetches per query and no queries are dropped. The
2916   default is zero.
2917
2918   The ``fetches-per-server`` quota is dynamically adjusted in response
2919   to detected congestion. As queries are sent to a server and either are
2920   answered or time out, an exponentially weighted moving average
2921   is calculated of the ratio of timeouts to responses. If the current
2922   average timeout ratio rises above a "high" threshold, then
2923   ``fetches-per-server`` is reduced for that server. If the timeout
2924   ratio drops below a "low" threshold, then ``fetches-per-server`` is
2925   increased. The ``fetch-quota-params`` options can be used to adjust
2926   the parameters for this calculation.
2927
2928``fetch-quota-params``
2929   This sets the parameters to use for dynamic resizing of the
2930   ``fetches-per-server`` quota in response to detected congestion.
2931
2932   The first argument is an integer value indicating how frequently to
2933   recalculate the moving average of the ratio of timeouts to responses
2934   for each server. The default is 100, meaning that BIND recalculates the
2935   average ratio after every 100 queries have either been answered or
2936   timed out.
2937
2938   The remaining three arguments represent the "low" threshold
2939   (defaulting to a timeout ratio of 0.1), the "high" threshold
2940   (defaulting to a timeout ratio of 0.3), and the discount rate for the
2941   moving average (defaulting to 0.7). A higher discount rate causes
2942   recent events to weigh more heavily when calculating the moving
2943   average; a lower discount rate causes past events to weigh more
2944   heavily, smoothing out short-term blips in the timeout ratio. These
2945   arguments are all fixed-point numbers with precision of 1/100: at
2946   most two places after the decimal point are significant.
2947
2948``reserved-sockets``
2949   This sets the number of file descriptors reserved for TCP, stdio, etc. This
2950   needs to be big enough to cover the number of interfaces ``named``
2951   listens on plus ``tcp-clients``, as well as to provide room for
2952   outgoing TCP queries and incoming zone transfers. The default is
2953   ``512``. The minimum value is ``128`` and the maximum value is
2954   ``128`` fewer than maxsockets (-S). This option may be removed in the
2955   future.
2956
2957   This option has little effect on Windows.
2958
2959``max-cache-size``
2960   This sets the maximum amount of memory to use for the server's cache, in bytes
2961   or percentage of total physical memory. When the amount of data in the cache
2962   reaches this limit, the server causes records to expire
2963   prematurely based on an LRU-based strategy so that the limit is not
2964   exceeded. The keyword ``unlimited``, or the value 0, places no
2965   limit on the cache size; records are purged from the cache only when
2966   their TTLs expire. Any positive values less than 2MB are ignored
2967   and reset to 2MB. In a server with multiple views, the limit applies
2968   separately to the cache of each view. The default is ``90%``. On
2969   systems where detection of the amount of physical memory is not supported,
2970   values represented as a percentage fall back to unlimited. Note that the
2971   detection of physical memory is done only once at startup, so
2972   ``named`` does not adjust the cache size if the amount of physical
2973   memory is changed during runtime.
2974
2975``tcp-listen-queue``
2976   This sets the listen queue depth. The default and minimum is 10. If the kernel
2977   supports the accept filter "dataready", this also controls how many
2978   TCP connections that are queued in kernel space waiting for some
2979   data before being passed to accept. Nonzero values less than 10 are
2980   silently raised. A value of 0 may also be used; on most platforms
2981   this sets the listen queue length to a system-defined default value.
2982
2983``tcp-initial-timeout``
2984   This sets the amount of time (in units of 100 milliseconds) that the server waits on
2985   a new TCP connection for the first message from the client. The
2986   default is 300 (30 seconds), the minimum is 25 (2.5 seconds), and the
2987   maximum is 1200 (two minutes). Values above the maximum or below the
2988   minimum are adjusted with a logged warning. (Note: This value
2989   must be greater than the expected round-trip delay time; otherwise, no
2990   client will ever have enough time to submit a message.) This value
2991   can be updated at runtime by using ``rndc tcp-timeouts``.
2992
2993``tcp-idle-timeout``
2994   This sets the amount of time (in units of 100 milliseconds) that the server waits on
2995   an idle TCP connection before closing it, when the client is not using
2996   the EDNS TCP keepalive option. The default is 300 (30 seconds), the
2997   maximum is 1200 (two minutes), and the minimum is 1 (one-tenth of a
2998   second). Values above the maximum or below the minimum are
2999   adjusted with a logged warning. See ``tcp-keepalive-timeout`` for
3000   clients using the EDNS TCP keepalive option. This value can be
3001   updated at runtime by using ``rndc tcp-timeouts``.
3002
3003``tcp-keepalive-timeout``
3004   This sets the amount of time (in units of 100 milliseconds) that the server waits on
3005   an idle TCP connection before closing it, when the client is using the
3006   EDNS TCP keepalive option. The default is 300 (30 seconds), the
3007   maximum is 65535 (about 1.8 hours), and the minimum is 1 (one-tenth
3008   of a second). Values above the maximum or below the minimum are
3009   adjusted with a logged warning. This value may be greater than
3010   ``tcp-idle-timeout`` because clients using the EDNS TCP keepalive
3011   option are expected to use TCP connections for more than one message.
3012   This value can be updated at runtime by using ``rndc tcp-timeouts``.
3013
3014``tcp-advertised-timeout``
3015   This sets the timeout value (in units of 100 milliseconds) that the server sends
3016   in responses containing the EDNS TCP keepalive option, which informs a
3017   client of the amount of time it may keep the session open. The
3018   default is 300 (30 seconds), the maximum is 65535 (about 1.8 hours),
3019   and the minimum is 0, which signals that the clients must close TCP
3020   connections immediately. Ordinarily this should be set to the same
3021   value as ``tcp-keepalive-timeout``. This value can be updated at
3022   runtime by using ``rndc tcp-timeouts``.
3023
3024.. _intervals:
3025
3026Periodic Task Intervals
3027^^^^^^^^^^^^^^^^^^^^^^^
3028
3029``cleaning-interval``
3030   This option is obsolete.
3031
3032``heartbeat-interval``
3033   The server performs zone maintenance tasks for all zones marked
3034   as ``dialup`` whenever this interval expires. The default is 60
3035   minutes. Reasonable values are up to 1 day (1440 minutes). The
3036   maximum value is 28 days (40320 minutes). If set to 0, no zone
3037   maintenance for these zones occurs.
3038
3039``interface-interval``
3040   The server scans the network interface list every ``interface-interval``
3041   minutes. The default is 60 minutes; the maximum value is 28 days (40320
3042   minutes). If set to 0, interface scanning only occurs when the configuration
3043   file is loaded, or when ``automatic-interface-scan`` is enabled and supported
3044   by the operating system. After the scan, the server begins listening for
3045   queries on any newly discovered interfaces (provided they are allowed by the
3046   ``listen-on`` configuration), and stops listening on interfaces that have
3047   gone away. For convenience, TTL-style time unit suffixes may be used to
3048   specify the value. It also accepts ISO 8601 duration formats.
3049
3050.. _the_sortlist_statement:
3051
3052The ``sortlist`` Statement
3053^^^^^^^^^^^^^^^^^^^^^^^^^^
3054
3055The response to a DNS query may consist of multiple resource records
3056(RRs) forming a resource record set (RRset). The name server
3057normally returna the RRs within the RRset in an indeterminate order (but
3058see the ``rrset-order`` statement in :ref:`rrset_ordering`). The client resolver code should
3059rearrange the RRs as appropriate; that is, using any addresses on the
3060local net in preference to other addresses. However, not all resolvers
3061can do this or are correctly configured. When a client is using a local
3062server, the sorting can be performed in the server, based on the
3063client's address. This only requires configuring the name servers, not
3064all the clients.
3065
3066The ``sortlist`` statement (see below) takes an ``address_match_list`` and
3067interprets it in a special way. Each top-level statement in the ``sortlist``
3068must itself be an explicit ``address_match_list`` with one or two elements. The
3069first element (which may be an IP address, an IP prefix, an ACL name, or a nested
3070``address_match_list``) of each top-level list is checked against the source
3071address of the query until a match is found. When the addresses in the first
3072element overlap, the first rule to match is selected.
3073
3074Once the source address of the query has been matched, if the top level
3075statement contains only one element, the actual primitive element that
3076matched the source address is used to select the address in the response
3077to move to the beginning of the response. If the statement is a list of
3078two elements, then the second element is interpreted as a topology
3079preference list. Each top-level element is assigned a distance, and the
3080address in the response with the minimum distance is moved to the
3081beginning of the response.
3082
3083In the following example, any queries received from any of the addresses
3084of the host itself will get responses preferring addresses on any of the
3085locally connected networks. Next most preferred are addresses on the
3086192.168.1/24 network, and after that either the 192.168.2/24 or
3087192.168.3/24 network with no preference shown between these two
3088networks. Queries received from a host on the 192.168.1/24 network will
3089prefer other addresses on that network to the 192.168.2/24 and
3090192.168.3/24 networks. Queries received from a host on the 192.168.4/24
3091or the 192.168.5/24 network will only prefer other addresses on their
3092directly connected networks.
3093
3094::
3095
3096   sortlist {
3097       // IF the local host
3098       // THEN first fit on the following nets
3099       { localhost;
3100       { localnets;
3101           192.168.1/24;
3102           { 192.168.2/24; 192.168.3/24; }; }; };
3103       // IF on class C 192.168.1 THEN use .1, or .2 or .3
3104       { 192.168.1/24;
3105       { 192.168.1/24;
3106           { 192.168.2/24; 192.168.3/24; }; }; };
3107       // IF on class C 192.168.2 THEN use .2, or .1 or .3
3108       { 192.168.2/24;
3109       { 192.168.2/24;
3110           { 192.168.1/24; 192.168.3/24; }; }; };
3111       // IF on class C 192.168.3 THEN use .3, or .1 or .2
3112       { 192.168.3/24;
3113       { 192.168.3/24;
3114           { 192.168.1/24; 192.168.2/24; }; }; };
3115       // IF .4 or .5 THEN prefer that net
3116       { { 192.168.4/24; 192.168.5/24; };
3117       };
3118   };
3119
3120The following example illlustrates reasonable behavior for the local host
3121and hosts on directly connected networks. Responses sent to queries from the
3122local host favor any of the directly connected networks. Responses
3123sent to queries from any other hosts on a directly connected network
3124prefer addresses on that same network. Responses to other queries
3125are not sorted.
3126
3127::
3128
3129   sortlist {
3130          { localhost; localnets; };
3131          { localnets; };
3132   };
3133
3134.. _rrset_ordering:
3135
3136RRset Ordering
3137^^^^^^^^^^^^^^
3138
3139When multiple records are returned in an answer, it may be useful to
3140configure the order of the records placed into the response. The
3141``rrset-order`` statement permits configuration of the ordering of the
3142records in a multiple-record response. See also the ``sortlist``
3143statement, :ref:`the_sortlist_statement`.
3144
3145An ``order_spec`` is defined as follows:
3146
3147[class *class_name*] [type *type_name*] [name "*domain_name*"] order *ordering*
3148
3149If no class is specified, the default is ``ANY``. If no type is
3150specified, the default is ``ANY``. If no name is specified, the default
3151is "``*``" (asterisk).
3152
3153The legal values for ``ordering`` are:
3154
3155``fixed``
3156    Records are returned in the order they are defined in the zone file. This option is only available if BIND is configured with "--enable-fixed-rrset" at compile time.
3157
3158``random``
3159    Records are returned in a random order.
3160
3161``cyclic``
3162    Records are returned in a cyclic round-robin order, rotating by one record per query. If BIND is configured with "--enable-fixed-rrset" at compile time, the initial ordering of the RRset matches the one specified in the zone file; otherwise the initial ordering is indeterminate.
3163
3164``none``
3165    Records are returned in whatever order they were retrieved from the database. This order is indeterminate, but remains consistent as long as the database is not modified. When no ordering is specified, this is the default.
3166
3167For example:
3168
3169::
3170
3171   rrset-order {
3172      class IN type A name "host.example.com" order random;
3173      order cyclic;
3174   };
3175
3176causes any responses for type A records in class IN, that have
3177``host.example.com`` as a suffix, to always be returned in random
3178order. All other records are returned in cyclic order.
3179
3180If multiple ``rrset-order`` statements appear, they are not combined;
3181the last one applies.
3182
3183By default, records are returned in ``random`` order.
3184
3185.. note::
3186
3187   "Fixed" ordering of the ``rrset-order`` statement by default is not
3188   currently supported in BIND 9. Fixed ordering can be enabled at
3189   compile time by specifying "--enable-fixed-rrset" on the "configure"
3190   command line.
3191
3192.. _tuning:
3193
3194Tuning
3195^^^^^^
3196
3197``lame-ttl``
3198   This sets the number of seconds to cache a lame server indication. 0
3199   disables caching. (This is **NOT** recommended.) The default is
3200   ``600`` (10 minutes) and the maximum value is ``1800`` (30 minutes).
3201
3202``servfail-ttl``
3203   This sets the number of seconds to cache a SERVFAIL response due to DNSSEC
3204   validation failure or other general server failure. If set to ``0``,
3205   SERVFAIL caching is disabled. The SERVFAIL cache is not consulted if
3206   a query has the CD (Checking Disabled) bit set; this allows a query
3207   that failed due to DNSSEC validation to be retried without waiting
3208   for the SERVFAIL TTL to expire.
3209
3210   The maximum value is ``30`` seconds; any higher value is
3211   silently reduced. The default is ``1`` second.
3212
3213``min-ncache-ttl``
3214   To reduce network traffic and increase performance, the server stores
3215   negative answers. ``min-ncache-ttl`` is used to set a minimum
3216   retention time for these answers in the server in seconds. For
3217   convenience, TTL-style time unit suffixes may be used to specify the
3218   value. It also accepts ISO 8601 duration formats.
3219
3220   The default ``min-ncache-ttl`` is ``0`` seconds. ``min-ncache-ttl`` cannot
3221   exceed 90 seconds and is truncated to 90 seconds if set to a greater
3222   value.
3223
3224``min-cache-ttl``
3225   This sets the minimum time for which the server caches ordinary (positive)
3226   answers, in seconds. For convenience, TTL-style time unit suffixes may be used
3227   to specify the value. It also accepts ISO 8601 duration formats.
3228
3229   The default ``min-cache-ttl`` is ``0`` seconds. ``min-cache-ttl`` cannot
3230   exceed 90 seconds and is truncated to 90 seconds if set to a greater
3231   value.
3232
3233``max-ncache-ttl``
3234   To reduce network traffic and increase performance, the server stores
3235   negative answers. ``max-ncache-ttl`` is used to set a maximum retention time
3236   for these answers in the server in seconds. For convenience, TTL-style time
3237   unit suffixes may be used to specify the value.  It also accepts ISO 8601
3238   duration formats.
3239
3240   The default ``max-ncache-ttl`` is 10800 seconds (3 hours). ``max-ncache-ttl``
3241   cannot exceed 7 days and is silently truncated to 7 days if set to a
3242   greater value.
3243
3244``max-cache-ttl``
3245   This sets the maximum time for which the server caches ordinary (positive)
3246   answers, in seconds. For convenience, TTL-style time unit suffixes may be used
3247   to specify the value. It also accepts ISO 8601 duration formats.
3248
3249   The default ``max-cache-ttl`` is 604800 (one week). A value of zero may cause
3250   all queries to return SERVFAIL, because of lost caches of intermediate RRsets
3251   (such as NS and glue AAAA/A records) in the resolution process.
3252
3253``max-stale-ttl``
3254   If stale answers are enabled, ``max-stale-ttl`` sets the maximum time
3255   for which the server retains records past their normal expiry to
3256   return them as stale records, when the servers for those records are
3257   not reachable. The default is 12 hours. The minimum allowed is 1
3258   second; a value of 0 is updated silently to 1 second.
3259
3260   For stale answers to be returned, they must be enabled, either in the
3261   configuration file using ``stale-answer-enable`` or via
3262   ``rndc serve-stale on``.
3263
3264``resolver-nonbackoff-tries``
3265   This specifies how many retries occur before exponential backoff kicks in. The
3266   default is ``3``.
3267
3268``resolver-retry-interval``
3269   This sets the base retry interval in milliseconds. The default is ``800``.
3270
3271``sig-validity-interval``
3272   This specifies the number of days into the future when DNSSEC signatures
3273   automatically generated as a result of dynamic updates
3274   (:ref:`dynamic_update`) will expire. There is an optional second
3275   field which specifies how long before expiry the signatures are
3276   regenerated. If not specified, the signatures are regenerated
3277   at 1/4 of the base interval. The second field is specified in days if the
3278   base interval is greater than 7 days; otherwise it is specified in
3279   hours. The default base interval is ``30`` days, giving a re-signing
3280   interval of 7 1/2 days. The maximum value is 10 years (3660 days).
3281
3282   The signature inception time is unconditionally set to one hour
3283   before the current time, to allow for a limited amount of clock skew.
3284
3285   The ``sig-validity-interval`` can be overridden for DNSKEY records by
3286   setting ``dnskey-sig-validity``.
3287
3288   The ``sig-validity-interval`` should be at least several multiples
3289   of the SOA expire interval, to allow for reasonable interaction
3290   between the various timer and expiry dates.
3291
3292``dnskey-sig-validity``
3293   This specifies the number of days into the future when DNSSEC signatures
3294   that are automatically generated for DNSKEY RRsets as a result of
3295   dynamic updates (:ref:`dynamic_update`) will expire.
3296   If set to a non-zero value, this overrides the value set by
3297   ``sig-validity-interval``. The default is zero, meaning
3298   ``sig-validity-interval`` is used. The maximum value is 3660 days (10
3299   years), and higher values are rejected.
3300
3301``sig-signing-nodes``
3302   This specifies the maximum number of nodes to be examined in each quantum
3303   when signing a zone with a new DNSKEY. The default is ``100``.
3304
3305``sig-signing-signatures``
3306   This specifies a threshold number of signatures that terminates
3307   processing a quantum when signing a zone with a new DNSKEY. The
3308   default is ``10``.
3309
3310``sig-signing-type``
3311   This specifies a private RDATA type to be used when generating signing state
3312   records. The default is ``65534``.
3313
3314   It is expected that this parameter may be removed in a future version
3315   once there is a standard type.
3316
3317   Signing state records are used to internally by ``named`` to track
3318   the current state of a zone-signing process, i.e., whether it is
3319   still active or has been completed. The records can be inspected
3320   using the command ``rndc signing -list zone``. Once ``named`` has
3321   finished signing a zone with a particular key, the signing state
3322   record associated with that key can be removed from the zone by
3323   running ``rndc signing -clear keyid/algorithm zone``. To clear all of
3324   the completed signing state records for a zone, use
3325   ``rndc signing -clear all zone``.
3326
3327``min-refresh-time``; \ ``max-refresh-time``; \ ``min-retry-time``; \ ``max-retry-time``
3328   These options control the server's behavior on refreshing a zone
3329   (querying for SOA changes) or retrying failed transfers. Usually the
3330   SOA values for the zone are used, up to a hard-coded maximum expiry
3331   of 24 weeks. However, these values are set by the primary, giving
3332   secondary server administrators little control over their contents.
3333
3334   These options allow the administrator to set a minimum and maximum
3335   refresh and retry time in seconds per-zone, per-view, or globally.
3336   These options are valid for secondary and stub zones, and clamp the SOA
3337   refresh and retry times to the specified values.
3338
3339   The following defaults apply: ``min-refresh-time`` 300 seconds,
3340   ``max-refresh-time`` 2419200 seconds (4 weeks), ``min-retry-time``
3341   500 seconds, and ``max-retry-time`` 1209600 seconds (2 weeks).
3342
3343``edns-udp-size``
3344   This sets the maximum advertised EDNS UDP buffer size in bytes, to control
3345   the size of packets received from authoritative servers in response
3346   to recursive queries. Valid values are 512 to 4096; values outside
3347   this range are silently adjusted to the nearest value within it.
3348   The default value is 4096.
3349
3350   The usual reason for setting ``edns-udp-size`` to a non-default value
3351   is to get UDP answers to pass through broken firewalls that block
3352   fragmented packets and/or block UDP DNS packets that are greater than
3353   512 bytes.
3354
3355   When ``named`` first queries a remote server, it advertises a UDP
3356   buffer size of 512, as this has the greatest chance of success on the
3357   first try.
3358
3359   If the initial query is successful with EDNS advertising a buffer size of
3360   512, then ``named`` will advertise progressively larger buffer sizes on
3361   successive queries, until responses begin timing out or ``edns-udp-size`` is
3362   reached.
3363
3364   The default buffer sizes used by ``named`` are 512, 1232, 1432, and
3365   4096, but never exceeding ``edns-udp-size``. (The values 1232 and
3366   1432 are chosen to allow for an IPv4/IPv6 encapsulated UDP message to
3367   be sent without fragmentation at the minimum MTU sizes for Ethernet
3368   and IPv6 networks.)
3369
3370``max-udp-size``
3371   This sets the maximum EDNS UDP message size that ``named`` sends in bytes.
3372   Valid values are 512 to 4096; values outside this range are
3373   silently adjusted to the nearest value within it. The default value
3374   is 4096.
3375
3376   This value applies to responses sent by a server; to set the
3377   advertised buffer size in queries, see ``edns-udp-size``.
3378
3379   The usual reason for setting ``max-udp-size`` to a non-default value
3380   is to get UDP answers to pass through broken firewalls that block
3381   fragmented packets and/or block UDP packets that are greater than 512
3382   bytes. This is independent of the advertised receive buffer
3383   (``edns-udp-size``).
3384
3385   Setting this to a low value encourages additional TCP traffic to
3386   the name server.
3387
3388``masterfile-format``
3389   This specifies the file format of zone files (see :ref:`zonefile_format`).
3390   The default value is ``text``, which
3391   is the standard textual representation, except for secondary zones, in
3392   which the default value is ``raw``. Files in formats other than
3393   ``text`` are typically expected to be generated by the
3394   ``named-compilezone`` tool, or dumped by ``named``.
3395
3396   Note that when a zone file in a format other than ``text`` is
3397   loaded, ``named`` may omit some of the checks which are
3398   performed for a file in the ``text`` format. In particular,
3399   ``check-names`` checks do not apply for the ``raw`` format. This
3400   means a zone file in the ``raw`` format must be generated with the
3401   same check level as that specified in the ``named`` configuration
3402   file. Also, ``map`` format files are loaded directly into memory via
3403   memory mapping, with only minimal checking.
3404
3405   This statement sets the ``masterfile-format`` for all zones, but can
3406   be overridden on a per-zone or per-view basis by including a
3407   ``masterfile-format`` statement within the ``zone`` or ``view`` block
3408   in the configuration file.
3409
3410``masterfile-style``
3411   This specifies the formatting of zone files during dump when the
3412   ``masterfile-format`` is ``text``. This option is ignored with any
3413   other ``masterfile-format``.
3414
3415   When set to ``relative``, records are printed in a multi-line format,
3416   with owner names expressed relative to a shared origin. When set to
3417   ``full``, records are printed in a single-line format with absolute
3418   owner names. The ``full`` format is most suitable when a zone file
3419   needs to be processed automatically by a script. The ``relative``
3420   format is more human-readable, and is thus suitable when a zone is to
3421   be edited by hand. The default is ``relative``.
3422
3423``max-recursion-depth``
3424   This sets the maximum number of levels of recursion that are permitted at
3425   any one time while servicing a recursive query. Resolving a name may
3426   require looking up a name server address, which in turn requires
3427   resolving another name, etc.; if the number of recursion exceeds
3428   this value, the recursive query is terminated and returns SERVFAIL.
3429   The default is 7.
3430
3431``max-recursion-queries``
3432   This sets the maximum number of iterative queries that may be sent while
3433   servicing a recursive query. If more queries are sent, the recursive
3434   query is terminated and returns SERVFAIL. The default is 75.
3435
3436``notify-delay``
3437   This sets the delay, in seconds, between sending sets of notify messages for a
3438   zone. The default is 5 seconds.
3439
3440   The overall rate that NOTIFY messages are sent for all zones is
3441   controlled by ``serial-query-rate``.
3442
3443``max-rsa-exponent-size``
3444   This sets the maximum RSA exponent size, in bits, that is accepted when
3445   validating. Valid values are 35 to 4096 bits. The default, zero, is
3446   also accepted and is equivalent to 4096.
3447
3448``prefetch``
3449   When a query is received for cached data which is to expire shortly,
3450   ``named`` can refresh the data from the authoritative server
3451   immediately, ensuring that the cache always has an answer available.
3452
3453   The ``prefetch`` specifies the "trigger" TTL value at which prefetch
3454   of the current query takes place; when a cache record with a
3455   lower TTL value is encountered during query processing, it is
3456   refreshed. Valid trigger TTL values are 1 to 10 seconds. Values
3457   larger than 10 seconds are silently reduced to 10. Setting a
3458   trigger TTL to zero causes prefetch to be disabled. The default
3459   trigger TTL is ``2``.
3460
3461   An optional second argument specifies the "eligibility" TTL: the
3462   smallest *original* TTL value that is accepted for a record to
3463   be eligible for prefetching. The eligibility TTL must be at least six
3464   seconds longer than the trigger TTL; if not, ``named``
3465   silently adjusts it upward. The default eligibility TTL is ``9``.
3466
3467``v6-bias``
3468   When determining the next name server to try, this indicates by how many
3469   milliseconds to prefer IPv6 name servers. The default is ``50``
3470   milliseconds.
3471
3472.. _builtin:
3473
3474Built-in Server Information Zones
3475^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3476
3477The server provides some helpful diagnostic information through a number
3478of built-in zones under the pseudo-top-level-domain ``bind`` in the
3479``CHAOS`` class. These zones are part of a built-in view
3480(see :ref:`view_statement_grammar`) of class ``CHAOS`` which is
3481separate from the default view of class ``IN``. Most global
3482configuration options (``allow-query``, etc.) apply to this view,
3483but some are locally overridden: ``notify``, ``recursion``, and
3484``allow-new-zones`` are always set to ``no``, and ``rate-limit`` is set
3485to allow three responses per second.
3486
3487To disable these zones, use the options below or hide the
3488built-in ``CHAOS`` view by defining an explicit view of class ``CHAOS``
3489that matches all clients.
3490
3491``version``
3492   This is the version the server should report via a query of the name
3493   ``version.bind`` with type ``TXT`` and class ``CHAOS``. The default is
3494   the real version number of this server. Specifying ``version none``
3495   disables processing of the queries.
3496
3497   Setting ``version`` to any value (including ``none``) also disables
3498   queries for ``authors.bind TXT CH``.
3499
3500``hostname``
3501   This is the hostname the server should report via a query of the name
3502   ``hostname.bind`` with type ``TXT`` and class ``CHAOS``. This defaults
3503   to the hostname of the machine hosting the name server, as found by
3504   the gethostname() function. The primary purpose of such queries is to
3505   identify which of a group of anycast servers is actually answering
3506   the queries. Specifying ``hostname none;`` disables processing of
3507   the queries.
3508
3509``server-id``
3510   This is the ID the server should report when receiving a Name Server
3511   Identifier (NSID) query, or a query of the name ``ID.SERVER`` with
3512   type ``TXT`` and class ``CHAOS``. The primary purpose of such queries is
3513   to identify which of a group of anycast servers is actually answering
3514   the queries. Specifying ``server-id none;`` disables processing of
3515   the queries. Specifying ``server-id hostname;`` causes ``named``
3516   to use the hostname as found by the gethostname() function. The
3517   default ``server-id`` is ``none``.
3518
3519.. _empty:
3520
3521Built-in Empty Zones
3522^^^^^^^^^^^^^^^^^^^^
3523
3524The ``named`` server has some built-in empty zones, for SOA and NS records
3525only. These are for zones that should normally be answered locally and for
3526which queries should not be sent to the Internet's root servers. The
3527official servers that cover these namespaces return NXDOMAIN responses
3528to these queries. In particular, these cover the reverse namespaces for
3529addresses from :rfc:`1918`, :rfc:`4193`, :rfc:`5737`, and :rfc:`6598`. They also
3530include the reverse namespace for the IPv6 local address (locally assigned),
3531IPv6 link local addresses, the IPv6 loopback address, and the IPv6
3532unknown address.
3533
3534The server attempts to determine if a built-in zone already exists
3535or is active (covered by a forward-only forwarding declaration) and does
3536not create an empty zone in that case.
3537
3538The current list of empty zones is:
3539
3540-  10.IN-ADDR.ARPA
3541-  16.172.IN-ADDR.ARPA
3542-  17.172.IN-ADDR.ARPA
3543-  18.172.IN-ADDR.ARPA
3544-  19.172.IN-ADDR.ARPA
3545-  20.172.IN-ADDR.ARPA
3546-  21.172.IN-ADDR.ARPA
3547-  22.172.IN-ADDR.ARPA
3548-  23.172.IN-ADDR.ARPA
3549-  24.172.IN-ADDR.ARPA
3550-  25.172.IN-ADDR.ARPA
3551-  26.172.IN-ADDR.ARPA
3552-  27.172.IN-ADDR.ARPA
3553-  28.172.IN-ADDR.ARPA
3554-  29.172.IN-ADDR.ARPA
3555-  30.172.IN-ADDR.ARPA
3556-  31.172.IN-ADDR.ARPA
3557-  168.192.IN-ADDR.ARPA
3558-  64.100.IN-ADDR.ARPA
3559-  65.100.IN-ADDR.ARPA
3560-  66.100.IN-ADDR.ARPA
3561-  67.100.IN-ADDR.ARPA
3562-  68.100.IN-ADDR.ARPA
3563-  69.100.IN-ADDR.ARPA
3564-  70.100.IN-ADDR.ARPA
3565-  71.100.IN-ADDR.ARPA
3566-  72.100.IN-ADDR.ARPA
3567-  73.100.IN-ADDR.ARPA
3568-  74.100.IN-ADDR.ARPA
3569-  75.100.IN-ADDR.ARPA
3570-  76.100.IN-ADDR.ARPA
3571-  77.100.IN-ADDR.ARPA
3572-  78.100.IN-ADDR.ARPA
3573-  79.100.IN-ADDR.ARPA
3574-  80.100.IN-ADDR.ARPA
3575-  81.100.IN-ADDR.ARPA
3576-  82.100.IN-ADDR.ARPA
3577-  83.100.IN-ADDR.ARPA
3578-  84.100.IN-ADDR.ARPA
3579-  85.100.IN-ADDR.ARPA
3580-  86.100.IN-ADDR.ARPA
3581-  87.100.IN-ADDR.ARPA
3582-  88.100.IN-ADDR.ARPA
3583-  89.100.IN-ADDR.ARPA
3584-  90.100.IN-ADDR.ARPA
3585-  91.100.IN-ADDR.ARPA
3586-  92.100.IN-ADDR.ARPA
3587-  93.100.IN-ADDR.ARPA
3588-  94.100.IN-ADDR.ARPA
3589-  95.100.IN-ADDR.ARPA
3590-  96.100.IN-ADDR.ARPA
3591-  97.100.IN-ADDR.ARPA
3592-  98.100.IN-ADDR.ARPA
3593-  99.100.IN-ADDR.ARPA
3594-  100.100.IN-ADDR.ARPA
3595-  101.100.IN-ADDR.ARPA
3596-  102.100.IN-ADDR.ARPA
3597-  103.100.IN-ADDR.ARPA
3598-  104.100.IN-ADDR.ARPA
3599-  105.100.IN-ADDR.ARPA
3600-  106.100.IN-ADDR.ARPA
3601-  107.100.IN-ADDR.ARPA
3602-  108.100.IN-ADDR.ARPA
3603-  109.100.IN-ADDR.ARPA
3604-  110.100.IN-ADDR.ARPA
3605-  111.100.IN-ADDR.ARPA
3606-  112.100.IN-ADDR.ARPA
3607-  113.100.IN-ADDR.ARPA
3608-  114.100.IN-ADDR.ARPA
3609-  115.100.IN-ADDR.ARPA
3610-  116.100.IN-ADDR.ARPA
3611-  117.100.IN-ADDR.ARPA
3612-  118.100.IN-ADDR.ARPA
3613-  119.100.IN-ADDR.ARPA
3614-  120.100.IN-ADDR.ARPA
3615-  121.100.IN-ADDR.ARPA
3616-  122.100.IN-ADDR.ARPA
3617-  123.100.IN-ADDR.ARPA
3618-  124.100.IN-ADDR.ARPA
3619-  125.100.IN-ADDR.ARPA
3620-  126.100.IN-ADDR.ARPA
3621-  127.100.IN-ADDR.ARPA
3622-  0.IN-ADDR.ARPA
3623-  127.IN-ADDR.ARPA
3624-  254.169.IN-ADDR.ARPA
3625-  2.0.192.IN-ADDR.ARPA
3626-  100.51.198.IN-ADDR.ARPA
3627-  113.0.203.IN-ADDR.ARPA
3628-  255.255.255.255.IN-ADDR.ARPA
3629-  0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
3630-  1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
3631-  8.B.D.0.1.0.0.2.IP6.ARPA
3632-  D.F.IP6.ARPA
3633-  8.E.F.IP6.ARPA
3634-  9.E.F.IP6.ARPA
3635-  A.E.F.IP6.ARPA
3636-  B.E.F.IP6.ARPA
3637-  EMPTY.AS112.ARPA
3638-  HOME.ARPA
3639
3640Empty zones can be set at the view level and only apply to views of
3641class IN. Disabled empty zones are only inherited from options if there
3642are no disabled empty zones specified at the view level. To override the
3643options list of disabled zones, disable the root zone at the
3644view level. For example:
3645
3646::
3647
3648           disable-empty-zone ".";
3649
3650If using the address ranges covered here,
3651reverse zones covering the addresses should already be in place. In practice this
3652appears to not be the case, with many queries being made to the
3653infrastructure servers for names in these spaces. So many, in fact, that
3654sacrificial servers had to be deployed to channel the query load
3655away from the infrastructure servers.
3656
3657.. note::
3658
3659   The real parent servers for these zones should disable all empty zones
3660   under the parent zone they serve. For the real root servers, this is
3661   all built-in empty zones. This enables them to return referrals
3662   to deeper in the tree.
3663
3664``empty-server``
3665   This specifies the server name that appears in the returned SOA record for
3666   empty zones. If none is specified, the zone's name is used.
3667
3668``empty-contact``
3669   This specifies the contact name that appears in the returned SOA record for
3670   empty zones. If none is specified, "." is used.
3671
3672``empty-zones-enable``
3673   This enables or disables all empty zones. By default, they are enabled.
3674
3675``disable-empty-zone``
3676   This disables individual empty zones. By default, none are disabled. This
3677   option can be specified multiple times.
3678
3679.. _content_filtering:
3680
3681Content Filtering
3682^^^^^^^^^^^^^^^^^
3683
3684BIND 9 provides the ability to filter out DNS responses from external
3685DNS servers containing certain types of data in the answer section.
3686Specifically, it can reject address (A or AAAA) records if the
3687corresponding IPv4 or IPv6 addresses match the given
3688``address_match_list`` of the ``deny-answer-addresses`` option. It can
3689also reject CNAME or DNAME records if the "alias" name (i.e., the CNAME
3690alias or the substituted query name due to DNAME) matches the given
3691``namelist`` of the ``deny-answer-aliases`` option, where "match" means
3692the alias name is a subdomain of one of the ``name_list`` elements. If
3693the optional ``namelist`` is specified with ``except-from``, records
3694whose query name matches the list are accepted regardless of the
3695filter setting. Likewise, if the alias name is a subdomain of the
3696corresponding zone, the ``deny-answer-aliases`` filter does not apply;
3697for example, even if "example.com" is specified for
3698``deny-answer-aliases``,
3699
3700::
3701
3702   www.example.com. CNAME xxx.example.com.
3703
3704returned by an "example.com" server will be accepted.
3705
3706In the ``address_match_list`` of the ``deny-answer-addresses`` option,
3707only ``ip_addr`` and ``ip_prefix`` are meaningful; any ``key_id`` is
3708silently ignored.
3709
3710If a response message is rejected due to the filtering, the entire
3711message is discarded without being cached, and a SERVFAIL error is
3712returned to the client.
3713
3714This filtering is intended to prevent "DNS rebinding attacks," in which
3715an attacker, in response to a query for a domain name the attacker
3716controls, returns an IP address within the user's own network or an alias name
3717within the user's own domain. A naive web browser or script could then serve
3718as an unintended proxy, allowing the attacker to get access to an
3719internal node of the local network that could not be externally accessed
3720otherwise. See the paper available at
3721https://dl.acm.org/doi/10.1145/1315245.1315298 for more details
3722about the attacks.
3723
3724For example, with a domain named "example.net" and an internal
3725network using an IPv4 prefix 192.0.2.0/24, an administrator might specify the
3726following rules:
3727
3728::
3729
3730   deny-answer-addresses { 192.0.2.0/24; } except-from { "example.net"; };
3731   deny-answer-aliases { "example.net"; };
3732
3733If an external attacker let a web browser in the local network look up
3734an IPv4 address of "attacker.example.com", the attacker's DNS server
3735would return a response like this:
3736
3737::
3738
3739   attacker.example.com. A 192.0.2.1
3740
3741in the answer section. Since the rdata of this record (the IPv4 address)
3742matches the specified prefix 192.0.2.0/24, this response would be
3743ignored.
3744
3745On the other hand, if the browser looked up a legitimate internal web
3746server "www.example.net" and the following response were returned to the
3747BIND 9 server:
3748
3749::
3750
3751   www.example.net. A 192.0.2.2
3752
3753it would be accepted, since the owner name "www.example.net" matches the
3754``except-from`` element, "example.net".
3755
3756Note that this is not really an attack on the DNS per se. In fact, there
3757is nothing wrong with having an "external" name mapped to an "internal"
3758IP address or domain name from the DNS point of view; it might actually
3759be provided for a legitimate purpose, such as for debugging. As long as
3760the mapping is provided by the correct owner, it either is not possible or does
3761not make sense to detect whether the intent of the mapping is legitimate
3762within the DNS. The "rebinding" attack must primarily be
3763protected at the application that uses the DNS. For a large site,
3764however, it may be difficult to protect all possible applications at
3765once. This filtering feature is provided only to help such an
3766operational environment; it is generally discouraged to turn it on
3767unless there is no other choice and the attack is a
3768real threat to applications.
3769
3770Care should be particularly taken if using this option for
3771addresses within 127.0.0.0/8. These addresses are obviously "internal,"
3772but many applications conventionally rely on a DNS mapping from some
3773name to such an address. Filtering out DNS records containing this
3774address spuriously can break such applications.
3775
3776.. _rpz:
3777
3778Response Policy Zone (RPZ) Rewriting
3779^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3780
3781BIND 9 includes a limited mechanism to modify DNS responses for requests
3782analogous to email anti-spam DNS rejection lists. Responses can be changed to
3783deny the existence of domains (NXDOMAIN), deny the existence of IP
3784addresses for domains (NODATA), or contain other IP addresses or data.
3785
3786Response policy zones are named in the ``response-policy`` option for
3787the view, or among the global options if there is no response-policy
3788option for the view. Response policy zones are ordinary DNS zones
3789containing RRsets that can be queried normally if allowed. It is usually
3790best to restrict those queries with something like
3791``allow-query { localhost; };``. Note that zones using
3792``masterfile-format map`` cannot be used as policy zones.
3793
3794A ``response-policy`` option can support multiple policy zones. To
3795maximize performance, a radix tree is used to quickly identify response
3796policy zones containing triggers that match the current query. This
3797imposes an upper limit of 64 on the number of policy zones in a single
3798``response-policy`` option; more than that is a configuration error.
3799
3800Rules encoded in response policy zones are processed after those defined in
3801:ref:`access_control`. All queries from clients which are not permitted access
3802to the resolver are answered with a status code of REFUSED, regardless of
3803configured RPZ rules.
3804
3805Five policy triggers can be encoded in RPZ records.
3806
3807``RPZ-CLIENT-IP``
3808   IP records are triggered by the IP address of the DNS client. Client
3809   IP address triggers are encoded in records that have owner names that
3810   are subdomains of ``rpz-client-ip`` relativized to the policy zone
3811   origin name, and that encode an address or address block. IPv4 addresses
3812   are represented as ``prefixlength.B4.B3.B2.B1.rpz-client-ip``. The
3813   IPv4 prefix length must be between 1 and 32. All four bytes - B4, B3,
3814   B2, and B1 - must be present. B4 is the decimal value of the least
3815   significant byte of the IPv4 address as in IN-ADDR.ARPA.
3816
3817   IPv6 addresses are encoded in a format similar to the standard IPv6
3818   text representation,
3819   ``prefixlength.W8.W7.W6.W5.W4.W3.W2.W1.rpz-client-ip``. Each of
3820   W8,...,W1 is a one- to four-digit hexadecimal number representing 16
3821   bits of the IPv6 address as in the standard text representation of
3822   IPv6 addresses, but reversed as in IP6.ARPA. (Note that this
3823   representation of IPv6 addresses is different from IP6.ARPA, where each
3824   hex digit occupies a label.) All 8 words must be present except when
3825   one set of consecutive zero words is replaced with ``.zz.``, analogous
3826   to double colons (::) in standard IPv6 text encodings. The IPv6
3827   prefix length must be between 1 and 128.
3828
3829``QNAME``
3830   QNAME policy records are triggered by query names of requests and
3831   targets of CNAME records resolved to generate the response. The owner
3832   name of a QNAME policy record is the query name relativized to the
3833   policy zone.
3834
3835``RPZ-IP``
3836   IP triggers are IP addresses in an A or AAAA record in the ANSWER
3837   section of a response. They are encoded like client-IP triggers
3838   except as subdomains of ``rpz-ip``.
3839
3840``RPZ-NSDNAME``
3841   NSDNAME triggers match names of authoritative servers for the query name, a
3842   parent of the query name, a CNAME for query name, or a parent of a CNAME.
3843   They are encoded as subdomains of ``rpz-nsdname`` relativized
3844   to the RPZ origin name.  NSIP triggers match IP addresses in A and AAAA
3845   RRsets for domains that can be checked against NSDNAME policy records. The
3846   ``nsdname-enable`` phrase turns NSDNAME triggers off or on for a single
3847   policy zone or for all zones.
3848
3849   If authoritative name servers for the query name are not yet known, ``named``
3850   recursively looks up the authoritative servers for the query name before
3851   applying an RPZ-NSDNAME rule.  This can cause a processing delay. To speed up
3852   processing at the cost of precision, the ``nsdname-wait-recurse`` option can
3853   be used; when set to ``no``, RPZ-NSDNAME rules are only applied when
3854   authoritative servers for the query name have already been looked up and
3855   cached.  If authoritative servers for the query name are not in the cache,
3856   the RPZ-NSDNAME rule is ignored, but the authoritative servers for
3857   the query name are looked up in the background and the rule is
3858   applied to subsequent queries. The default is ``yes``,
3859   meaning RPZ-NSDNAME rules are always applied even if authoritative
3860   servers for the query name need to be looked up first.
3861
3862``RPZ-NSIP``
3863   NSIP triggers match the IP addresses of authoritative servers. They
3864   are encoded like IP triggers, except as subdomains of ``rpz-nsip``.
3865   NSDNAME and NSIP triggers are checked only for names with at least
3866   ``min-ns-dots`` dots. The default value of ``min-ns-dots`` is 1, to
3867   exclude top-level domains. The ``nsip-enable`` phrase turns NSIP
3868   triggers off or on for a single policy zone or for all zones.
3869
3870   If a name server's IP address is not yet known, ``named``
3871   recursively looks up the IP address before applying an RPZ-NSIP rule.
3872   This can cause a processing delay. To speed up processing at the cost
3873   of precision, the ``nsip-wait-recurse`` option can be used; when set
3874   to ``no``, RPZ-NSIP rules are only applied when a name server's
3875   IP address has already been looked up and cached. If a server's IP
3876   address is not in the cache, the RPZ-NSIP rule is ignored,
3877   but the address is looked up in the background and the rule
3878   is applied to subsequent queries. The default is ``yes``,
3879   meaning RPZ-NSIP rules are always applied even if an address
3880   needs to be looked up first.
3881
3882The query response is checked against all response policy zones, so two
3883or more policy records can be triggered by a response. Because DNS
3884responses are rewritten according to at most one policy record, a single
3885record encoding an action (other than ``DISABLED`` actions) must be
3886chosen. Triggers, or the records that encode them, are chosen for
3887rewriting in the following order:
3888
38891. Choose the triggered record in the zone that appears first in the
3890   response-policy option.
38912. Prefer CLIENT-IP to QNAME to IP to NSDNAME to NSIP triggers in a
3892   single zone.
38933. Among NSDNAME triggers, prefer the trigger that matches the smallest
3894   name under the DNSSEC ordering.
38954. Among IP or NSIP triggers, prefer the trigger with the longest
3896   prefix.
38975. Among triggers with the same prefix length, prefer the IP or NSIP
3898   trigger that matches the smallest IP address.
3899
3900When the processing of a response is restarted to resolve DNAME or CNAME
3901records and a policy record set has not been triggered, all response
3902policy zones are again consulted for the DNAME or CNAME names and
3903addresses.
3904
3905RPZ record sets are any types of DNS record, except DNAME or DNSSEC, that
3906encode actions or responses to individual queries. Any of the policies
3907can be used with any of the triggers. For example, while the
3908``TCP-only`` policy is commonly used with ``client-IP`` triggers, it can
3909be used with any type of trigger to force the use of TCP for responses
3910with owner names in a zone.
3911
3912``PASSTHRU``
3913   The policy is specified by a CNAME whose target is
3914   ``rpz-passthru``. It causes the response to not be rewritten and is
3915   most often used to "poke holes" in policies for CIDR blocks.
3916
3917``DROP``
3918   The policy is specified by a CNAME whose target is
3919   ``rpz-drop``. It causes the response to be discarded. Nothing is sent
3920   to the DNS client.
3921
3922``TCP-Only``
3923   The "slip" policy is specified by a CNAME whose target is
3924   ``rpz-tcp-only``. It changes UDP responses to short, truncated DNS
3925   responses that require the DNS client to try again with TCP. It is
3926   used to mitigate distributed DNS reflection attacks.
3927
3928``NXDOMAIN``
3929   The domain undefined response is encoded by a CNAME whose target is
3930   the root domain (.).
3931
3932``NODATA``
3933   The empty set of resource records is specified by a CNAME whose target
3934   is the wildcard top-level domain (``*.``). It rewrites the response to
3935   NODATA or ANCOUNT=0.
3936
3937``Local Data``
3938   A set of ordinary DNS records can be used to answer queries. Queries
3939   for record types not in the set are answered with NODATA.
3940
3941   A special form of local data is a CNAME whose target is a wildcard
3942   such as \*.example.com. It is used as if an ordinary CNAME after
3943   the asterisk (\*) has been replaced with the query name.
3944   This special form is useful for query logging in the walled garden's
3945   authoritative DNS server.
3946
3947All of the actions specified in all of the individual records in a
3948policy zone can be overridden with a ``policy`` clause in the
3949``response-policy`` option. An organization using a policy zone provided
3950by another organization might use this mechanism to redirect domains to
3951its own walled garden.
3952
3953``GIVEN``
3954   The placeholder policy says "do not override but perform the action
3955   specified in the zone."
3956
3957``DISABLED``
3958   The testing override policy causes policy zone records to do nothing
3959   but log what they would have done if the policy zone were not
3960   disabled. The response to the DNS query is written (or not)
3961   according to any triggered policy records that are not disabled.
3962   Disabled policy zones should appear first, because they are often
3963   not logged if a higher-precedence trigger is found first.
3964
3965``PASSTHRU``; \ ``DROP``; \ ``TCP-Only``; \ ``NXDOMAIN``; \ ``NODATA``
3966   These settings each override the corresponding per-record policy.
3967
3968``CNAME domain``
3969   This causes all RPZ policy records to act as if they were "cname domain"
3970   records.
3971
3972By default, the actions encoded in a response policy zone are applied
3973only to queries that ask for recursion (RD=1). That default can be
3974changed for a single policy zone, or for all response policy zones in a view,
3975with a ``recursive-only no`` clause. This feature is useful for serving
3976the same zone files both inside and outside an :rfc:`1918` cloud and using
3977RPZ to delete answers that would otherwise contain :rfc:`1918` values on
3978the externally visible name server or view.
3979
3980Also by default, RPZ actions are applied only to DNS requests that
3981either do not request DNSSEC metadata (DO=0) or when no DNSSEC records
3982are available for the requested name in the original zone (not the response
3983policy zone). This default can be changed for all response policy zones
3984in a view with a ``break-dnssec yes`` clause. In that case, RPZ actions
3985are applied regardless of DNSSEC. The name of the clause option reflects
3986the fact that results rewritten by RPZ actions cannot verify.
3987
3988No DNS records are needed for a QNAME or Client-IP trigger; the name or
3989IP address itself is sufficient, so in principle the query name need not
3990be recursively resolved. However, not resolving the requested name can
3991leak the fact that response policy rewriting is in use, and that the name
3992is listed in a policy zone, to operators of servers for listed names. To
3993prevent that information leak, by default any recursion needed for a
3994request is done before any policy triggers are considered. Because
3995listed domains often have slow authoritative servers, this behavior can
3996cost significant time. The ``qname-wait-recurse yes`` option overrides
3997the default and enables that behavior when recursion cannot change a
3998non-error response. The option does not affect QNAME or client-IP
3999triggers in policy zones listed after other zones containing IP, NSIP,
4000and NSDNAME triggers, because those may depend on the A, AAAA, and NS
4001records that would be found during recursive resolution. It also does
4002not affect DNSSEC requests (DO=1) unless ``break-dnssec yes`` is in use,
4003because the response would depend on whether RRSIG records were
4004found during resolution. Using this option can cause error responses
4005such as SERVFAIL to appear to be rewritten, since no recursion is being
4006done to discover problems at the authoritative server.
4007
4008The ``dnsrps-enable yes`` option turns on the DNS Response Policy Service
4009(DNSRPS) interface, if it has been compiled in ``named`` using
4010``configure --enable-dnsrps``.
4011
4012The ``dnsrps-options`` block provides additional RPZ configuration
4013settings, which are passed through to the DNSRPS provider library.
4014Multiple DNSRPS settings in an ``dnsrps-options`` string should be
4015separated with semi-colons. The DNSRPS provider, librpz, is passed a
4016configuration string consisting of the ``dnsrps-options`` text,
4017concatenated with settings derived from the ``response-policy``
4018statement.
4019
4020Note: The ``dnsrps-options`` text should only include configuration
4021settings that are specific to the DNSRPS provider. For example, the
4022DNSRPS provider from Farsight Security takes options such as
4023``dnsrpzd-conf``, ``dnsrpzd-sock``, and ``dnzrpzd-args`` (for details of
4024these options, see the ``librpz`` documentation). Other RPZ
4025configuration settings could be included in ``dnsrps-options`` as well,
4026but if ``named`` were switched back to traditional RPZ by setting
4027``dnsrps-enable`` to "no", those options would be ignored.
4028
4029The TTL of a record modified by RPZ policies is set from the TTL of the
4030relevant record in the policy zone. It is then limited to a maximum value.
4031The ``max-policy-ttl`` clause changes the maximum seconds from its
4032default of 5. For convenience, TTL-style time unit suffixes may be used
4033to specify the value. It also accepts ISO 8601 duration formats.
4034
4035For example, an administrator might use this option statement:
4036
4037::
4038
4039       response-policy { zone "badlist"; };
4040
4041and this zone statement:
4042
4043::
4044
4045       zone "badlist" {type master; file "master/badlist"; allow-query {none;}; };
4046
4047with this zone file:
4048
4049::
4050
4051   $TTL 1H
4052   @                       SOA LOCALHOST. named-mgr.example.com (1 1h 15m 30d 2h)
4053               NS  LOCALHOST.
4054
4055   ; QNAME policy records.  There are no periods (.) after the owner names.
4056   nxdomain.domain.com     CNAME   .               ; NXDOMAIN policy
4057   *.nxdomain.domain.com   CNAME   .               ; NXDOMAIN policy
4058   nodata.domain.com       CNAME   *.              ; NODATA policy
4059   *.nodata.domain.com     CNAME   *.              ; NODATA policy
4060   bad.domain.com          A       10.0.0.1        ; redirect to a walled garden
4061               AAAA    2001:2::1
4062   bzone.domain.com        CNAME   garden.example.com.
4063
4064   ; do not rewrite (PASSTHRU) OK.DOMAIN.COM
4065   ok.domain.com           CNAME   rpz-passthru.
4066
4067   ; redirect x.bzone.domain.com to x.bzone.domain.com.garden.example.com
4068   *.bzone.domain.com      CNAME   *.garden.example.com.
4069
4070   ; IP policy records that rewrite all responses containing A records in 127/8
4071   ;       except 127.0.0.1
4072   8.0.0.0.127.rpz-ip      CNAME   .
4073   32.1.0.0.127.rpz-ip     CNAME   rpz-passthru.
4074
4075   ; NSDNAME and NSIP policy records
4076   ns.domain.com.rpz-nsdname   CNAME   .
4077   48.zz.2.2001.rpz-nsip       CNAME   .
4078
4079   ; disapprove and approve some DNS clients
4080   112.zz.2001.rpz-client-ip    CNAME   rpz-drop.
4081   8.0.0.0.127.rpz-client-ip    CNAME   rpz-drop.
4082
4083   ; force some DNS clients and responses in the example.com zone to TCP
4084   16.0.0.1.10.rpz-client-ip   CNAME   rpz-tcp-only.
4085   example.com                 CNAME   rpz-tcp-only.
4086   *.example.com               CNAME   rpz-tcp-only.
4087
4088RPZ can affect server performance. Each configured response policy zone
4089requires the server to perform one to four additional database lookups
4090before a query can be answered. For example, a DNS server with four
4091policy zones, each with all four kinds of response triggers (QNAME, IP,
4092NSIP, and NSDNAME), requires a total of 17 times as many database lookups
4093as a similar DNS server with no response policy zones. A BIND 9 server
4094with adequate memory and one response policy zone with QNAME and IP
4095triggers might achieve a maximum queries-per-second rate about 20%
4096lower. A server with four response policy zones with QNAME and IP
4097triggers might have a maximum QPS rate about 50% lower.
4098
4099Responses rewritten by RPZ are counted in the ``RPZRewrites``
4100statistics.
4101
4102The ``log`` clause can be used to optionally turn off rewrite logging
4103for a particular response policy zone. By default, all rewrites are
4104logged.
4105
4106The ``add-soa`` option controls whether the RPZ's SOA record is added to
4107the section for traceback of changes from this zone.
4108This can be set at the individual policy zone level or at the
4109response-policy level. The default is ``yes``.
4110
4111Updates to RPZ zones are processed asynchronously; if there is more than
4112one update pending they are bundled together. If an update to a RPZ zone
4113(for example, via IXFR) happens less than ``min-update-interval``
4114seconds after the most recent update, the changes are not
4115carried out until this interval has elapsed. The default is ``60``
4116seconds. For convenience, TTL-style time unit suffixes may be used to
4117specify the value. It also accepts ISO 8601 duration formats.
4118
4119.. _rrl:
4120
4121Response Rate Limiting
4122^^^^^^^^^^^^^^^^^^^^^^
4123
4124Excessive almost-identical UDP *responses* can be controlled by
4125configuring a ``rate-limit`` clause in an ``options`` or ``view``
4126statement. This mechanism keeps authoritative BIND 9 from being used in
4127amplifying reflection denial-of-service (DoS) attacks. Short, truncated
4128(TC=1) responses can be sent to provide rate-limited responses to
4129legitimate clients within a range of forged, attacked IP addresses.
4130Legitimate clients react to dropped or truncated response by retrying
4131with UDP or with TCP respectively.
4132
4133This mechanism is intended for authoritative DNS servers. It can be used
4134on recursive servers, but can slow applications such as SMTP servers
4135(mail receivers) and HTTP clients (web browsers) that repeatedly request
4136the same domains. When possible, closing "open" recursive servers is
4137better.
4138
4139Response rate limiting uses a "credit" or "token bucket" scheme. Each
4140combination of identical response and client has a conceptual account
4141that earns a specified number of credits every second. A prospective
4142response debits its account by one. Responses are dropped or truncated
4143while the account is negative. Responses are tracked within a rolling
4144window of time which defaults to 15 seconds, but can be configured with
4145the ``window`` option to any value from 1 to 3600 seconds (1 hour). The
4146account cannot become more positive than the per-second limit or more
4147negative than ``window`` times the per-second limit. When the specified
4148number of credits for a class of responses is set to 0, those responses
4149are not rate-limited.
4150
4151The notions of "identical response" and "DNS client" for rate-limiting
4152are not simplistic. All responses to an address block are counted as if
4153to a single client. The prefix lengths of addresses blocks are specified
4154with ``ipv4-prefix-length`` (default 24) and ``ipv6-prefix-length``
4155(default 56).
4156
4157All non-empty responses for a valid domain name (qname) and record type
4158(qtype) are identical and have a limit specified with
4159``responses-per-second`` (default 0 or no limit). All empty (NODATA)
4160responses for a valid domain, regardless of query type, are identical.
4161Responses in the NODATA class are limited by ``nodata-per-second``
4162(default ``responses-per-second``). Requests for any and all undefined
4163subdomains of a given valid domain result in NXDOMAIN errors, and are
4164identical regardless of query type. They are limited by
4165``nxdomains-per-second`` (default ``responses-per-second``). This
4166controls some attacks using random names, but can be relaxed or turned
4167off (set to 0) on servers that expect many legitimate NXDOMAIN
4168responses, such as from anti-spam rejection lists. Referrals or delegations
4169to the server of a given domain are identical and are limited by
4170``referrals-per-second`` (default ``responses-per-second``).
4171
4172Responses generated from local wildcards are counted and limited as if
4173they were for the parent domain name. This controls flooding using
4174random.wild.example.com.
4175
4176All requests that result in DNS errors other than NXDOMAIN, such as
4177SERVFAIL and FORMERR, are identical regardless of requested name (qname)
4178or record type (qtype). This controls attacks using invalid requests or
4179distant, broken, authoritative servers. By default the limit on errors is
4180the same as the ``responses-per-second`` value, but it can be set
4181separately with ``errors-per-second``.
4182
4183Many attacks using DNS involve UDP requests with forged source
4184addresses. Rate-limiting prevents the use of BIND 9 to flood a network
4185with responses to requests with forged source addresses, but could let a
4186third party block responses to legitimate requests. There is a mechanism
4187that can answer some legitimate requests from a client whose address is
4188being forged in a flood. Setting ``slip`` to 2 (its default) causes
4189every other UDP request to be answered with a small truncated (TC=1)
4190response. The small size and reduced frequency, and so lack of
4191amplification, of "slipped" responses make them unattractive for
4192reflection DoS attacks. ``slip`` must be between 0 and 10. A value of 0
4193does not "slip"; no truncated responses are sent due to rate-limiting, rather,
4194all responses are dropped. A value of 1 causes every response to slip;
4195values between 2 and 10 cause every nth response to slip. Some error
4196responses, including REFUSED and SERVFAIL, cannot be replaced with
4197truncated responses and are instead leaked at the ``slip`` rate.
4198
4199(NOTE: Dropped responses from an authoritative server may reduce the
4200difficulty of a third party successfully forging a response to a
4201recursive resolver. The best security against forged responses is for
4202authoritative operators to sign their zones using DNSSEC and for
4203resolver operators to validate the responses. When this is not an
4204option, operators who are more concerned with response integrity than
4205with flood mitigation may consider setting ``slip`` to 1, causing all
4206rate-limited responses to be truncated rather than dropped. This reduces
4207the effectiveness of rate-limiting against reflection attacks.)
4208
4209When the approximate query-per-second rate exceeds the ``qps-scale``
4210value, the ``responses-per-second``, ``errors-per-second``,
4211``nxdomains-per-second``, and ``all-per-second`` values are reduced by
4212the ratio of the current rate to the ``qps-scale`` value. This feature
4213can tighten defenses during attacks. For example, with
4214``qps-scale 250; responses-per-second 20;`` and a total query rate of
42151000 queries/second for all queries from all DNS clients including via
4216TCP, then the effective responses/second limit changes to (250/1000)*20
4217or 5. Responses sent via TCP are not limited but are counted to compute
4218the query per second rate.
4219
4220Communities of DNS clients can be given their own parameters or no
4221rate-limiting by putting ``rate-limit`` statements in ``view`` statements
4222instead of the global ``option`` statement. A ``rate-limit`` statement
4223in a view replaces, rather than supplements, a ``rate-limit``
4224statement among the main options. DNS clients within a view can be
4225exempted from rate limits with the ``exempt-clients`` clause.
4226
4227UDP responses of all kinds can be limited with the ``all-per-second``
4228phrase. This rate-limiting is unlike the rate-limiting provided by
4229``responses-per-second``, ``errors-per-second``, and
4230``nxdomains-per-second`` on a DNS server, which are often invisible to
4231the victim of a DNS reflection attack. Unless the forged requests of the
4232attack are the same as the legitimate requests of the victim, the
4233victim's requests are not affected. Responses affected by an
4234``all-per-second`` limit are always dropped; the ``slip`` value has no
4235effect. An ``all-per-second`` limit should be at least 4 times as large
4236as the other limits, because single DNS clients often send bursts of
4237legitimate requests. For example, the receipt of a single mail message
4238can prompt requests from an SMTP server for NS, PTR, A, and AAAA records
4239as the incoming SMTP/TCP/IP connection is considered. The SMTP server
4240can need additional NS, A, AAAA, MX, TXT, and SPF records as it
4241considers the SMTP ``Mail From`` command. Web browsers often repeatedly
4242resolve the same names that are repeated in HTML <IMG> tags in a page.
4243``all-per-second`` is similar to the rate-limiting offered by firewalls
4244but often inferior. Attacks that justify ignoring the contents of DNS
4245responses are likely to be attacks on the DNS server itself. They
4246usually should be discarded before the DNS server spends resources making
4247TCP connections or parsing DNS requests, but that rate-limiting must be
4248done before the DNS server sees the requests.
4249
4250The maximum size of the table used to track requests and rate-limit
4251responses is set with ``max-table-size``. Each entry in the table is
4252between 40 and 80 bytes. The table needs approximately as many entries
4253as the number of requests received per second. The default is 20,000. To
4254reduce the cold start of growing the table, ``min-table-size`` (default
4255500) can set the minimum table size. Enable ``rate-limit`` category
4256logging to monitor expansions of the table and inform choices for the
4257initial and maximum table size.
4258
4259Use ``log-only yes`` to test rate-limiting parameters without actually
4260dropping any requests.
4261
4262Responses dropped by rate limits are included in the ``RateDropped`` and
4263``QryDropped`` statistics. Responses that are truncated by rate limits are
4264included in ``RateSlipped`` and ``RespTruncated``.
4265
4266``named`` supports NXDOMAIN redirection via two methods:
4267
4268-  Redirect zone (:ref:`zone_statement_grammar`)
4269-  Redirect namespace
4270
4271With either method, when ``named`` gets a NXDOMAIN response it examines a
4272separate namespace to see if the NXDOMAIN response should be replaced
4273with an alternative response.
4274
4275With a redirect zone (``zone "." { type redirect; };``), the data used
4276to replace the NXDOMAIN is held in a single zone which is not part of
4277the normal namespace. All the redirect information is contained in the
4278zone; there are no delegations.
4279
4280With a redirect namespace (``option { nxdomain-redirect <suffix> };``)
4281the data used to replace the NXDOMAIN is part of the normal namespace
4282and is looked up by appending the specified suffix to the original
4283query name. This roughly doubles the cache required to process
4284NXDOMAIN responses, as both the original NXDOMAIN response and the
4285replacement data (or an NXDOMAIN indicating that there is no
4286replacement) must be stored.
4287
4288If both a redirect zone and a redirect namespace are configured, the
4289redirect zone is tried first.
4290
4291.. _server_statement_grammar:
4292
4293``server`` Statement Grammar
4294~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4295
4296.. include:: ../misc/server.grammar.rst
4297
4298.. _server_statement_definition_and_usage:
4299
4300``server`` Statement Definition and Usage
4301~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4302
4303The ``server`` statement defines characteristics to be associated with a
4304remote name server. If a prefix length is specified, then a range of
4305servers is covered. Only the most specific server clause applies,
4306regardless of the order in ``named.conf``.
4307
4308The ``server`` statement can occur at the top level of the configuration
4309file or inside a ``view`` statement. If a ``view`` statement contains
4310one or more ``server`` statements, only those apply to the view and any
4311top-level ones are ignored. If a view contains no ``server`` statements,
4312any top-level ``server`` statements are used as defaults.
4313
4314If a remote server is giving out bad data, marking it
4315as bogus prevents further queries to it. The default value of
4316``bogus`` is ``no``.
4317
4318The ``provide-ixfr`` clause determines whether the local server, acting
4319as master, responds with an incremental zone transfer when the given
4320remote server, a secondary, requests it. If set to ``yes``, incremental
4321transfer is provided whenever possible. If set to ``no``, all
4322transfers to the remote server are non-incremental. If not set, the
4323value of the ``provide-ixfr`` option in the view or global options block
4324is used as a default.
4325
4326The ``request-ixfr`` clause determines whether the local server, acting
4327as a secondary, requests incremental zone transfers from the given
4328remote server, a primary. If not set, the value of the ``request-ixfr``
4329option in the view or global options block is used as a default. It may
4330also be set in the zone block; if set there, it overrides the
4331global or view setting for that zone.
4332
4333IXFR requests to servers that do not support IXFR automatically
4334fall back to AXFR. Therefore, there is no need to manually list which
4335servers support IXFR and which ones do not; the global default of
4336``yes`` should always work. The purpose of the ``provide-ixfr`` and
4337``request-ixfr`` clauses is to make it possible to disable the use of
4338IXFR even when both primary and secondary claim to support it: for example, if
4339one of the servers is buggy and crashes or corrupts data when IXFR is
4340used.
4341
4342The ``request-expire`` clause determines whether the local server, when
4343acting as a secondary, requests the EDNS EXPIRE value. The EDNS EXPIRE
4344value indicates the remaining time before the zone data expires and
4345needs to be refreshed. This is used when a secondary server transfers
4346a zone from another secondary server; when transferring from the
4347primary, the expiration timer is set from the EXPIRE field of the SOA
4348record instead. The default is ``yes``.
4349
4350The ``edns`` clause determines whether the local server attempts to
4351use EDNS when communicating with the remote server. The default is
4352``yes``.
4353
4354The ``edns-udp-size`` option sets the EDNS UDP size that is advertised
4355by ``named`` when querying the remote server. Valid values are 512 to
43564096 bytes; values outside this range are silently adjusted to the
4357nearest value within it. This option is useful when
4358advertising a different value to this server than the value advertised
4359globally: for example, when there is a firewall at the remote site that
4360is blocking large replies. (Note: Currently, this sets a single UDP size
4361for all packets sent to the server; ``named`` does not deviate from this
4362value. This differs from the behavior of ``edns-udp-size`` in
4363``options`` or ``view`` statements, where it specifies a maximum value.
4364The ``server`` statement behavior may be brought into conformance with
4365the ``options``/``view`` behavior in future releases.)
4366
4367The ``edns-version`` option sets the maximum EDNS VERSION that is
4368sent to the server(s) by the resolver. The actual EDNS version sent is
4369still subject to normal EDNS version negotiation rules (see :rfc:`6891`),
4370the maximum EDNS version supported by the server, and any other
4371heuristics that indicate that a lower version should be sent. This
4372option is intended to be used when a remote server reacts badly to a
4373given EDNS version or higher; it should be set to the highest version
4374the remote server is known to support. Valid values are 0 to 255; higher
4375values are silently adjusted. This option is not needed until
4376higher EDNS versions than 0 are in use.
4377
4378The ``max-udp-size`` option sets the maximum EDNS UDP message size
4379``named`` sends. Valid values are 512 to 4096 bytes; values outside
4380this range are silently adjusted. This option is useful when
4381there is a firewall that is blocking large replies from
4382``named``.
4383
4384The ``padding`` option adds EDNS Padding options to outgoing messages,
4385increasing the packet size to a multiple of the specified block size.
4386Valid block sizes range from 0 (the default, which disables the use of
4387EDNS Padding) to 512 bytes. Larger values are reduced to 512, with a
4388logged warning. Note: This option is not currently compatible with no
4389TSIG or SIG(0), as the EDNS OPT record containing the padding would have
4390to be added to the packet after it had already been signed.
4391
4392The ``tcp-only`` option sets the transport protocol to TCP. The default
4393is to use the UDP transport and to fallback on TCP only when a truncated
4394response is received.
4395
4396The ``tcp-keepalive`` option adds EDNS TCP keepalive to messages sent
4397over TCP. Note that currently idle timeouts in responses are ignored.
4398
4399The server supports two zone transfer methods. The first,
4400``one-answer``, uses one DNS message per resource record transferred.
4401``many-answers`` packs as many resource records as possible into a
4402message, which is more efficient.
4403It is possible to specify which method to use for a server via the
4404``transfer-format`` option; if not set there, the
4405``transfer-format`` specified by the ``options`` statement is used.
4406
4407``transfers`` is used to limit the number of concurrent inbound zone
4408transfers from the specified server. If no ``transfers`` clause is
4409specified, the limit is set according to the ``transfers-per-ns``
4410option.
4411
4412The ``keys`` clause identifies a ``key_id`` defined by the ``key``
4413statement, to be used for transaction security (see :ref:`tsig`)
4414when talking to the remote server. When a request is sent to the remote
4415server, a request signature is generated using the key specified
4416here and appended to the message. A request originating from the remote
4417server is not required to be signed by this key.
4418
4419Only a single key per server is currently supported.
4420
4421The ``transfer-source`` and ``transfer-source-v6`` clauses specify the
4422IPv4 and IPv6 source address to be used for zone transfer with the
4423remote server, respectively. For an IPv4 remote server, only
4424``transfer-source`` can be specified. Similarly, for an IPv6 remote
4425server, only ``transfer-source-v6`` can be specified. For more details,
4426see the description of ``transfer-source`` and ``transfer-source-v6`` in
4427:ref:`zone_transfers`.
4428
4429The ``notify-source`` and ``notify-source-v6`` clauses specify the IPv4
4430and IPv6 source address to be used for notify messages sent to remote
4431servers, respectively. For an IPv4 remote server, only ``notify-source``
4432can be specified. Similarly, for an IPv6 remote server, only
4433``notify-source-v6`` can be specified.
4434
4435The ``query-source`` and ``query-source-v6`` clauses specify the IPv4
4436and IPv6 source address to be used for queries sent to remote servers,
4437respectively. For an IPv4 remote server, only ``query-source`` can be
4438specified. Similarly, for an IPv6 remote server, only
4439``query-source-v6`` can be specified.
4440
4441The ``request-nsid`` clause determines whether the local server adds
4442a NSID EDNS option to requests sent to the server. This overrides
4443``request-nsid`` set at the view or option level.
4444
4445The ``send-cookie`` clause determines whether the local server adds
4446a COOKIE EDNS option to requests sent to the server. This overrides
4447``send-cookie`` set at the view or option level. The ``named`` server
4448may determine that COOKIE is not supported by the remote server and not
4449add a COOKIE EDNS option to requests.
4450
4451.. _statschannels:
4452
4453``statistics-channels`` Statement Grammar
4454~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4455
4456.. include:: ../misc/statistics-channels.grammar.rst
4457
4458.. _statistics_channels:
4459
4460``statistics-channels`` Statement Definition and Usage
4461~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4462
4463The ``statistics-channels`` statement declares communication channels to
4464be used by system administrators to get access to statistics information
4465of the name server.
4466
4467This statement is intended to be flexible to support multiple communication
4468protocols in the future, but currently only HTTP access is supported. It
4469requires that BIND 9 be compiled with libxml2 and/or json-c (also known
4470as libjson0); the ``statistics-channels`` statement is still accepted
4471even if it is built without the library, but any HTTP access fails
4472with an error.
4473
4474An ``inet`` control channel is a TCP socket listening at the specified
4475``ip_port`` on the specified ``ip_addr``, which can be an IPv4 or IPv6
4476address. An ``ip_addr`` of ``*`` (asterisk) is interpreted as the IPv4
4477wildcard address; connections are accepted on any of the system's
4478IPv4 addresses. To listen on the IPv6 wildcard address, use an
4479``ip_addr`` of ``::``.
4480
4481If no port is specified, port 80 is used for HTTP channels. The asterisk
4482(``*``) cannot be used for ``ip_port``.
4483
4484Attempts to open a statistics channel are restricted by the
4485optional ``allow`` clause. Connections to the statistics channel are
4486permitted based on the ``address_match_list``. If no ``allow`` clause is
4487present, ``named`` accepts connection attempts from any address; since
4488the statistics may contain sensitive internal information, it is highly
4489recommended to restrict the source of connection requests appropriately.
4490
4491If no ``statistics-channels`` statement is present, ``named`` does not
4492open any communication channels.
4493
4494The statistics are available in various formats and views depending on
4495the URI used to access them. For example, if the statistics channel is
4496configured to listen on 127.0.0.1 port 8888, then the statistics are
4497accessible in XML format at http://127.0.0.1:8888/ or
4498http://127.0.0.1:8888/xml. A CSS file is included, which can format the
4499XML statistics into tables when viewed with a stylesheet-capable
4500browser, and into charts and graphs using the Google Charts API when
4501using a JavaScript-capable browser.
4502
4503Broken-out subsets of the statistics can be viewed at
4504http://127.0.0.1:8888/xml/v3/status (server uptime and last
4505reconfiguration time), http://127.0.0.1:8888/xml/v3/server (server and
4506resolver statistics), http://127.0.0.1:8888/xml/v3/zones (zone
4507statistics), http://127.0.0.1:8888/xml/v3/net (network status and socket
4508statistics), http://127.0.0.1:8888/xml/v3/mem (memory manager
4509statistics), http://127.0.0.1:8888/xml/v3/tasks (task manager
4510statistics), and http://127.0.0.1:8888/xml/v3/traffic (traffic sizes).
4511
4512The full set of statistics can also be read in JSON format at
4513http://127.0.0.1:8888/json, with the broken-out subsets at
4514http://127.0.0.1:8888/json/v1/status (server uptime and last
4515reconfiguration time), http://127.0.0.1:8888/json/v1/server (server and
4516resolver statistics), http://127.0.0.1:8888/json/v1/zones (zone
4517statistics), http://127.0.0.1:8888/json/v1/net (network status and
4518socket statistics), http://127.0.0.1:8888/json/v1/mem (memory manager
4519statistics), http://127.0.0.1:8888/json/v1/tasks (task manager
4520statistics), and http://127.0.0.1:8888/json/v1/traffic (traffic sizes).
4521
4522.. _trust_anchors:
4523
4524``trust-anchors`` Statement Grammar
4525~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4526
4527.. include:: ../misc/trust-anchors.grammar.rst
4528
4529.. _trust-anchors:
4530
4531``dnssec-keys`` Statement Definition and Usage
4532~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4533
4534The ``trust-anchors`` statement defines DNSSEC trust anchors. DNSSEC is
4535described in :ref:`DNSSEC`.
4536
4537A trust anchor is defined when the public key or public key digest for a non-authoritative
4538zone is known but cannot be securely obtained through DNS, either
4539because it is the DNS root zone or because its parent zone is unsigned.
4540Once a key or digest has been configured as a trust anchor, it is treated as if it
4541had been validated and proven secure.
4542
4543The resolver attempts DNSSEC validation on all DNS data in subdomains of
4544configured trust anchors. Validation below specified names can be
4545temporarily disabled by using ``rndc nta``, or permanently disabled with
4546the ``validate-except`` option.
4547
4548All keys listed in ``trust-anchors``, and their corresponding zones, are
4549deemed to exist regardless of what parent zones say. Only keys
4550configured as trust anchors are used to validate the DNSKEY RRset for
4551the corresponding name. The parent's DS RRset is not used.
4552
4553``trust-anchors`` may be set at the top level of ``named.conf`` or within
4554a view. If it is set in both places, the configurations are additive:
4555keys defined at the top level are inherited by all views, but keys
4556defined in a view are only used within that view.
4557
4558The ``trust-anchors`` statement can contain
4559multiple trust anchor entries, each consisting of a
4560domain name, followed by an "anchor type" keyword indicating
4561the trust anchor's format, followed by the key or digest data.
4562
4563If the anchor type is ``static-key`` or
4564``initial-key``, then it is followed with the
4565key's flags, protocol, algorithm, and the Base64 representation
4566of the public key data. This is identical to the text
4567representation of a DNSKEY record.  Spaces, tabs, newlines, and
4568carriage returns are ignored in the key data, so the
4569configuration may be split into multiple lines.
4570
4571If the anchor type is ``static-ds`` or
4572``initial-ds``, it is followed with the
4573key tag, algorithm, digest type, and the hexadecimal
4574representation of the key digest. This is identical to the
4575text representation of a DS record.  Spaces, tabs, newlines,
4576and carriage returns are ignored.
4577
4578Trust anchors configured with the
4579``static-key`` or ``static-ds``
4580anchor types are immutable, while keys configured with
4581``initial-key`` or ``initial-ds``
4582can be kept up-to-date automatically, without intervention from the resolver operator.
4583(``static-key`` keys are identical to keys configured using the
4584deprecated ``trusted-keys`` statement.)
4585
4586Suppose, for example, that a zone's key-signing key was compromised, and
4587the zone owner had to revoke and replace the key. A resolver which had
4588the original key
4589configured using ``static-key`` or
4590``static-ds`` would be unable to validate
4591this zone any longer; it would reply with a SERVFAIL response
4592code.  This would continue until the resolver operator had
4593updated the ``trust-anchors`` statement with
4594the new key.
4595
4596If, however, the trust anchor had been configured using
4597``initial-key`` or ``initial-ds``
4598instead, then the zone owner could add a "stand-by" key to
4599their zone in advance.  ``named`` would store
4600the stand-by key, and when the original key was revoked,
4601``named`` would be able to transition smoothly
4602to the new key.  It would also recognize that the old key had
4603been revoked, and cease using that key to validate answers,
4604minimizing the damage that the compromised key could do.
4605This is the process used to keep the ICANN root DNSSEC key
4606up-to-date.
4607
4608Whereas ``static-key`` and
4609``static-ds`` trust anchors continue
4610to be trusted until they are removed from
4611``named.conf``, an
4612``initial-key`` or ``initial-ds``
4613is only trusted *once*: for as long as it
4614takes to load the managed key database and start the
4615:rfc:`5011` key maintenance process.
4616
4617It is not possible to mix static with initial trust anchors
4618for the same domain name.
4619
4620The first time ``named`` runs with an
4621``initial-key`` or ``initial-ds``
4622configured in ``named.conf``, it fetches the
4623DNSKEY RRset directly from the zone apex,
4624and validates it
4625using the trust anchor specified in ``trust-anchors``.
4626If the DNSKEY RRset is validly signed by a key matching
4627the trust anchor, then it is used as the basis for a new
4628managed keys database.
4629
4630From that point on, whenever ``named`` runs, it sees the ``initial-key`` or ``initial-ds``
4631listed in ``trust-anchors``, checks to make sure :rfc:`5011` key maintenance
4632has already been initialized for the specified domain, and if so,
4633simply moves on. The key specified in the ``trust-anchors`` statement is
4634not used to validate answers; it is superseded by the key or keys stored
4635in the managed keys database.
4636
4637The next time ``named`` runs after an ``initial-key`` or ``initial-ds`` has been *removed*
4638from the ``dnssec-keys`` statement (or changed to a ``static-key`` or ``static-ds``), the
4639corresponding zone is removed from the managed keys database, and
4640:rfc:`5011` key maintenance is no longer used for that domain.
4641
4642In the current implementation, the managed keys database is stored as a
4643master-format zone file.
4644
4645On servers which do not use views, this file is named
4646``managed-keys.bind``. When views are in use, there is a separate
4647managed keys database for each view; the filename is the view name
4648(or, if a view name contains characters which would make it illegal as a
4649filename, a hash of the view name), followed by the suffix ``.mkeys``.
4650
4651When the key database is changed, the zone is updated. As with any other
4652dynamic zone, changes are written into a journal file, e.g.,
4653``managed-keys.bind.jnl`` or ``internal.mkeys.jnl``. Changes are
4654committed to the primary file as soon as possible afterward; this
4655usually occurs within 30 seconds. Whenever ``named`` is using
4656automatic key maintenance, the zone file and journal file can be
4657expected to exist in the working directory. (For this reason, among
4658others, the working directory should be always be writable by
4659``named``.)
4660
4661If the ``dnssec-validation`` option is set to ``auto``, ``named``
4662automatically initializes an ``initial-key`` for the root zone. The key
4663that is used to initialize the key maintenance process is stored in
4664``bind.keys``; the location of this file can be overridden with the
4665``bindkeys-file`` option. As a fallback in the event no ``bind.keys``
4666can be found, the initializing key is also compiled directly into
4667``named``.
4668
4669.. _dnssec_policy_grammar:
4670
4671.. include:: ../misc/dnssec-policy.grammar.rst
4672
4673.. _dnssec_policy:
4674
4675The ``dnssec-policy`` statement defines a key and
4676signing policy (KASP) for zones.
4677
4678A KASP determines how one or more zones is signed
4679with DNSSEC. For example, it specifies how often keys should
4680roll, which cryptographic algorithms to use, and how often RRSIG
4681records need to be refreshed.
4682
4683Keys are not shared among zones, which means that one set of keys
4684per zone is generated even if they have the same policy.
4685If multiple views are configured with different versions of the
4686same zone, each separate version uses the same set of signing
4687keys.
4688
4689Multiple key and signing policies can be configured.  To
4690attach a policy to a zone, add a ``dnssec-policy``
4691option to the ``zone`` statement, specifying the
4692name of the policy that should be used.
4693
4694Key rollover timing is computed for each key according to
4695the key lifetime defined in the KASP.  The lifetime may be
4696modified by zone TTLs and propagation delays, to
4697prevent validation failures.  When a key reaches the end of its
4698lifetime,
4699``named`` generates and publishes a new key
4700automatically, then deactivates the old key and activates the
4701new one, and finally retires the old key according to a computed
4702schedule.
4703
4704Zone-signing key (ZSK) rollovers require no operator input.
4705Key-signing key (KSK) and combined-signing key (CSK) rollovers
4706require action to be taken to submit a DS record to the parent.
4707Rollover timing for KSKs and CSKs is adjusted to take into account
4708delays in processing and propagating DS updates.
4709
4710There are two predefined ``dnssec-policy`` names:
4711``none`` and ``default``.
4712Setting a zone's policy to
4713``none`` is the same as not setting
4714``dnssec-policy`` at all; the zone is not
4715signed.  Policy ``default`` causes the
4716zone to be signed with a single combined-signing key (CSK)
4717using algorithm ECDSAP256SHA256; this key has an
4718unlimited lifetime. (A verbose copy of this policy
4719may be found in the source tree, in the file
4720``doc/misc/dnssec-policy.default.conf``.)
4721
4722.. note::
4723
4724   The default signing policy may change in future releases.
4725   This could require changes to a signing policy
4726   when upgrading to a new version of BIND. Check
4727   the release notes carefully when upgrading to be informed
4728   of such changes. To prevent policy changes on upgrade,
4729   use an explicitly defined ``dnssec-policy``,
4730   rather than ``default``.
4731
4732If a ``dnssec-policy`` statement is modified
4733and the server restarted or reconfigured, ``named``
4734attempts to change the policy smoothly from the old one to
4735the new. For example, if the key algorithm is changed, then
4736a new key is generated with the new algorithm, and the old
4737algorithm is retired when the existing key's lifetime ends.
4738
4739.. note::
4740
4741  Rolling to a new policy while another key rollover is
4742  already in progress is not yet supported, and may result in
4743  unexpected behavior.
4744
4745The following options can be specified in a ``dnssec-policy`` statement:
4746
4747  ``dnskey-ttl``
4748    This indicates the TTL to use when generating DNSKEY resource records. The default is 1
4749    hour (3600 seconds).
4750
4751  ``keys``
4752    This is a list specifying the algorithms and roles to use when
4753    generating keys and signing the zone.
4754    Entries in this list do not represent specific
4755    DNSSEC keys, which may be changed on a regular basis,
4756    but the roles that keys play in the signing policy.
4757    For example, configuring a KSK of algorithm RSASHA256 ensures
4758    that the DNSKEY RRset always includes a key-signing key
4759    for that algorithm.
4760
4761    Here is an example (for illustration purposes only) of
4762    some possible entries in a ``keys``
4763    list:
4764
4765    ::
4766
4767        keys {
4768               ksk key-directory lifetime unlimited algorithm rsasha1 2048;
4769               zsk lifetime P30D algorithm 8;
4770               csk lifetime P6MT12H3M15S algorithm ecdsa256;
4771	};
4772
4773       This example specifies that three keys should be used
4774       in the zone. The first token determines which role the
4775       key plays in signing RRsets.  If set to
4776       ``ksk``, then this is
4777       a key-signing key; it has the KSK flag set and
4778       is only used to sign DNSKEY, CDS, and CDNSKEY RRsets.
4779       If set to ``zsk``, this is
4780       a zone-signing key; the KSK flag is unset, and
4781       the key signs all RRsets *except*
4782       DNSKEY, CDS, and CDNSKEY. If set to
4783       ``csk``, the key has the KSK
4784       flag set and is used to sign all RRsets.
4785
4786       An optional second token determines where the key is
4787       stored.  Currently, keys can only be stored in the
4788       configured ``key-directory``. This token
4789       may be used in the future to store keys in hardware
4790       service modules or separate directories.
4791
4792       The ``lifetime`` parameter specifies how
4793       long a key may be used before rolling over.  In the
4794       example above, the first key has an unlimited
4795       lifetime, the second key may be used for 30 days, and the
4796       third key has a rather peculiar lifetime of 6 months,
4797       12 hours, 3 minutes, and 15 seconds.  A lifetime of 0
4798       seconds is the same as ``unlimited``.
4799
4800       Note that the lifetime of a key may be extended if
4801       retiring it too soon would cause validation failures.
4802       For example, if the key were configured to roll more
4803       frequently than its own TTL, its lifetime would
4804       automatically be extended to account for this.
4805
4806       The ``algorithm`` parameter specifies
4807       the key's algorithm, expressed either as a string
4808       ("rsasha256", "ecdsa384", etc.) or as a decimal number.
4809       An optional second parameter specifies the key's size
4810       in bits. If it is omitted, as shown in the
4811       example for the second and third keys, an appropriate
4812       default size for the algorithm is used.
4813
4814    ``publish-safety``
4815       This is a margin that is added to the pre-publication
4816       interval in rollover timing calculations, to give some
4817       extra time to cover unforeseen events. This increases
4818       the time between when keys are published and they become active.
4819       The default is ``PT1H`` (1 hour).
4820
4821     ``retire-safety``
4822       This is a margin that is added to the post-publication interval
4823       in rollover timing calculations, to give some extra time
4824       to cover unforeseen events. This increases the time a key
4825       remains published after it is no longer active.  The
4826       default is ``PT1H`` (1 hour).
4827
4828     ``signatures-refresh``
4829       This determines how frequently an RRSIG record needs to be
4830       refreshed.  The signature is renewed when the time until
4831       the expiration time is closer than the specified interval.
4832       The default is ``P5D`` (5 days), meaning
4833       signatures that expire in 5 days or sooner are
4834       refreshed.
4835
4836     ``signatures-validity``
4837       This indicates the validity period of an RRSIG record (subject to
4838       inception offset and jitter). The default is
4839       ``P2W`` (2 weeks).
4840
4841     ``signatures-validity-dnskey``
4842       This is similar to ``signatures-validity``, but for
4843       DNSKEY records. The default is ``P2W``
4844       (2 weeks).
4845
4846     ``max-zone-ttl``
4847       Like the ``max-zone-ttl`` zone option,
4848       this specifies the maximum permissible TTL value in
4849       seconds for the zone. When loading a zone file using
4850       a `masterfile-format` of
4851       ``text`` or ``raw``,
4852       any record encountered with a TTL higher than
4853       `max-zone-ttl` is capped at the
4854       maximum permissible TTL value.
4855
4856       This is needed in DNSSEC-maintained zones because when
4857       rolling to a new DNSKEY, the old key needs to remain
4858       available until RRSIG records have expired from caches.
4859       The `max-zone-ttl` option guarantees that
4860       the largest TTL in the zone is no higher than the
4861       set value.
4862
4863       .. note::
4864	  Because ``map``-format files
4865	  load directly into memory, this option cannot be
4866	  used with them.
4867
4868       The default value is ``PT24H`` (24 hours).
4869       A `max-zone-ttl` of zero is treated as if
4870       the default value were in use.
4871
4872     ``zone-propagation-delay``
4873       This is the expected propagation delay from the time when a zone
4874       is first updated to the time when the new version of the
4875       zone is served by all secondary servers.  The default
4876       is ``PT5M`` (5 minutes).
4877
4878     ``parent-ds-ttl``
4879       This is the TTL of the DS RRset that the parent zone uses.  The
4880       default is ``P1D`` (1 day).
4881
4882     ``parent-propagation-delay``
4883       This is the expected propagation delay from the time when the
4884       parent zone is updated to the time when the new version
4885       is served by all of the parent zone's name servers.
4886       The default is ``PT1H`` (1 hour).
4887
4888     ``parent-registration-delay``
4889       This is the expected registration delay from the time when a DS
4890       RRset change is requested to the time when the DS RRset
4891       is updated in the parent zone.  The default is
4892       ``P1D`` (1 day).
4893
4894.. _managed-keys:
4895
4896``managed-keys`` Statement Grammar
4897~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4898
4899.. include:: ../misc/managed-keys.grammar.rst
4900
4901.. _managed_keys:
4902
4903``managed-keys`` Statement Definition and Usage
4904~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4905
4906The ``managed-keys`` statement has been
4907deprecated in favor of :ref:`trust_anchors`
4908with the ``initial-key`` keyword.
4909
4910.. _trusted-keys:
4911
4912``trusted-keys`` Statement Grammar
4913~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4914
4915.. include:: ../misc/trusted-keys.grammar.rst
4916
4917.. _trusted_keys:
4918
4919``trusted-keys`` Statement Definition and Usage
4920~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4921
4922The ``trusted-keys`` statement has been deprecated in favor of
4923:ref:`trust_anchors` with the ``static-key`` keyword.
4924
4925.. _view_statement_grammar:
4926
4927``view`` Statement Grammar
4928~~~~~~~~~~~~~~~~~~~~~~~~~~
4929
4930::
4931
4932   view view_name [ class ] {
4933       match-clients { address_match_list } ;
4934       match-destinations { address_match_list } ;
4935       match-recursive-only yes_or_no ;
4936     [ view_option ; ... ]
4937     [ zone_statement ; ... ]
4938   } ;
4939
4940.. _view_statement:
4941
4942``view`` Statement Definition and Usage
4943~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4944
4945The ``view`` statement is a powerful feature of BIND 9 that lets a name
4946server answer a DNS query differently depending on who is asking. It is
4947particularly useful for implementing split DNS setups without having to
4948run multiple servers.
4949
4950Each ``view`` statement defines a view of the DNS namespace that is
4951seen by a subset of clients. A client matches a view if its source IP
4952address matches the ``address_match_list`` of the view's
4953``match-clients`` clause, and its destination IP address matches the
4954``address_match_list`` of the view's ``match-destinations`` clause. If
4955not specified, both ``match-clients`` and ``match-destinations`` default
4956to matching all addresses. In addition to checking IP addresses,
4957``match-clients`` and ``match-destinations`` can also take ``keys``
4958which provide an mechanism for the client to select the view. A view can
4959also be specified as ``match-recursive-only``, which means that only
4960recursive requests from matching clients will match that view. The order
4961of the ``view`` statements is significant — a client request is
4962resolved in the context of the first ``view`` that it matches.
4963
4964Zones defined within a ``view`` statement are only accessible to
4965clients that match the ``view``. By defining a zone of the same name in
4966multiple views, different zone data can be given to different clients:
4967for example, "internal" and "external" clients in a split DNS setup.
4968
4969Many of the options given in the ``options`` statement can also be used
4970within a ``view`` statement, and then apply only when resolving queries
4971with that view. When no view-specific value is given, the value in the
4972``options`` statement is used as a default. Also, zone options can have
4973default values specified in the ``view`` statement; these view-specific
4974defaults take precedence over those in the ``options`` statement.
4975
4976Views are class-specific. If no class is given, class IN is assumed.
4977Note that all non-IN views must contain a hint zone, since only the IN
4978class has compiled-in default hints.
4979
4980If there are no ``view`` statements in the config file, a default view
4981that matches any client is automatically created in class IN. Any
4982``zone`` statements specified on the top level of the configuration file
4983are considered to be part of this default view, and the ``options``
4984statement applies to the default view. If any explicit ``view``
4985statements are present, all ``zone`` statements must occur inside
4986``view`` statements.
4987
4988Here is an example of a typical split DNS setup implemented using
4989``view`` statements:
4990
4991::
4992
4993   view "internal" {
4994         // This should match our internal networks.
4995         match-clients { 10.0.0.0/8; };
4996
4997         // Provide recursive service to internal
4998         // clients only.
4999         recursion yes;
5000
5001         // Provide a complete view of the example.com
5002         // zone including addresses of internal hosts.
5003         zone "example.com" {
5004           type master;
5005           file "example-internal.db";
5006         };
5007   };
5008
5009   view "external" {
5010         // Match all clients not matched by the
5011         // previous view.
5012         match-clients { any; };
5013
5014         // Refuse recursive service to external clients.
5015         recursion no;
5016
5017         // Provide a restricted view of the example.com
5018         // zone containing only publicly accessible hosts.
5019         zone "example.com" {
5020          type master;
5021          file "example-external.db";
5022         };
5023   };
5024
5025.. _zone_statement_grammar:
5026
5027``zone`` Statement Grammar
5028~~~~~~~~~~~~~~~~~~~~~~~~~~
5029
5030.. include:: ../misc/master.zoneopt.rst
5031.. include:: ../misc/slave.zoneopt.rst
5032.. include:: ../misc/mirror.zoneopt.rst
5033.. include:: ../misc/hint.zoneopt.rst
5034.. include:: ../misc/stub.zoneopt.rst
5035.. include:: ../misc/static-stub.zoneopt.rst
5036.. include:: ../misc/forward.zoneopt.rst
5037.. include:: ../misc/redirect.zoneopt.rst
5038.. include:: ../misc/delegation-only.zoneopt.rst
5039.. include:: ../misc/in-view.zoneopt.rst
5040
5041.. _zone_statement:
5042
5043``zone`` Statement Definition and Usage
5044~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5045
5046.. _zone_types:
5047
5048Zone Types
5049^^^^^^^^^^
5050
5051The ``type`` keyword is required for the ``zone`` configuration unless
5052it is an ``in-view`` configuration. Its acceptable values include:
5053``primary`` (or ``master``), ``secondary`` (or ``slave``), ``mirror``,
5054``delegation-only``, ``forward``, ``hint``, ``redirect``,
5055``static-stub``, and ``stub``.
5056
5057``primary``
5058   A primary zone has a master copy of the data for the zone and is able
5059   to provide authoritative answers for it. Type ``master`` is a synonym
5060   for ``primary``.
5061
5062``secondary``
5063    A secondary zone is a replica of a primary zone. Type ``slave`` is a
5064    synonym for ``secondary``. The ``masters`` list specifies one or more IP
5065    addresses of primary servers that the secondary contacts to update
5066    its copy of the zone.  Masters list elements can
5067    also be names of other masters lists.  By default,
5068    transfers are made from port 53 on the servers;
5069    this can be changed for all servers by specifying
5070    a port number before the list of IP addresses,
5071    or on a per-server basis after the IP address.
5072    Authentication to the primary can also be done with
5073    per-server TSIG keys.  If a file is specified, then the
5074    replica is written to this file
5075    whenever the zone
5076    is changed, and reloaded from this file on a server
5077    restart. Use of a file is recommended, since it
5078    often speeds server startup and eliminates a
5079    needless waste of bandwidth. Note that for large
5080    numbers (in the tens or hundreds of thousands) of
5081    zones per server, it is best to use a two-level
5082    naming scheme for zone filenames. For example,
5083    a secondary server for the zone
5084    ``example.com`` might place
5085    the zone contents into a file called
5086    ``ex/example.com``, where
5087    ``ex/`` is just the first two
5088    letters of the zone name. (Most operating systems
5089    behave very slowly if there are 100000 files in a single directory.)
5090
5091``stub``
5092   A stub zone is similar to a secondary zone, except that it replicates only
5093   the NS records of a primary zone instead of the entire zone. Stub zones
5094   are not a standard part of the DNS; they are a feature specific to the
5095   BIND implementation.
5096
5097   Stub zones can be used to eliminate the need for a glue NS record in a parent
5098   zone, at the expense of maintaining a stub zone entry and a set of name
5099   server addresses in ``named.conf``. This usage is not recommended for
5100   new configurations, and BIND 9 supports it only in a limited way. If a BIND 9 primary, serving a parent zone, has child stub
5101   zones configured, all the secondary servers for the parent zone also need to
5102   have the same child stub zones configured.
5103
5104   Stub zones can also be used as a way of forcing the resolution of a given
5105   domain to use a particular set of authoritative servers. For example, the
5106   caching name servers on a private network using :rfc:`1918` addressing may be
5107   configured with stub zones for ``10.in-addr.arpa`` to use a set of
5108   internal name servers as the authoritative servers for that domain.
5109
5110``mirror``
5111
5112   A mirror zone is similar to a zone of type ``secondary``, except its data is
5113   subject to DNSSEC validation before being used in answers.  Validation is
5114   applied to the entire zone during the zone transfer process, and again when
5115   the zone file is loaded from disk upon restarting ``named``.  If validation
5116   of a new version of a mirror zone fails, a retransfer is scheduled and the
5117   most recent correctly validated version of that zone is used, until it either
5118   expires or a newer version validates correctly. If no usable zone data is
5119   available for a mirror zone, either due to transfer failure or
5120   expiration, traditional DNS recursion is used to look up the answers instead.
5121   Mirror zones cannot be used in a view that does not have recursion enabled.
5122
5123   Answers coming from a mirror zone look almost exactly like answers from a
5124   zone of type ``secondary``, with the notable exceptions that the AA bit
5125   ("authoritative answer") is not set, and the AD bit ("authenticated data")
5126   is.
5127
5128   Mirror zones are intended to be used to set up a fast local copy of the root
5129   zone, similar to the one described in :rfc:`7706`.  A default list of primary
5130   servers for the IANA root zone is built into ``named`` and thus its mirroring
5131   can be enabled using the following configuration:
5132
5133
5134      ::
5135
5136         zone "." {
5137              type mirror;
5138         };
5139
5140   Mirroring a zone other than root
5141   requires an explicit list of primary servers to be provided using the
5142   ``masters`` option (see :ref:`masters_grammar` for details), and a
5143   key-signing key (KSK) for the specified zone to be explicitly configured as a
5144   trust anchor.
5145
5146   To make mirror zone contents persist between ``named`` restarts, use the
5147   :ref:`file <file-option>` option.
5148
5149
5150   When configuring NOTIFY for a mirror zone, only ``notify no;`` and ``notify
5151   explicit;`` can be used at the zone level.  Using any other ``notify``
5152   setting at the zone level is a configuration error. Using any other
5153   ``notify`` setting at the ``options`` or ``view`` level causes that
5154   setting to be overridden with ``notify explicit;`` for the mirror zone.  The
5155   global default for the ``notify`` option is ``yes``, so mirror zones are by
5156   default configured with ``notify explicit;``.
5157
5158   Outgoing transfers of mirror zones are disabled by default but may be
5159   enabled using :ref:`allow-transfer <allow-transfer-access>`.
5160
5161   .. note::
5162      Using this zone type with any zone other than the root zone should
5163      be considered *experimental* and may cause performance issues, especially
5164      for zones which are large and/or frequently updated.
5165
5166``static-stub``
5167   A static-stub zone is similar to a stub zone, with the following
5168   exceptions: the zone data is statically configured, rather than
5169   transferred from a primary server; and when recursion is necessary for a query
5170   that matches a static-stub zone, the locally configured data (name server
5171   names and glue addresses) are always used, even if different authoritative
5172   information is cached.
5173
5174   Zone data is configured via the ``server-addresses`` and ``server-names``
5175   zone options.
5176
5177   The zone data is maintained in the form of NS and (if necessary) glue A or
5178   AAAA RRs internally, which can be seen by dumping zone databases with
5179   ``rndc dumpdb -all``. The configured RRs are considered local configuration
5180   parameters rather than public data. Non-recursive queries (i.e., those
5181   with the RD bit off) to a static-stub zone are therefore prohibited and
5182   are responded to with REFUSED.
5183
5184   Since the data is statically configured, no zone maintenance action takes
5185   place for a static-stub zone. For example, there is no periodic refresh
5186   attempt, and an incoming notify message is rejected with an rcode
5187   of NOTAUTH.
5188
5189   Each static-stub zone is configured with internally generated NS and (if
5190   necessary) glue A or AAAA RRs.
5191
5192``forward``
5193   A forward zone is a way to configure forwarding on a per-domain basis.
5194   A ``zone`` statement of type ``forward`` can contain a ``forward`` and/or
5195   ``forwarders`` statement, which applies to queries within the domain
5196   given by the zone name. If no ``forwarders`` statement is present, or an
5197   empty list for ``forwarders`` is given, then no forwarding is done
5198   for the domain, canceling the effects of any forwarders in the ``options``
5199   statement. Thus, to use this type of zone to change the
5200   behavior of the global ``forward`` option (that is, "forward first" to,
5201   then "forward only", or vice versa), but using the same servers as set
5202   globally, re-specify the global forwarders.
5203
5204``hint``
5205   The initial set of root name servers is specified using a hint zone.
5206   When the server starts, it uses the root hints to find a root name
5207   server and get the most recent list of root name servers. If no hint zone
5208   is specified for class IN, the server uses a compiled-in default set of
5209   root servers hints. Classes other than IN have no built-in default hints.
5210
5211``redirect``
5212   Redirect zones are used to provide answers to queries when normal
5213   resolution would result in NXDOMAIN being returned. Only one redirect zone
5214   is supported per view. ``allow-query`` can be used to restrict which
5215   clients see these answers.
5216
5217   If the client has requested DNSSEC records (DO=1) and the NXDOMAIN response
5218   is signed, no substitution occurs.
5219
5220   To redirect all NXDOMAIN responses to 100.100.100.2 and
5221   2001:ffff:ffff::100.100.100.2, configure a type ``redirect`` zone
5222   named ".", with the zone file containing wildcard records that point to
5223   the desired addresses: ``"*. IN A 100.100.100.2"`` and
5224   ``"*. IN AAAA 2001:ffff:ffff::100.100.100.2"``.
5225
5226   As another example, to redirect all Spanish names (under .ES), use similar entries
5227   but with the names ``*.ES.`` instead of ``*.``. To redirect all commercial
5228   Spanish names (under COM.ES), use wildcard entries
5229   called ``*.COM.ES.``.
5230
5231   Note that the redirect zone supports all possible types; it is not
5232   limited to A and AAAA records.
5233
5234   If a redirect zone is configured with a ``masters`` option, then it is
5235   transferred in as if it were a secondary zone. Otherwise, it is loaded from a
5236   file as if it were a primary zone.
5237
5238   Because redirect zones are not referenced directly by name, they are not
5239   kept in the zone lookup table with normal primary and secondary zones. To reload
5240   a redirect zone, use ``rndc reload -redirect``; to retransfer a
5241   redirect zone configured as a secondary, use ``rndc retransfer -redirect``.
5242   When using ``rndc reload`` without specifying a zone name, redirect
5243   zones are reloaded along with other zones.
5244
5245``delegation-only``
5246   This zone type is used to enforce the delegation-only status of infrastructure
5247   zones (e.g., COM, NET, ORG). Any answer that is received without an
5248   explicit or implicit delegation in the authority section is treated
5249   as NXDOMAIN. This does not apply to the zone apex, and should not be
5250   applied to leaf zones.
5251
5252   ``delegation-only`` has no effect on answers received from forwarders.
5253
5254   See caveats in :ref:`root-delegation-only <root-delegation-only>`.
5255
5256Class
5257^^^^^
5258
5259The zone's name may optionally be followed by a class. If a class is not
5260specified, class ``IN`` (for ``Internet``) is assumed. This is correct
5261for the vast majority of cases.
5262
5263The ``hesiod`` class is named for an information service from MIT's
5264Project Athena. It was used to share information about various systems
5265databases, such as users, groups, printers, and so on. The keyword ``HS``
5266is a synonym for hesiod.
5267
5268Another MIT development is Chaosnet, a LAN protocol created in the
5269mid-1970s. Zone data for it can be specified with the ``CHAOS`` class.
5270
5271.. _zone_options:
5272
5273Zone Options
5274^^^^^^^^^^^^
5275
5276``allow-notify``
5277   See the description of ``allow-notify`` in :ref:`access_control`.
5278
5279``allow-query``
5280   See the description of ``allow-query`` in :ref:`access_control`.
5281
5282``allow-query-on``
5283   See the description of ``allow-query-on`` in :ref:`access_control`.
5284
5285``allow-transfer``
5286   See the description of ``allow-transfer`` in :ref:`access_control`.
5287
5288``allow-update``
5289   See the description of ``allow-update`` in :ref:`access_control`.
5290
5291``update-policy``
5292   This specifies a "Simple Secure Update" policy. See :ref:`dynamic_update_policies`.
5293
5294``allow-update-forwarding``
5295   See the description of ``allow-update-forwarding`` in :ref:`access_control`.
5296
5297``also-notify``
5298   This option is only meaningful if ``notify`` is active for this zone. The set of
5299   machines that receive a ``DNS NOTIFY`` message for this zone is
5300   made up of all the listed name servers (other than the primary)
5301   for the zone, plus any IP addresses specified with
5302   ``also-notify``. A port may be specified with each ``also-notify``
5303   address to send the notify messages to a port other than the default
5304   of 53. A TSIG key may also be specified to cause the ``NOTIFY`` to be
5305   signed by the given key. ``also-notify`` is not meaningful for stub
5306   zones. The default is the empty list.
5307
5308``check-names``
5309   This option is used to restrict the character set and syntax of
5310   certain domain names in primary files and/or DNS responses received
5311   from the network. The default varies according to zone type. For
5312   ``primary`` zones the default is ``fail``. For ``secondary`` zones the
5313   default is ``warn``. It is not implemented for ``hint`` zones.
5314
5315``check-mx``
5316   See the description of ``check-mx`` in :ref:`boolean_options`.
5317
5318``check-spf``
5319   See the description of ``check-spf`` in :ref:`boolean_options`.
5320
5321``check-wildcard``
5322   See the description of ``check-wildcard`` in :ref:`boolean_options`.
5323
5324``check-integrity``
5325   See the description of ``check-integrity`` in :ref:`boolean_options`.
5326
5327``check-sibling``
5328   See the description of ``check-sibling`` in :ref:`boolean_options`.
5329
5330``zero-no-soa-ttl``
5331   See the description of ``zero-no-soa-ttl`` in :ref:`boolean_options`.
5332
5333``update-check-ksk``
5334   See the description of ``update-check-ksk`` in :ref:`boolean_options`.
5335
5336``dnssec-loadkeys-interval``
5337   See the description of ``dnssec-loadkeys-interval`` in :ref:`options`.
5338
5339``dnssec-update-mode``
5340   See the description of ``dnssec-update-mode`` in :ref:`options`.
5341
5342``dnssec-dnskey-kskonly``
5343   See the description of ``dnssec-dnskey-kskonly`` in :ref:`boolean_options`.
5344
5345``try-tcp-refresh``
5346   See the description of ``try-tcp-refresh`` in :ref:`boolean_options`.
5347
5348``database``
5349   This specifies the type of database to be used for storing the zone data.
5350   The string following the ``database`` keyword is interpreted as a
5351   list of whitespace-delimited words. The first word identifies the
5352   database type, and any subsequent words are passed as arguments to
5353   the database to be interpreted in a way specific to the database
5354   type.
5355
5356   The default is ``"rbt"``, BIND 9's native in-memory red-black-tree
5357   database. This database does not take arguments.
5358
5359   Other values are possible if additional database drivers have been
5360   linked into the server. Some sample drivers are included with the
5361   distribution but none are linked in by default.
5362
5363``dialup``
5364   See the description of ``dialup`` in :ref:`boolean_options`.
5365
5366``delegation-only``
5367   This flag only applies to forward, hint, and stub zones. If set to
5368   ``yes``, then the zone is treated as if it is also a
5369   delegation-only type zone.
5370
5371   See caveats in :ref:`root-delegation-only <root-delegation-only>`.
5372
5373.. _file-option:
5374
5375``file``
5376   This sets the zone's filename. In ``primary``, ``hint``, and ``redirect``
5377   zones which do not have ``masters`` defined, zone data is loaded from
5378   this file. In ``secondary``, ``mirror``, ``stub``, and ``redirect`` zones
5379   which do have ``masters`` defined, zone data is retrieved from
5380   another server and saved in this file. This option is not applicable
5381   to other zone types.
5382
5383``forward``
5384   This option is only meaningful if the zone has a forwarders list. The ``only`` value
5385   causes the lookup to fail after trying the forwarders and getting no
5386   answer, while ``first`` allows a normal lookup to be tried.
5387
5388``forwarders``
5389   This is used to override the list of global forwarders. If it is not
5390   specified in a zone of type ``forward``, no forwarding is done for
5391   the zone and the global options are not used.
5392
5393``journal``
5394   This allows the default journal's filename to be overridden. The default is
5395   the zone's filename with "``.jnl``" appended. This is applicable to
5396   ``primary`` and ``secondary`` zones.
5397
5398``max-ixfr-ratio``
5399   See the description of ``max-ixfr-ratio`` in :ref:`options`.
5400
5401``max-journal-size``
5402   See the description of ``max-journal-size`` in :ref:`server_resource_limits`.
5403
5404``max-records``
5405   See the description of ``max-records`` in :ref:`server_resource_limits`.
5406
5407``max-transfer-time-in``
5408   See the description of ``max-transfer-time-in`` in :ref:`zone_transfers`.
5409
5410``max-transfer-idle-in``
5411   See the description of ``max-transfer-idle-in`` in :ref:`zone_transfers`.
5412
5413``max-transfer-time-out``
5414   See the description of ``max-transfer-time-out`` in :ref:`zone_transfers`.
5415
5416``max-transfer-idle-out``
5417   See the description of ``max-transfer-idle-out`` in :ref:`zone_transfers`.
5418
5419``notify``
5420   See the description of ``notify`` in :ref:`boolean_options`.
5421
5422``notify-delay``
5423   See the description of ``notify-delay`` in :ref:`tuning`.
5424
5425``notify-to-soa``
5426   See the description of ``notify-to-soa`` in :ref:`boolean_options`.
5427
5428``zone-statistics``
5429   See the description of ``zone-statistics`` in :ref:`options`.
5430
5431``server-addresses``
5432   This option is only meaningful for static-stub zones. This is a list of IP addresses
5433   to which queries should be sent in recursive resolution for the zone.
5434   A non-empty list for this option internally configures the apex
5435   NS RR with associated glue A or AAAA RRs.
5436
5437   For example, if "example.com" is configured as a static-stub zone
5438   with 192.0.2.1 and 2001:db8::1234 in a ``server-addresses`` option,
5439   the following RRs are internally configured:
5440
5441   ::
5442
5443      example.com. NS example.com.
5444      example.com. A 192.0.2.1
5445      example.com. AAAA 2001:db8::1234
5446
5447   These records are used internally to resolve names under the
5448   static-stub zone. For instance, if the server receives a query for
5449   "www.example.com" with the RD bit on, the server initiates
5450   recursive resolution and sends queries to 192.0.2.1 and/or
5451   2001:db8::1234.
5452
5453``server-names``
5454   This is only meaningful for static-stub zones. This is a list of domain names
5455   of name servers that act as authoritative servers of the static-stub
5456   zone. These names are resolved to IP addresses when ``named``
5457   needs to send queries to these servers. To make this supplemental
5458   resolution successful, these names must not be a subdomain of the
5459   origin name of the static-stub zone. That is, when "example.net" is the
5460   origin of a static-stub zone, "ns.example" and "master.example.com"
5461   can be specified in the ``server-names`` option, but "ns.example.net"
5462   cannot, and is rejected by the configuration parser.
5463
5464   A non-empty list for this option internally configures the apex
5465   NS RR with the specified names. For example, if "example.com" is
5466   configured as a static-stub zone with "ns1.example.net" and
5467   "ns2.example.net" in a ``server-names`` option, the following RRs
5468   are internally configured:
5469
5470   ::
5471
5472      example.com. NS ns1.example.net.
5473      example.com. NS ns2.example.net.
5474
5475   These records are used internally to resolve names under the
5476   static-stub zone. For instance, if the server receives a query for
5477   "www.example.com" with the RD bit on, the server initiates recursive
5478   resolution, resolves "ns1.example.net" and/or "ns2.example.net" to IP
5479   addresses, and then sends queries to one or more of these addresses.
5480
5481``sig-validity-interval``
5482   See the description of ``sig-validity-interval`` in :ref:`tuning`.
5483
5484``sig-signing-nodes``
5485   See the description of ``sig-signing-nodes`` in :ref:`tuning`.
5486
5487``sig-signing-signatures``
5488   See the description of ``sig-signing-signatures`` in
5489   :ref:`tuning`.
5490
5491``sig-signing-type``
5492   See the description of ``sig-signing-type`` in :ref:`tuning`.
5493
5494``transfer-source``
5495   See the description of ``transfer-source`` in :ref:`zone_transfers`.
5496
5497``transfer-source-v6``
5498   See the description of ``transfer-source-v6`` in :ref:`zone_transfers`.
5499
5500``alt-transfer-source``
5501   See the description of ``alt-transfer-source`` in :ref:`zone_transfers`.
5502
5503``alt-transfer-source-v6``
5504   See the description of ``alt-transfer-source-v6`` in :ref:`zone_transfers`.
5505
5506``use-alt-transfer-source``
5507   See the description of ``use-alt-transfer-source`` in :ref:`zone_transfers`.
5508
5509``notify-source``
5510   See the description of ``notify-source`` in :ref:`zone_transfers`.
5511
5512``notify-source-v6``
5513   See the description of ``notify-source-v6`` in :ref:`zone_transfers`.
5514
5515``min-refresh-time``; \ ``max-refresh-time``; \ ``min-retry-time``; \ ``max-retry-time``
5516   See the descriptions in :ref:`tuning`.
5517
5518``ixfr-from-differences``
5519   See the description of ``ixfr-from-differences`` in :ref:`boolean_options`.
5520   (Note that the ``ixfr-from-differences`` choices of ``primary`` and ``secondary``
5521   are not available at the zone level.)
5522
5523``key-directory``
5524   See the description of ``key-directory`` in :ref:`options`.
5525
5526``auto-dnssec``
5527   See the description of ``auto-dnssec`` in :ref:`options`.
5528
5529``serial-update-method``
5530   See the description of ``serial-update-method`` in :ref:`options`.
5531
5532``inline-signing``
5533   If ``yes``, this enables "bump in the wire" signing of a zone, where
5534   a unsigned zone is transferred in or loaded from disk and a signed
5535   version of the zone is served with, possibly, a different serial
5536   number. This behavior is disabled by default.
5537
5538``multi-master``
5539   See the description of ``multi-master`` in :ref:`boolean_options`.
5540
5541``masterfile-format``
5542   See the description of ``masterfile-format`` in :ref:`tuning`.
5543
5544``max-zone-ttl``
5545   See the description of ``max-zone-ttl`` in :ref:`options`.
5546
5547``dnssec-secure-to-insecure``
5548   See the description of ``dnssec-secure-to-insecure`` in :ref:`boolean_options`.
5549
5550.. _dynamic_update_policies:
5551
5552Dynamic Update Policies
5553^^^^^^^^^^^^^^^^^^^^^^^
5554
5555BIND 9 supports two methods of granting clients the right to
5556perform dynamic updates to a zone, configured by the ``allow-update``
5557or ``update-policy`` options.
5558
5559The ``allow-update`` clause is a simple access control list. Any client
5560that matches the ACL is granted permission to update any record in the
5561zone.
5562
5563The ``update-policy`` clause allows more fine-grained control over which
5564updates are allowed. It specifies a set of rules, in which each rule
5565either grants or denies permission for one or more names in the zone to
5566be updated by one or more identities. Identity is determined by the key
5567that signed the update request, using either TSIG or SIG(0). In most
5568cases, ``update-policy`` rules only apply to key-based identities. There
5569is no way to specify update permissions based on the client source address.
5570
5571``update-policy`` rules are only meaningful for zones of type
5572``primary``, and are not allowed in any other zone type. It is a
5573configuration error to specify both ``allow-update`` and
5574``update-policy`` at the same time.
5575
5576A pre-defined ``update-policy`` rule can be switched on with the command
5577``update-policy local;``. ``named`` automatically
5578generates a TSIG session key when starting and stores it in a file;
5579this key can then be used by local clients to update the zone while
5580``named`` is running. By default, the session key is stored in the file
5581``/var/run/named/session.key``, the key name is "local-ddns", and the
5582key algorithm is HMAC-SHA256. These values are configurable with the
5583``session-keyfile``, ``session-keyname``, and ``session-keyalg`` options,
5584respectively. A client running on the local system, if run with
5585appropriate permissions, may read the session key from the key file and
5586use it to sign update requests. The zone's update policy is set to
5587allow that key to change any record within the zone. Assuming the key
5588name is "local-ddns", this policy is equivalent to:
5589
5590::
5591
5592   update-policy { grant local-ddns zonesub any; };
5593
5594with the additional restriction that only clients connecting from the
5595local system are permitted to send updates.
5596
5597Note that only one session key is generated by ``named``; all zones
5598configured to use ``update-policy local`` accept the same key.
5599
5600The command ``nsupdate -l`` implements this feature, sending requests to
5601localhost and signing them using the key retrieved from the session key
5602file.
5603
5604Other rule definitions look like this:
5605
5606::
5607
5608   ( grant | deny ) identity ruletype  name   types
5609
5610Each rule grants or denies privileges. Rules are checked in the order in
5611which they are specified in the ``update-policy`` statement. Once a
5612message has successfully matched a rule, the operation is immediately
5613granted or denied, and no further rules are examined. There are 13 types
5614of rules; the rule type is specified by the ``ruletype`` field, and the
5615interpretation of other fields varies depending on the rule type.
5616
5617In general, a rule is matched when the key that signed an update request
5618matches the ``identity`` field, the name of the record to be updated
5619matches the ``name`` field (in the manner specified by the ``ruletype``
5620field), and the type of the record to be updated matches the ``types``
5621field. Details for each rule type are described below.
5622
5623The ``identity`` field must be set to a fully qualified domain name. In
5624most cases, this represensts the name of the TSIG or SIG(0) key that
5625must be used to sign the update request. If the specified name is a
5626wildcard, it is subject to DNS wildcard expansion, and the rule may
5627apply to multiple identities. When a TKEY exchange has been used to
5628create a shared secret, the identity of the key used to authenticate the
5629TKEY exchange is used as the identity of the shared secret. Some
5630rule types use identities matching the client's Kerberos principal (e.g,
5631``"host/machine@REALM"``) or Windows realm (``machine$@REALM``).
5632
5633The name field also specifies a fully qualified domain name. This often
5634represents the name of the record to be updated. Interpretation of this
5635field is dependent on rule type.
5636
5637If no types are explicitly specified, then a rule matches all types
5638except RRSIG, NS, SOA, NSEC, and NSEC3. Types may be specified by name,
5639including ``ANY``; ANY matches all types except NSEC and NSEC3, which can
5640never be updated. Note that when an attempt is made to delete all
5641records associated with a name, the rules are checked for each existing
5642record type.
5643
5644The ruletype field has 16 values: ``name``, ``subdomain``, ``wildcard``,
5645``self``, ``selfsub``, ``selfwild``, ``krb5-self``, ``ms-self``,
5646``krb5-selfsub``, ``ms-selfsub``, ``krb5-subdomain``, ``ms-subdomain``,
5647``tcp-self``, ``6to4-self``, ``zonesub``, and ``external``.
5648
5649``name``
5650    With exact-match semantics, this rule matches when the name being updated is identical to the contents of the name field.
5651
5652``subdomain``
5653    This rule matches when the name being updated is a subdomain of, or identical to, the contents of the name field.
5654
5655``zonesub``
5656    This rule is similar to subdomain, except that it matches when the name being updated is a subdomain of the zone in which the ``update-policy`` statement appears. This obviates the need to type the zone name twice, and enables the use of a standard ``update-policy`` statement in multiple zones without modification.
5657    When this rule is used, the name field is omitted.
5658
5659``wildcard``
5660    The name field is subject to DNS wildcard expansion, and this rule matches when the name being updated is a valid expansion of the wildcard.
5661
5662``self``
5663    This rule matches when the name of the record being updated matches the contents of the identity field. The name field is ignored. To avoid confusion, it is recommended that this field be set to the same value as the identity field or to "."
5664    The ``self`` rule type is most useful when allowing one key per name to update, where the key has the same name as the record to be updated. In this case, the identity field can be specified as ``*`` (asterisk).
5665
5666``selfsub``
5667    This rule is similar to ``self``, except that subdomains of ``self`` can also be updated.
5668
5669``selfwild``
5670    This rule is similar to ``self``, except that only subdomains of ``self`` can be updated.
5671
5672``ms-self``
5673    When a client sends an UPDATE using a Windows machine principal (for example, ``machine$@REALM``), this rule allows records with the absolute name of ``machine.REALM`` to be updated.
5674
5675    The realm to be matched is specified in the identity field.
5676
5677    The name field has no effect on this rule; it should be set to "." as a placeholder.
5678
5679    For example, ``grant EXAMPLE.COM ms-self . A AAAA`` allows any machine with a valid principal in the realm ``EXAMPLE.COM`` to update its own address records.
5680
5681``ms-selfsub``
5682    This is similar to ``ms-self``, except it also allows updates to any subdomain of the name specified in the Windows machine principal, not just to the name itself.
5683
5684``ms-subdomain``
5685    When a client sends an UPDATE using a Windows machine principal (for example, ``machine$@REALM``), this rule allows any machine in the specified realm to update any record in the zone or in a specified subdomain of the zone.
5686
5687    The realm to be matched is specified in the identity field.
5688
5689    The name field specifies the subdomain that may be updated. If set to "." or any other name at or above the zone apex, any name in the zone can be updated.
5690
5691    For example, if ``update-policy`` for the zone "example.com" includes ``grant EXAMPLE.COM ms-subdomain hosts.example.com. AA AAAA``, any machine with a valid principal in the realm ``EXAMPLE.COM`` is able to update address records at or below ``hosts.example.com``.
5692
5693``krb5-self``
5694    When a client sends an UPDATE using a Kerberos machine principal (for example, ``host/machine@REALM``), this rule allows records with the absolute name of ``machine`` to be updated, provided it has been authenticated by REALM. This is similar but not identical to ``ms-self``, due to the ``machine`` part of the Kerberos principal being an absolute name instead of a unqualified name.
5695
5696    The realm to be matched is specified in the identity field.
5697
5698    The name field has no effect on this rule; it should be set to "." as a placeholder.
5699
5700    For example, ``grant EXAMPLE.COM krb5-self . A AAAA`` allows any machine with a valid principal in the realm ``EXAMPLE.COM`` to update its own address records.
5701
5702``krb5-selfsub``
5703    This is similar to ``krb5-self``, except it also allows updates to any subdomain of the name specified in the ``machine`` part of the Kerberos principal, not just to the name itself.
5704
5705``krb5-subdomain``
5706    This rule is identical to ``ms-subdomain``, except that it works with Kerberos machine principals (i.e., ``host/machine@REALM``) rather than Windows machine principals.
5707
5708``tcp-self``
5709    This rule allows updates that have been sent via TCP and for which the standard mapping from the client's IP address into the ``in-addr.arpa`` and ``ip6.arpa`` namespaces match the name to be updated. The ``identity`` field must match that name. The ``name`` field should be set to ".". Note that, since identity is based on the client's IP address, it is not necessary for update request messages to be signed.
5710
5711    .. note::
5712        It is theoretically possible to spoof these TCP sessions.
5713
5714``6to4-self``
5715    This allows the name matching a 6to4 IPv6 prefix, as specified in :rfc:`3056`, to be updated by any TCP connection from either the 6to4 network or from the corresponding IPv4 address. This is intended to allow NS or DNAME RRsets to be added to the ``ip6.arpa`` reverse tree.
5716
5717    The ``identity`` field must match the 6to4 prefix in ``ip6.arpa``. The ``name`` field should be set to ".". Note that, since identity is based on the client's IP address, it is not necessary for update request messages to be signed.
5718
5719    In addition, if specified for an ``ip6.arpa`` name outside of the ``2.0.0.2.ip6.arpa`` namespace, the corresponding /48 reverse name can be updated. For example, TCP/IPv6 connections from 2001:DB8:ED0C::/48 can update records at ``C.0.D.E.8.B.D.0.1.0.0.2.ip6.arpa``.
5720
5721    .. note::
5722        It is theoretically possible to spoof these TCP sessions.
5723
5724``external``
5725    This rule allows ``named`` to defer the decision of whether to allow a given update to an external daemon.
5726
5727    The method of communicating with the daemon is specified in the identity field, the format of which is "``local:``\ path", where "path" is the location of a Unix-domain socket. (Currently, "local" is the only supported mechanism.)
5728
5729    Requests to the external daemon are sent over the Unix-domain socket as datagrams with the following format:
5730
5731    ::
5732
5733        Protocol version number (4 bytes, network byte order, currently 1)
5734        Request length (4 bytes, network byte order)
5735        Signer (null-terminated string)
5736        Name (null-terminated string)
5737        TCP source address (null-terminated string)
5738        Rdata type (null-terminated string)
5739        Key (null-terminated string)
5740        TKEY token length (4 bytes, network byte order)
5741        TKEY token (remainder of packet)
5742
5743    The daemon replies with a four-byte value in network byte order, containing either 0 or 1; 0 indicates that the specified update is not permitted, and 1 indicates that it is.
5744
5745.. _multiple_views:
5746
5747Multiple views
5748^^^^^^^^^^^^^^
5749
5750When multiple views are in use, a zone may be referenced by more than
5751one of them. Often, the views contain different zones with the same
5752name, allowing different clients to receive different answers for the
5753same queries. At times, however, it is desirable for multiple views to
5754contain identical zones. The ``in-view`` zone option provides an
5755efficient way to do this: it allows a view to reference a zone that was
5756defined in a previously configured view. For example:
5757
5758::
5759
5760   view internal {
5761       match-clients { 10/8; };
5762
5763       zone example.com {
5764       type master;
5765       file "example-external.db";
5766       };
5767   };
5768
5769   view external {
5770       match-clients { any; };
5771
5772       zone example.com {
5773       in-view internal;
5774       };
5775   };
5776
5777An ``in-view`` option cannot refer to a view that is configured later in
5778the configuration file.
5779
5780A ``zone`` statement which uses the ``in-view`` option may not use any
5781other options, with the exception of ``forward`` and ``forwarders``.
5782(These options control the behavior of the containing view, rather than
5783change the zone object itself.)
5784
5785Zone level ACLs (e.g., allow-query, allow-transfer), and other
5786configuration details of the zone, are all set in the view the referenced
5787zone is defined in. Care needs to be taken to ensure that ACLs are wide
5788enough for all views referencing the zone.
5789
5790An ``in-view`` zone cannot be used as a response policy zone.
5791
5792An ``in-view`` zone is not intended to reference a ``forward`` zone.
5793
5794.. _zone_file:
5795
5796Zone File
5797---------
5798
5799.. _types_of_resource_records_and_when_to_use_them:
5800
5801Types of Resource Records and When to Use Them
5802~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5803
5804This section, largely borrowed from :rfc:`1034`, describes the concept of a
5805Resource Record (RR) and explains when each type is used. Since the
5806publication of :rfc:`1034`, several new RRs have been identified and
5807implemented in the DNS. These are also included.
5808
5809Resource Records
5810^^^^^^^^^^^^^^^^
5811
5812A domain name identifies a node. Each node has a set of resource
5813information, which may be empty. The set of resource information
5814associated with a particular name is composed of separate RRs. The order
5815of RRs in a set is not significant and need not be preserved by name
5816servers, resolvers, or other parts of the DNS. However, sorting of
5817multiple RRs is permitted for optimization purposes: for example, to
5818specify that a particular nearby server be tried first. See
5819:ref:`the_sortlist_statement` and :ref:`rrset_ordering`.
5820
5821The components of a Resource Record are:
5822
5823owner name
5824    The domain name where the RR is found.
5825
5826type
5827    An encoded 16-bit value that specifies the type of the resource record.
5828
5829TTL
5830    The time-to-live of the RR. This field is a 32-bit integer in units of seconds, and is primarily used by resolvers when they cache RRs. The TTL describes how long a RR can be cached before it should be discarded.
5831
5832class
5833    An encoded 16-bit value that identifies a protocol family or instance of a protocol.
5834
5835RDATA
5836    The resource data. The format of the data is type- and sometimes class-specific.
5837
5838For a complete list of *types* of valid RRs, including those that have been obsoleted, please refer to https://en.wikipedia.org/wiki/List_of_DNS_record_types.
5839
5840The following *classes* of resource records are currently valid in the
5841DNS:
5842
5843IN
5844    The Internet.
5845
5846CH
5847    Chaosnet, a LAN protocol created at MIT in the mid-1970s. It was rarely used for its historical purpose, but was reused for BIND's built-in server information zones, e.g., ``version.bind``.
5848
5849HS
5850    Hesiod, an information service developed by MIT's Project Athena. It was used to share information about various systems databases, such as users, groups, printers, etc.
5851
5852The owner name is often implicit, rather than forming an integral part
5853of the RR. For example, many name servers internally form tree or hash
5854structures for the name space, and chain RRs off nodes. The remaining RR
5855parts are the fixed header (type, class, TTL), which is consistent for
5856all RRs, and a variable part (RDATA) that fits the needs of the resource
5857being described.
5858
5859The TTL field is a time limit on how long an RR can be
5860kept in a cache. This limit does not apply to authoritative data in
5861zones; it is also timed out, but by the refreshing policies for the
5862zone. The TTL is assigned by the administrator for the zone where the
5863data originates. While short TTLs can be used to minimize caching, and a
5864zero TTL prohibits caching, the realities of Internet performance
5865suggest that these times should be on the order of days for the typical
5866host. If a change is anticipated, the TTL can be reduced prior to
5867the change to minimize inconsistency, and then
5868increased back to its former value following the change.
5869
5870The data in the RDATA section of RRs is carried as a combination of
5871binary strings and domain names. The domain names are frequently used as
5872"pointers" to other data in the DNS.
5873
5874.. _rr_text:
5875
5876Textual expression of RRs
5877^^^^^^^^^^^^^^^^^^^^^^^^^
5878
5879RRs are represented in binary form in the packets of the DNS protocol,
5880and are usually represented in highly encoded form when stored in a name
5881server or resolver. In the examples provided in :rfc:`1034`, a style
5882similar to that used in primary files was employed in order to show the
5883contents of RRs. In this format, most RRs are shown on a single line,
5884although continuation lines are possible using parentheses.
5885
5886The start of the line gives the owner of the RR. If a line begins with a
5887blank, then the owner is assumed to be the same as that of the previous
5888RR. Blank lines are often included for readability.
5889
5890Following the owner are listed the TTL, type, and class of the RR. Class
5891and type use the mnemonics defined above, and TTL is an integer before
5892the type field. To avoid ambiguity in parsing, type and class
5893mnemonics are disjoint, TTLs are integers, and the type mnemonic is
5894always last. The IN class and TTL values are often omitted from examples
5895in the interest of clarity.
5896
5897The resource data or RDATA section of the RR is given using knowledge
5898of the typical representation for the data.
5899
5900For example, the RRs carried in a message might be shown as:
5901
5902 +---------------------+---------------+--------------------------------+
5903 | ``ISI.EDU.``        | ``MX``        | ``10 VENERA.ISI.EDU.``         |
5904 +---------------------+---------------+--------------------------------+
5905 |                     | ``MX``        | ``10 VAXA.ISI.EDU``            |
5906 +---------------------+---------------+--------------------------------+
5907 | ``VENERA.ISI.EDU``  | ``A``         | ``128.9.0.32``                 |
5908 +---------------------+---------------+--------------------------------+
5909 |                     | ``A``         | ``10.1.0.52``                  |
5910 +---------------------+---------------+--------------------------------+
5911 | ``VAXA.ISI.EDU``    | ``A``         | ``10.2.0.27``                  |
5912 +---------------------+---------------+--------------------------------+
5913 |                     | ``A``         | ``128.9.0.33``                 |
5914 +---------------------+---------------+--------------------------------+
5915
5916The MX RRs have an RDATA section which consists of a 16-bit number
5917followed by a domain name. The address RRs use a standard IP address
5918format to contain a 32-bit Internet address.
5919
5920The above example shows six RRs, with two RRs at each of three domain
5921names.
5922
5923Here's another possible example:
5924
5925 +----------------------+---------------+-------------------------------+
5926 | ``XX.LCS.MIT.EDU.``  | ``IN A``      | ``10.0.0.44``                 |
5927 +----------------------+---------------+-------------------------------+
5928 |                      | ``CH A``      | ``MIT.EDU. 2420``             |
5929 +----------------------+---------------+-------------------------------+
5930
5931This shows two addresses for ``XX.LCS.MIT.EDU``, each of a
5932different class.
5933
5934.. _mx_records:
5935
5936Discussion of MX Records
5937~~~~~~~~~~~~~~~~~~~~~~~~
5938
5939As described above, domain servers store information as a series of
5940resource records, each of which contains a particular piece of
5941information about a given domain name (which is usually, but not always,
5942a host). The simplest way to think of an RR is as a typed pair of data, a
5943domain name matched with a relevant datum and stored with some
5944additional type information, to help systems determine when the RR is
5945relevant.
5946
5947MX records are used to control delivery of email. The data specified in
5948the record is a priority and a domain name. The priority controls the
5949order in which email delivery is attempted, with the lowest number
5950first. If two priorities are the same, a server is chosen randomly. If
5951no servers at a given priority are responding, the mail transport agent
5952falls back to the next largest priority. Priority numbers do not
5953have any absolute meaning; they are relevant only respective to other
5954MX records for that domain name. The domain name given is the machine to
5955which the mail is delivered. It *must* have an associated address
5956record (A or AAAA) — CNAME is not sufficient.
5957
5958For a given domain, if there is both a CNAME record and an MX record,
5959the MX record is in error and is ignored. Instead, the mail is
5960delivered to the server specified in the MX record pointed to by the
5961CNAME. For example:
5962
5963 +------------------------+--------+--------+--------------+------------------------+
5964 | ``example.com.``       | ``IN`` | ``MX`` | ``10``       | ``mail.example.com.``  |
5965 +------------------------+--------+--------+--------------+------------------------+
5966 |                        | ``IN`` | ``MX`` | ``10``       | ``mail2.example.com.`` |
5967 +------------------------+--------+--------+--------------+------------------------+
5968 |                        | ``IN`` | ``MX`` | ``20``       | ``mail.backup.org.``   |
5969 +------------------------+--------+--------+--------------+------------------------+
5970 | ``mail.example.com.``  | ``IN`` | ``A``  | ``10.0.0.1`` |                        |
5971 +------------------------+--------+--------+--------------+------------------------+
5972 | ``mail2.example.com.`` | ``IN`` | ``A``  | ``10.0.0.2`` |                        |
5973 +------------------------+--------+--------+--------------+------------------------+
5974
5975Mail delivery is attempted to ``mail.example.com`` and
5976``mail2.example.com`` (in any order); if neither of those succeed,
5977delivery to ``mail.backup.org`` is attempted.
5978
5979.. _Setting_TTLs:
5980
5981Setting TTLs
5982~~~~~~~~~~~~
5983
5984The time-to-live of the RR field is a 32-bit integer represented in
5985units of seconds, and is primarily used by resolvers when they cache
5986RRs. The TTL describes how long a RR can be cached before it should be
5987discarded. The following three types of TTL are currently used in a zone
5988file.
5989
5990SOA
5991    The last field in the SOA is the negative caching TTL. This controls how long other servers cache no-such-domain (NXDOMAIN) responses from this server.
5992
5993    The maximum time for negative caching is 3 hours (3h).
5994
5995$TTL
5996    The $TTL directive at the top of the zone file (before the SOA) gives a default TTL for every RR without a specific TTL set.
5997
5998RR TTLs
5999    Each RR can have a TTL as the second field in the RR, which controls how long other servers can cache it.
6000
6001All of these TTLs default to units of seconds, though units can be
6002explicitly specified: for example, ``1h30m``.
6003
6004.. _ipv4_reverse:
6005
6006Inverse Mapping in IPv4
6007~~~~~~~~~~~~~~~~~~~~~~~
6008
6009Reverse name resolution (that is, translation from IP address to name)
6010is achieved by means of the ``in-addr.arpa`` domain and PTR records.
6011Entries in the in-addr.arpa domain are made in least-to-most significant
6012order, read left to right. This is the opposite order to the way IP
6013addresses are usually written. Thus, a machine with an IP address of
601410.1.2.3 would have a corresponding in-addr.arpa name of
60153.2.1.10.in-addr.arpa. This name should have a PTR resource record whose
6016data field is the name of the machine or, optionally, multiple PTR
6017records if the machine has more than one name. For example, in the
6018``example.com`` domain:
6019
6020 +--------------+-------------------------------------------------------+
6021 | ``$ORIGIN``  | ``2.1.10.in-addr.arpa``                               |
6022 +--------------+-------------------------------------------------------+
6023 | ``3``        | ``IN PTR foo.example.com.``                           |
6024 +--------------+-------------------------------------------------------+
6025
6026.. note::
6027
6028   The ``$ORIGIN`` line in this example is only to provide context;
6029   it does not necessarily appear in the actual
6030   usage. It is only used here to indicate that the example is
6031   relative to the listed origin.
6032
6033.. _zone_directives:
6034
6035Other Zone File Directives
6036~~~~~~~~~~~~~~~~~~~~~~~~~~
6037
6038The Master File Format was initially defined in :rfc:`1035` and has
6039subsequently been extended. While the Master File Format itself is
6040class-independent, all records in a master file must be of the same class.
6041
6042Master File Directives include ``$ORIGIN``, ``$INCLUDE``, and ``$TTL.``
6043
6044.. _atsign:
6045
6046The ``@`` (at-sign)
6047^^^^^^^^^^^^^^^^^^^
6048
6049When used in the label (or name) field, the asperand or at-sign (@)
6050symbol represents the current origin. At the start of the zone file, it
6051is the <``zone_name``>, followed by a trailing dot (.).
6052
6053.. _origin_directive:
6054
6055The ``$ORIGIN`` Directive
6056^^^^^^^^^^^^^^^^^^^^^^^^^
6057
6058Syntax: ``$ORIGIN`` domain-name [comment]
6059
6060``$ORIGIN`` sets the domain name that is appended to any
6061unqualified records. When a zone is first read, there is an implicit
6062``$ORIGIN`` <``zone_name``>\ ``.``, followed by a trailing dot. The
6063current ``$ORIGIN`` is appended to the domain specified in the
6064``$ORIGIN`` argument if it is not absolute.
6065
6066::
6067
6068   $ORIGIN example.com.
6069   WWW     CNAME   MAIN-SERVER
6070
6071is equivalent to
6072
6073::
6074
6075   WWW.EXAMPLE.COM. CNAME MAIN-SERVER.EXAMPLE.COM.
6076
6077.. _include_directive:
6078
6079The ``$INCLUDE`` Directive
6080^^^^^^^^^^^^^^^^^^^^^^^^^^
6081
6082Syntax: ``$INCLUDE`` filename [origin] [comment]
6083
6084This reads and processes the file ``filename`` as if it were included in the
6085file at this point. If ``origin`` is specified, the file is processed
6086with ``$ORIGIN`` set to that value; otherwise, the current ``$ORIGIN`` is
6087used.
6088
6089The origin and the current domain name revert to the values they had
6090prior to the ``$INCLUDE`` once the file has been read.
6091
6092.. note::
6093
6094   :rfc:`1035` specifies that the current origin should be restored after
6095   an ``$INCLUDE``, but it is silent on whether the current domain name
6096   should also be restored. BIND 9 restores both of them. This could be
6097   construed as a deviation from :rfc:`1035`, a feature, or both.
6098
6099.. _ttl_directive:
6100
6101The ``$TTL`` Directive
6102^^^^^^^^^^^^^^^^^^^^^^
6103
6104Syntax: ``$TTL`` default-ttl [comment]
6105
6106This sets the default Time To Live (TTL) for subsequent records with undefined
6107TTLs. Valid TTLs are of the range 0-2147483647 seconds.
6108
6109``$TTL`` is defined in :rfc:`2308`.
6110
6111.. _generate_directive:
6112
6113BIND Master File Extension: the ``$GENERATE`` Directive
6114~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6115
6116Syntax: ``$GENERATE`` range lhs [ttl] [class] type rhs [comment]
6117
6118``$GENERATE`` is used to create a series of resource records that only
6119differ from each other by an iterator. ``$GENERATE`` can be used to
6120easily generate the sets of records required to support sub /24 reverse
6121delegations described in :rfc:`2317`.
6122
6123::
6124
6125   $ORIGIN 0.0.192.IN-ADDR.ARPA.
6126   $GENERATE 1-2 @ NS SERVER$.EXAMPLE.
6127   $GENERATE 1-127 $ CNAME $.0
6128
6129is equivalent to
6130
6131::
6132
6133   0.0.0.192.IN-ADDR.ARPA. NS SERVER1.EXAMPLE.
6134   0.0.0.192.IN-ADDR.ARPA. NS SERVER2.EXAMPLE.
6135   1.0.0.192.IN-ADDR.ARPA. CNAME 1.0.0.0.192.IN-ADDR.ARPA.
6136   2.0.0.192.IN-ADDR.ARPA. CNAME 2.0.0.0.192.IN-ADDR.ARPA.
6137   ...
6138   127.0.0.192.IN-ADDR.ARPA. CNAME 127.0.0.0.192.IN-ADDR.ARPA.
6139
6140Both generate a set of A and MX records. Note the MX's right-hand side is a
6141quoted string. The quotes are stripped when the right-hand side is
6142processed.
6143
6144::
6145
6146   $ORIGIN EXAMPLE.
6147   $GENERATE 1-127 HOST-$ A 1.2.3.$
6148   $GENERATE 1-127 HOST-$ MX "0 ."
6149
6150is equivalent to
6151
6152::
6153
6154   HOST-1.EXAMPLE.   A  1.2.3.1
6155   HOST-1.EXAMPLE.   MX 0 .
6156   HOST-2.EXAMPLE.   A  1.2.3.2
6157   HOST-2.EXAMPLE.   MX 0 .
6158   HOST-3.EXAMPLE.   A  1.2.3.3
6159   HOST-3.EXAMPLE.   MX 0 .
6160   ...
6161   HOST-127.EXAMPLE. A  1.2.3.127
6162   HOST-127.EXAMPLE. MX 0 .
6163
6164``range``
6165    This can be one of two forms: start-stop or start-stop/step. If the first form is used, then step is set to 1. "start", "stop", and "step" must be positive integers between 0 and (2^31)-1. "start" must not be larger than "stop".
6166
6167``owner``
6168    This describes the owner name of the resource records to be created. Any single ``$`` (dollar sign) symbols within the ``owner`` string are replaced by the iterator value. To get a ``$`` in the output, escape the ``$`` using a backslash ``\``, e.g., ``\$``. The ``$`` may optionally be followed by modifiers which change the offset from the iterator, field width, and base.
6169
6170    Modifiers are introduced by a ``{`` (left brace) immediately following the ``$`` as in  ``${offset[,width[,base]]}``. For example, ``${-20,3,d}`` subtracts 20 from the current value and prints the result as a decimal in a zero-padded field of width 3. Available output forms are decimal (``d``), octal (``o``), hexadecimal (``x`` or ``X`` for uppercase), and nibble (``n`` or ``N`` for uppercase).
6171
6172    The default modifier is ``${0,0,d}``. If the ``owner`` is not absolute, the current ``$ORIGIN`` is appended to the name.
6173
6174    In nibble mode, the value is treated as if it were a reversed hexadecimal string, with each hexadecimal digit as a separate label. The width field includes the label separator.
6175
6176    For compatibility with earlier versions, ``$$`` is still recognized as indicating a literal $ in the output.
6177
6178``ttl``
6179    This specifies the time-to-live of the generated records. If not specified, this is inherited using the normal TTL inheritance rules.
6180
6181    ``class`` and ``ttl`` can be entered in either order.
6182
6183``class``
6184    This specifies the class of the generated records. This must match the zone class if it is specified.
6185
6186    ``class`` and ``ttl`` can be entered in either order.
6187
6188``type``
6189    This can be any valid type.
6190
6191``rdata``
6192    This is a string containing the RDATA of the resource record to be created. It may be quoted if there are spaces in the string; the quotation marks do not appear in the generated record.
6193
6194The ``$GENERATE`` directive is a BIND extension and not part of the
6195standard zone file format.
6196
6197.. _zonefile_format:
6198
6199Additional File Formats
6200~~~~~~~~~~~~~~~~~~~~~~~
6201
6202In addition to the standard text format, BIND 9 supports the ability
6203to read or dump to zone files in other formats.
6204
6205The ``raw`` format is a binary representation of zone data in a manner
6206similar to that used in zone transfers. Since it does not require
6207parsing text, load time is significantly reduced.
6208
6209An even faster alternative is the ``map`` format, which is an image of a
6210BIND 9 in-memory zone database; it can be loaded directly
6211into memory via the ``mmap()`` function and the zone can begin serving
6212queries almost immediately.
6213
6214For a primary server, a zone file in ``raw`` or ``map`` format is
6215expected to be generated from a textual zone file by the
6216``named-compilezone`` command. For a secondary server or a dynamic
6217zone, the zone file is automatically generated when ``named`` dumps the zone contents
6218after zone transfer or when applying prior updates, if one of these
6219formats is specified by the ``masterfile-format`` option.
6220
6221If a zone file in a binary format needs manual modification, it first
6222must be converted to a textual form by the ``named-compilezone``
6223command. Make any necessary modifications to the text file, and
6224then convert it to the binary form via the ``named-compilezone``
6225command again.
6226
6227Note that ``map`` format is extremely architecture-specific. A ``map``
6228file *cannot* be used on a system with different pointer size,
6229endianness, or data alignment than the system on which it was generated,
6230and should in general be used only inside a single system. While ``raw``
6231format uses network byte order and avoids architecture-dependent data
6232alignment so that it is as portable as possible, it is also primarily
6233expected to be used inside the same single system. To export a zone file
6234in either ``raw`` or ``map`` format, or make a portable backup of such a
6235file, conversion to ``text`` format is recommended.
6236
6237.. _statistics:
6238
6239BIND 9 Statistics
6240-----------------
6241
6242BIND 9 maintains lots of statistics information and provides several
6243interfaces for users to access those statistics. The available
6244statistics include all statistics counters that are meaningful in BIND 9,
6245and other information that is considered useful.
6246
6247The statistics information is categorized into the following sections:
6248
6249Incoming Requests
6250   The number of incoming DNS requests for each OPCODE.
6251
6252Incoming Queries
6253   The number of incoming queries for each RR type.
6254
6255Outgoing Queries
6256   The number of outgoing queries for each RR type sent from the internal
6257   resolver, maintained per view.
6258
6259Name Server Statistics
6260   Statistics counters for incoming request processing.
6261
6262Zone Maintenance Statistics
6263   Statistics counters regarding zone maintenance operations, such as zone
6264   transfers.
6265
6266Resolver Statistics
6267   Statistics counters for name resolutions performed in the internal resolver,
6268   maintained per view.
6269
6270Cache DB RRsets
6271   Statistics counters related to cache contents, maintained per view.
6272
6273   The "NXDOMAIN" counter is the number of names that have been cached as
6274   nonexistent.  Counters named for RR types indicate the number of active
6275   RRsets for each type in the cache database.
6276
6277   If an RR type name is preceded by an exclamation mark (!), it represents the
6278   number of records in the cache which indicate that the type does not exist
6279   for a particular name (this is also known as "NXRRSET").  If an RR type name
6280   is preceded by a hash mark (#), it represents the number of RRsets for this
6281   type that are present in the cache but whose TTLs have expired; these RRsets
6282   may only be used if stale answers are enabled.  If an RR type name is
6283   preceded by a tilde (~), it represents the number of RRsets for this type
6284   that are present in the cache database but are marked for garbage collection;
6285   these RRsets cannot be used.
6286
6287Socket I/O Statistics
6288   Statistics counters for network-related events.
6289
6290A subset of Name Server Statistics is collected and shown per zone for
6291which the server has the authority, when ``zone-statistics`` is set to
6292``full`` (or ``yes``), for backward compatibility. See the description of
6293``zone-statistics`` in :ref:`options` for further details.
6294
6295These statistics counters are shown with their zone and view names. The
6296view name is omitted when the server is not configured with explicit
6297views.
6298
6299There are currently two user interfaces to get access to the statistics.
6300One is in the plain text format dumped to the file specified by the
6301``statistics-file`` configuration option; the other is remotely
6302accessible via a statistics channel when the ``statistics-channels``
6303statement is specified in the configuration file (see :ref:`statschannels`.)
6304
6305.. _statsfile:
6306
6307The Statistics File
6308~~~~~~~~~~~~~~~~~~~
6309
6310The text format statistics dump begins with a line, like:
6311
6312``+++ Statistics Dump +++ (973798949)``
6313
6314The number in parentheses is a standard Unix-style timestamp, measured
6315in seconds since January 1, 1970. Following that line is a set of
6316statistics information, which is categorized as described above. Each
6317section begins with a line, like:
6318
6319``++ Name Server Statistics ++``
6320
6321Each section consists of lines, each containing the statistics counter
6322value followed by its textual description; see below for available
6323counters. For brevity, counters that have a value of 0 are not shown in
6324the statistics file.
6325
6326The statistics dump ends with the line where the number is identical to
6327the number in the beginning line; for example:
6328
6329``--- Statistics Dump --- (973798949)``
6330
6331.. _statistics_counters:
6332
6333Statistics Counters
6334~~~~~~~~~~~~~~~~~~~
6335
6336The following lists summarize the statistics counters that BIND 9 provides.
6337For each counter, the abbreviated
6338symbol name is given; these symbols are shown in the statistics
6339information accessed via an HTTP statistics channel.
6340The description of the counter is also shown in the
6341statistics file but, in this document, may be slightly
6342modified for better readability.
6343
6344.. _stats_counters:
6345
6346Name Server Statistics Counters
6347^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6348
6349``Requestv4``
6350    This indicates the number of IPv4 requests received. Note: this also counts non-query requests.
6351
6352``Requestv6``
6353    This indicates the number of IPv6 requests received. Note: this also counts non-query requests.
6354
6355``ReqEdns0``
6356    This indicates the number of requests received with EDNS(0).
6357
6358``ReqBadEDN SVer``
6359    This indicates the number of requests received with an unsupported EDNS version.
6360
6361``ReqTSIG``
6362    This indicates the number of requests received with TSIG.
6363
6364``ReqSIG0``
6365    This indicates the number of requests received with SIG(0).
6366
6367``ReqBadSIG``
6368    This indicates the number of requests received with an invalid (TSIG or SIG(0)) signature.
6369
6370``ReqTCP``
6371    This indicates the number of TCP requests received.
6372
6373``AuthQryRej``
6374    This indicates the number of rejected authoritative (non-recursive) queries.
6375
6376``RecQryRej``
6377    This indicates the number of rejected recursive queries.
6378
6379``XfrRej``
6380    This indicates the number of rejected zone transfer requests.
6381
6382``UpdateRej``
6383    This indicates the number of rejected dynamic update requests.
6384
6385``Response``
6386    This indicates the number of responses sent.
6387
6388``RespTruncated``
6389    This indicates the number of truncated responses sent.
6390
6391``RespEDNS0``
6392    This indicates the number of responses sent with EDNS(0).
6393
6394``RespTSIG``
6395    This indicates the number of responses sent with TSIG.
6396
6397``RespSIG0``
6398    This indicates the number of responses sent with SIG(0).
6399
6400``QrySuccess``
6401    This indicates the number of queries that resulted in a successful answer, meaning queries which return a NOERROR response with at least one answer RR. This corresponds to the ``success`` counter of previous versions of BIND 9.
6402
6403``QryAuthAns``
6404    This indicates the number of queries that resulted in an authoritative answer.
6405
6406``QryNoauthAns``
6407    This indicates the number of queries that resulted in a non-authoritative answer.
6408
6409``QryReferral``
6410    This indicates the number of queries that resulted in a referral answer. This corresponds to the ``referral`` counter of previous versions of BIND 9.
6411
6412``QryNxrrset``
6413    This indicates the number of queries that resulted in NOERROR responses with no data. This corresponds to the ``nxrrset`` counter of previous versions of BIND 9.
6414
6415``QrySERVFAIL``
6416    This indicates the number of queries that resulted in SERVFAIL.
6417
6418``QryFORMERR``
6419    This indicates the number of queries that resulted in FORMERR.
6420
6421``QryNXDOMAIN``
6422    This indicates the number of queries that resulted in NXDOMAIN. This corresponds to the ``nxdomain`` counter of previous versions of BIND 9.
6423
6424``QryRecursion``
6425    This indicates the number of queries that caused the server to perform recursion in order to find the final answer. This corresponds to the ``recursion`` counter of previous versions of BIND 9.
6426
6427``QryDuplicate``
6428    This indicates the number of queries which the server attempted to recurse but for which it discovered an existing query with the same IP address, port, query ID, name, type, and class already being processed. This corresponds to the ``duplicate`` counter of previous versions of BIND 9.
6429
6430``QryDropped``
6431    This indicates the number of recursive queries for which the server discovered an excessive number of existing recursive queries for the same name, type, and class, and which were subsequently dropped. This is the number of dropped queries due to the reason explained with the ``clients-per-query`` and ``max-clients-per-query`` options (see :ref:`clients-per-query <clients-per-query>`). This corresponds to the ``dropped`` counter of previous versions of BIND 9.
6432
6433``QryFailure``
6434    This indicates the number of query failures. This corresponds to the ``failure`` counter of previous versions of BIND 9. Note: this counter is provided mainly for backward compatibility with previous versions; normally, more fine-grained counters such as ``AuthQryRej`` and ``RecQryRej`` that would also fall into this counter are provided, so this counter is not of much interest in practice.
6435
6436``QryNXRedir``
6437    This indicates the number of queries that resulted in NXDOMAIN that were redirected.
6438
6439``QryNXRedirRLookup``
6440    This indicates the number of queries that resulted in NXDOMAIN that were redirected and resulted in a successful remote lookup.
6441
6442``XfrReqDone``
6443    This indicates the number of requested and completed zone transfers.
6444
6445``UpdateReqFwd``
6446    This indicates the number of forwarded update requests.
6447
6448``UpdateRespFwd``
6449    This indicates the number of forwarded update responses.
6450
6451``UpdateFwdFail``
6452    This indicates the number of forwarded dynamic updates that failed.
6453
6454``UpdateDone``
6455    This indicates the number of completed dynamic updates.
6456
6457``UpdateFail``
6458    This indicates the number of failed dynamic updates.
6459
6460``UpdateBadPrereq``
6461    This indicates the number of dynamic updates rejected due to a prerequisite failure.
6462
6463``RateDropped``
6464    This indicates the number of responses dropped due to rate limits.
6465
6466``RateSlipped``
6467    This indicates the number of responses truncated by rate limits.
6468
6469``RPZRewrites``
6470    This indicates the number of response policy zone rewrites.
6471
6472.. _zone_stats:
6473
6474Zone Maintenance Statistics Counters
6475^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6476
6477``NotifyOutv4``
6478    This indicates the number of IPv4 notifies sent.
6479
6480``NotifyOutv6``
6481    This indicates the number of IPv6 notifies sent.
6482
6483``NotifyInv4``
6484    This indicates the number of IPv4 notifies received.
6485
6486``NotifyInv6``
6487    This indicates the number of IPv6 notifies received.
6488
6489``NotifyRej``
6490    This indicates the number of incoming notifies rejected.
6491
6492``SOAOutv4``
6493    This indicates the number of IPv4 SOA queries sent.
6494
6495``SOAOutv6``
6496    This indicates the number of IPv6 SOA queries sent.
6497
6498``AXFRReqv4``
6499    This indicates the requested IPv4 AXFR.
6500
6501``AXFRReqv6``
6502    This indicates the requested IPv6 AXFR.
6503
6504``IXFRReqv4``
6505    This indicates the requested IPv4 IXFR.
6506
6507``IXFRReqv6``
6508    This indicates the requested IPv6 IXFR.
6509
6510``XfrSuccess``
6511    This indicates the number of successful zone transfer requests.
6512
6513``XfrFail``
6514    This indicates the number of failed zone transfer requests.
6515
6516.. _resolver_stats:
6517
6518Resolver Statistics Counters
6519^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6520
6521``Queryv4``
6522    This indicates the number of IPv4 queries sent.
6523
6524``Queryv6``
6525    This indicates the number of IPv6 queries sent.
6526
6527``Responsev4``
6528    This indicates the number of IPv4 responses received.
6529
6530``Responsev6``
6531    This indicates the number of IPv6 responses received.
6532
6533``NXDOMAIN``
6534    This indicates the number of NXDOMAINs received.
6535
6536``SERVFAIL``
6537    This indicates the number of SERVFAILs received.
6538
6539``FORMERR``
6540    This indicates the number of FORMERRs received.
6541
6542``OtherError``
6543    This indicates the number of other errors received.
6544
6545``EDNS0Fail``
6546    This indicates the number of EDNS(0) query failures.
6547
6548``Mismatch``
6549    This indicates the number of mismatched responses received, meaning the DNS ID, response's source address, and/or the response's source port does not match what was expected. (The port must be 53 or as defined by the ``port`` option.) This may be an indication of a cache poisoning attempt.
6550
6551``Truncated``
6552    This indicates the number of truncated responses received.
6553
6554``Lame``
6555    This indicates the number of lame delegations received.
6556
6557``Retry``
6558    This indicates the number of query retries performed.
6559
6560``QueryAbort``
6561    This indicates the number of queries aborted due to quota control.
6562
6563``QuerySockFail``
6564    This indicates the number of failures in opening query sockets. One common reason for such failures is due to a limitation on file descriptors.
6565
6566``QueryTimeout``
6567    This indicates the number of query timeouts.
6568
6569``GlueFetchv4``
6570    This indicates the number of IPv4 NS address fetches invoked.
6571
6572``GlueFetchv6``
6573    This indicates the number of IPv6 NS address fetches invoked.
6574
6575``GlueFetchv4Fail``
6576    This indicates the number of failed IPv4 NS address fetches.
6577
6578``GlueFetchv6Fail``
6579    This indicates the number of failed IPv6 NS address fetches.
6580
6581``ValAttempt``
6582    This indicates the number of attempted DNSSEC validations.
6583
6584``ValOk``
6585    This indicates the number of successful DNSSEC validations.
6586
6587``ValNegOk``
6588    This indicates the number of successful DNSSEC validations on negative information.
6589
6590``ValFail``
6591    This indicates the number of failed DNSSEC validations.
6592
6593``QryRTTnn``
6594    This provides a frequency table on query round-trip times (RTTs). Each ``nn`` specifies the corresponding frequency. In the sequence of ``nn_1``, ``nn_2``, ..., ``nn_m``, the value of ``nn_i`` is the number of queries whose RTTs are between ``nn_(i-1)`` (inclusive) and ``nn_i`` (exclusive) milliseconds. For the sake of convenience, we define ``nn_0`` to be 0. The last entry should be represented as ``nn_m+``, which means the number of queries whose RTTs are equal to or greater than ``nn_m`` milliseconds.
6595
6596.. _socket_stats:
6597
6598Socket I/O Statistics Counters
6599^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6600
6601Socket I/O statistics counters are defined per socket type, which are
6602``UDP4`` (UDP/IPv4), ``UDP6`` (UDP/IPv6), ``TCP4`` (TCP/IPv4), ``TCP6``
6603(TCP/IPv6), ``Unix`` (Unix Domain), and ``FDwatch`` (sockets opened
6604outside the socket module). In the following list, ``<TYPE>`` represents
6605a socket type. Not all counters are available for all socket types;
6606exceptions are noted in the descriptions.
6607
6608``<TYPE>Open``
6609    This indicates the number of sockets opened successfully. This counter does not apply to the ``FDwatch`` type.
6610
6611``<TYPE>OpenFail``
6612    This indicates the number of failures to open sockets. This counter does not apply to the ``FDwatch`` type.
6613
6614``<TYPE>Close``
6615    This indicates the number of closed sockets.
6616
6617``<TYPE>BindFail``
6618    This indicates the number of failures to bind sockets.
6619
6620``<TYPE>ConnFail``
6621    This indicates the number of failures to connect sockets.
6622
6623``<TYPE>Conn``
6624    This indicates the number of connections established successfully.
6625
6626``<TYPE>AcceptFail``
6627    This indicates the number of failures to accept incoming connection requests. This counter does not apply to the ``UDP`` and ``FDwatch`` types.
6628
6629``<TYPE>Accept``
6630    This indicates the number of incoming connections successfully accepted. This counter does not apply to the ``UDP`` and ``FDwatch`` types.
6631
6632``<TYPE>SendErr``
6633    This indicates the number of errors in socket send operations.
6634
6635``<TYPE>RecvErr``
6636    This indicates the number of errors in socket receive operations, including errors of send operations on a connected UDP socket, notified by an ICMP error message.
6637