I've used the following command to remove the trailing whitespace for all tracked text files: git grep -Il '' | xargs sed -i 's/[ \t]*$//'
356 KiB
Configuration Reference
The operational functionality of BIND 9 is defined using the file named.conf, which is typically located in /etc or /usr/local/etc/namedb, depending on the operating system or distribution. A further file rndc.conf will be present if rndc is being run from a remote host, but is not required if rndc is being run from localhost (the same system as BIND 9 is running on).
Configuration File (named.conf)
The file named.conf
may contain three types of entities:
- Comment
-
Multiple comment formats are supported <comment_syntax>
. - Block
-
Blocks <configuration_blocks>
are containers forstatements <Statement>
which either have common functionality - for example, the definition of a cryptographic key in akey
block - or which define the scope of the statement - for example, a statement which appears in azone
block has scope only for that zone.Blocks are organized hierarchically within
named.conf
and may have a number of different properties:- Certain blocks cannot be nested inside other blocks and thus may be
regarded as the topmost-level blocks: for example, the
options
block and thelogging
block. - Certain blocks can appear multiple times, in which case they have an
associated name to disambiguate them: for example, the
zone
block (zone example.com { ... };
) or thekey
block (key mykey { ... };
). - Certain blocks may be "nested" within other blocks. For example, the
zone
block may appear within aview
block.
The description of each block in this manual lists its permissible locations.
- Certain blocks cannot be nested inside other blocks and thus may be
regarded as the topmost-level blocks: for example, the
- Statement
-
- Statements define and control specific BIND behaviors.
- Statements may have a single parameter (a Value) or
multiple parameters (Argument/Value pairs). For
example, the
recursion
statement takes a single value parameter - in this case, the stringyes
orno
(recursion yes;
) - while theport
statement takes a numeric value defining the DNS port number (port 53;
). More complex statements take one or more argument/value pairs. Thealso-notify
statement may take a number of such argument/value pairs, such asalso-notify port 5353;
, whereport
is the argument and5353
is the corresponding value. - Statements can appear in a single
block <Block>
- for example, analgorithm
statement can appear only in akey
block - or in multiple blocks - for example, analso-notify
statement can appear in anoptions
block where it has global (server-wide) scope, in azone
block where it has scope only for the specific zone (and overrides any global statement), or even in aview
block where it has scope for only that view (and overrides any global statement).
The file named.conf
may further contain one or more instances of the include <include_grammar>
Directive. This directive is provided for
administrative convenience in assembling a complete named.conf
file and plays no
subsequent role in BIND 9 operational characteristics or
functionality.
Note
Over a period of many years the BIND ARM acquired a bewildering array of terminology. Many of the terms used described similar concepts and served only to add a layer of complexity, possibly confusion, and perhaps mystique to BIND 9 configuration. The ARM now uses only the terms Block, Statement, Argument, Value, and Directive to describe all entities used in BIND 9 configuration.
Comment Syntax
The BIND 9 comment syntax allows comments to appear anywhere that whitespace may appear in a BIND configuration file. To appeal to programmers of all kinds, they can be written in the C, C++, or shell/Perl style.
Syntax
/* This is a BIND comment as in C */
// This is a BIND comment as in C++
# This is a BIND comment as in common Unix shells
# and Perl
Definition and Usage
Comments can be inserted anywhere that whitespace may appear in a BIND configuration file.
C-style comments start with the two characters /* (slash, star) and end with */ (star, slash). Because they are completely delimited with these characters, they can be used to comment only a portion of a line or to span multiple lines.
C-style comments cannot be nested. For example, the following is not valid because the entire comment ends with the first */:
/* This is the start of a comment.
This is still part of the comment.
/* This is an incorrect attempt at nesting a comment. */
This is no longer in any comment. */
C++-style comments start with the two characters // (slash, slash) and continue to the end of the physical line. They cannot be continued across multiple physical lines; to have one logical comment span multiple lines, each line must use the // pair. For example:
// This is the start of a comment. The next line
// is a new comment, even though it is logically
// part of the previous comment.
Shell-style (or Perl-style) comments start with the character
#
(number/pound sign) and continue to the end of the
physical line, as in C++ comments. For example:
# This is the start of a comment. The next line
# is a new comment, even though it is logically
# part of the previous comment.
Warning
The semicolon (;
) character cannot start a comment,
unlike in a zone file. The semicolon indicates the end of a
configuration statement.
Configuration Layout Styles
BIND is very picky about opening and closing brackets/braces, semicolons, and all the other separators defined in the formal syntaxes in later sections. There are many layout styles that can assist in minimizing errors, as shown in the following examples:
// dense single-line style
zone "example.com" in{type secondary; file "secondary.example.com"; primaries {10.0.0.1;};};
// single-statement-per-line style
zone "example.com" in{
type secondary;
file "secondary.example.com";
primaries {10.0.0.1;};
};
// spot the difference
zone "example.com" in{
type secondary;
file "sec.secondary.com";
primaries {10.0.0.1;}; };
include
Directive
include filename;
include
Directive Definition and
Usage
The include directive inserts the specified file (or files if a valid glob expression is detected) at the point where the include directive is encountered. The include directive facilitates the administration of configuration files by permitting the reading or writing of some things but not others. For example, the statement could include private keys that are readable only by the name server.
Address Match Lists
Syntax
An address match list is a list of semicolon-separated address_match_element
s.
{ <address_match_element>; ... };
Each element is then defined as:
address_match_element
[ ! ] ( <ip_address> | <netprefix> | key <server_key> | <acl_name> | { address_match_list } )
Definition and Usage
Address match lists are primarily used to determine access control
for various server operations. They are also used in the listen-on
and sortlist
statements. The
elements which constitute an address match list can be any of the
following:
ip_address
: an IP address (IPv4 or IPv6)netprefix
: an IP prefix (in/
notation)server_key
: a key ID, as defined by thekey
statementacl_name
: the name of an address match list defined with theacl
statement- a nested address match list enclosed in braces
Elements can be negated with a leading exclamation mark
(!
), and the match list names "any", "none", "localhost",
and "localnets" are predefined. More information on those names can be
found in the description of the acl
statement.
The addition of the key clause made the name of this syntactic element something of a misnomer, since security keys can be used to validate access without regard to a host or network address. Nonetheless, the term "address match list" is still used throughout the documentation.
When a given IP address or prefix is compared to an address match list, the comparison takes place in approximately O(1) time. However, key comparisons require that the list of keys be traversed until a matching key is found, and therefore may be somewhat slower.
The interpretation of a match depends on whether the list is being
used for access control, defining listen-on
ports, or in a sortlist
, and whether the
element was negated.
When used as an access control list, a non-negated match allows
access and a negated match denies access. If there is no match, access
is denied. The clauses allow-notify
, allow-recursion
, allow-recursion-on
, allow-query
, allow-query-on
, allow-query-cache
, allow-query-cache-on
, allow-transfer
, allow-update
, allow-update-forwarding
, and blackhole
all use address
match lists. Similarly, the listen-on
option causes the server to refuse queries
on any of the machine's addresses which do not match the list.
Order of insertion is significant. If more than one element in an ACL
is found to match a given IP address or prefix, preference is given to
the one that came first in the ACL definition. Because of this
first-match behavior, an element that defines a subset of another
element in the list should come before the broader element, regardless
of whether either is negated. For example, in
1.2.3/24; ! 1.2.3.13;
the 1.2.3.13 element is completely
useless because the algorithm matches any lookup for 1.2.3.13 to the
1.2.3/24 element. Using ! 1.2.3.13; 1.2.3/24
fixes that
problem by blocking 1.2.3.13 via the negation, but all other 1.2.3.*
hosts pass through.
Glossary of Terms Used
Following is a list of terms used throughout the BIND configuration file documentation:
acl_name
-
The name of an
address_match_list
as defined by theacl
statement. address_match_list
-
See
address_match_lists
. boolean
-
Either
yes
orno
. The wordstrue
andfalse
are also accepted, as are the numbers1
and0
. domain_name
-
A quoted string which is used as a DNS name; for example:
my.test.domain
. fixedpoint
-
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.
integer
-
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.
ip_address
-
An
ipv4_address
oripv6_address
. ipv4_address
-
An IPv4 address with exactly four integer elements valued 0 through 255 and separated by dots (
.
), such as192.168.1.1
(a "dotted-decimal" notation with all four elements present). ipv6_address
-
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 a 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, only interface names as link identifiers are supported, assuming one-to-one mapping between interfaces and links. For example, a link-local addressfe80::1
on the link attached to the interfacene0
can be specified asfe80::1%ne0
. Note that on most systems link-local addresses always have ambiguity and need to be disambiguated. netprefix
-
An IP network specified as an
ip_address
, followed by a slash (/
) and then the number of bits in the netmask. Trailing zeros in anip_address
may be omitted. For example,127/8
is the network127.0.0.0
with netmask255.0.0.0
and1.2.3.0/28
is network1.2.3.0
with netmask255.255.255.240
. When specifying a prefix involving an IPv6-scoped address, the scope may be omitted. In that case, the prefix matches packets from any scope. percentage
-
An integer value followed by
%
to represent percent. port
-
An IP port
integer
. It 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. portrange
-
A list of a
port
or a port range. A port range is specified in the form ofrange
followed by twoport
s,port_low
andport_high
, which represents port numbers fromport_low
throughport_high
, inclusive.port_low
must not be larger thanport_high
. For example,range 1024 65535
represents ports from 1024 through 65535. The asterisk (*
) character is not allowed as a validport
or as a port range boundary. remote-servers
-
A named list of one or more
ip_address
es with optionaltls_id
,server_key
, and/orport
. Aremote-servers
list may include otherremote-servers
lists. Seeprimaries
block. server_key
-
A
domain_name
representing the name of a shared key, to be used fortransaction security <tsig>
. Keys are defined usingkey
blocks.
size
sizeval
A 64-bit unsigned integer.
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
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.
Some statements also accept the keywords
unlimited
ordefault
:unlimited
generally means "as big as possible," and is usually the best way to safely set a very large number.default
uses the limit that was in force when the server was started.
tls_id
-
A named TLS configuration object which defines a TLS key and certificate. See
tls
block.
Blocks
A BIND 9 configuration consists of blocks, statements, and comments.
The following blocks are supported:
acl
Defines a named IP address matching list, for access control and other uses.
controls
Declares control channels to be used by the
rndc
utility.dnssec-policy
Describes a DNSSEC key and signing policy for zones. See
dnssec-policy
for details.key
Specifies key information for use in authentication and authorization using TSIG.
logging
Specifies what information the server logs and where the log messages are sent.
masters
Synonym for
primaries
.options
Controls global server configuration options and sets defaults for other statements.
parental-agents
Defines a named list of servers for inclusion in primary and secondary zones'
parental-agents
lists.primaries
Defines a named list of servers for inclusion in stub and secondary zones'
primaries
oralso-notify
lists. (Note: this is a synonym for the original keywordmasters
, which can still be used, but is no longer the preferred terminology.)server
Sets certain configuration options on a per-server basis.
statistics-channels
Declares communication channels to get access to
named
statistics.tls
Specifies configuration information for a TLS connection, including a
key-file
,cert-file
,ca-file
,dhparam-file
,remote-hostname
,ciphers
,protocols
,prefer-server-ciphers
, andsession-tickets
.http
Specifies configuration information for an HTTP connection, including
endpoints
,listener-clients
, andstreams-per-connection
.trust-anchors
Defines DNSSEC trust anchors: if used with the
initial-key
orinitial-ds
keyword, trust anchors are kept up-to-date using5011
trust anchor maintenance; if used withstatic-key
orstatic-ds
, keys are permanent.managed-keys
Is identical to
trust-anchors
; this option is deprecated in favor oftrust-anchors
with theinitial-key
keyword, and may be removed in a future release.trusted-keys
Defines permanent trusted DNSSEC keys; this option is deprecated in favor of
trust-anchors
with thestatic-key
keyword, and may be removed in a future release.view
Defines a view.
zone
Defines a zone.
The logging
and
options
statements may only occur once per configuration.
acl
Block Grammar
acl
Block Definition and Usage
The acl
statement
assigns a symbolic name to an address match list. It gets its name from
one of the primary uses of address match lists: Access Control Lists
(ACLs).
The following ACLs are built-in:
any
Matches all hosts.
none
Matches no hosts.
localhost
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.localnets
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 cases,localnets
only matches the local IPv6 addresses, just likelocalhost
.
controls
Block Grammar
controls
Block Definition and
Usage
The controls
statement declares control channels to be used by system administrators
to manage the operation of the name server. These control channels are
used by the rndc
utility to send commands to and retrieve non-DNS results from a name
server.
read-only
-
If the
read-only
argument ison
, the control channel is limited to the following set of read-only commands:nta -dump
,null
,status
,showzone
,testgen
, andzonestatus
. By default,read-only
is not enabled and the control channel allows read-write access.
If no controls
statement is present, named
sets up a default control channel listening
on the loopback address 127.0.0.1 and its IPv6 counterpart, ::1. In this
case, and also when the controls
statement is present but does not have a
keys
clause, named
attempts to load the
command channel key from the file . To create an rndc.key
file, run rndc-confgen -a
.
To disable the command channel, use an empty controls
statement:
controls { };
.
key
Block Grammar
key
Block
Definition and Usage
The key
statement defines a shared secret key for use
with TSIG (see tsig
) or
the command channel (see controls
).
The key
statement can occur at the top level of the
configuration file or inside a view
statement. Keys defined in top-level
key
statements can be used in all views. Keys intended for
use in a controls
statement must be defined at the top level.
The server_key
,
also known as the key name, is a domain name that uniquely identifies
the key. It can be used in a server
statement to cause requests sent to
that server to be signed with this key, or in address match lists to
verify that incoming requests have been signed with a key matching this
name, algorithm, and secret.
logging
Block Grammar
logging
Block Definition and
Usage
The logging
statement configures a wide variety of logging options for the name
server. Its channel
phrase associates output methods, format options, and severity levels
with a name that can then be used with the category
phrase to select how
various classes of messages are logged.
Only one logging
statement is used to define as many channels and categories as desired.
If there is no logging
statement, the logging configuration is:
logging {
category default { default_syslog; default_debug; };
category unmatched { null; };
};
If named
is
started with the -L <named -L>
option, it logs to the
specified file at startup, instead of using syslog. In this case the
logging configuration is:
logging {
category default { default_logfile; default_debug; };
category unmatched { null; };
};
The logging configuration is only established when the entire
configuration file has been parsed. When the server starts up, all
logging messages regarding syntax errors in the configuration file go to
the default channels, or to standard error if the -g <named -g>
option
was specified.
The channel
Phrase
All log output goes to one or more channels
; there is no
limit to the number of channels that can be created.
Every channel definition must include a destination clause that says
whether messages selected for the channel go to a file, go to a
particular syslog facility, go to the standard error stream, or are
discarded. The definition can optionally also limit the message severity
level that is accepted by the channel (the default is
info
), and whether to include a named
-generated time
stamp, the category name, and/or the severity level (the default is not
to include any).
file
-
The
file
destination clause directs the channel to a disk file. It can include additional arguments to specify how large the file is allowed to become before it is rolled to a backup file (size
), how many backup versions of the file are saved each time this happens (versions
), and the format to use for naming backup versions (suffix
).The
size
option is used to limit log file growth. If the file ever exceeds the specified size, thennamed
stops writing to the file unless it has aversions
option associated with it. If backup versions are kept, the files are rolled as described below. If there is noversions
option, no more data is written to the log until some out-of-band mechanism removes or truncates the log to less than the maximum size. The default behavior is not to limit the size of the file.File rolling only occurs when the file exceeds the size specified with the
size
option. No backup versions are kept by default; any existing log file is simply appended. Theversions
option specifies how many backup versions of the file should be kept. If set tounlimited
, there is no limit.The
suffix
option can be set to eitherincrement
ortimestamp
. If set totimestamp
, then when a log file is rolled, it is saved with the current timestamp as a file suffix. If set toincrement
, then backup files are saved with incrementing numbers as suffixes; older files are renamed when rolling. For example, ifversions
is set to 3 andsuffix
toincrement
, then whenfilename.log
reaches the size specified bysize
,filename.log.1
is renamed tofilename.log.2
,filename.log.0
is renamed tofilename.log.1
, andfilename.log
is renamed tofilename.log.0
, whereupon a newfilename.log
is opened.Here is an example using the
size
,versions
, andsuffix
options:channel an_example_channel { file "example.log" versions 3 size 20m suffix increment; print-time yes; print-category yes; };
The server can supply extensive debugging information when it is in
debugging mode. If the server's global debug level is greater than zero,
debugging mode is active. The global debug level is set either by
starting the named
server with the -d <named -d>
flag followed by a positive
integer, or by running rndc trace
. The global debug level can be set to
zero, and debugging mode turned off, by running
rndc notrace
. All debugging messages in the server have a
debug level; higher debug levels give more detailed output. Channels
that specify a specific debug severity, for example:
channel specific_debug_level {
file "foo";
severity debug 3;
};
get debugging output of level 3 or less any time the server is in
debugging mode, regardless of the global debugging level. Channels with
dynamic
severity use the server's global debug level to
determine what messages to print.
Here is an example where all three print-
options are
on:
28-Feb-2000 15:05:32.863 general: notice: running
There are four predefined channels that are used for named
's default logging,
as follows. If named
is started with the -L <named -L>
option, then a fifth channel,
default_logfile
, is added. How they are used is described
in category
.
channel default_syslog {
// send to syslog's daemon facility
syslog daemon;
// only send priority info and higher
severity info;
};
channel default_debug {
// write to named.run in the working directory
// Note: stderr is used instead of "named.run" if
// the server is started with the '-g' option.
file "named.run";
// log at the server's current debug level
severity dynamic;
};
channel default_stderr {
// writes to stderr
stderr;
// only send priority info and higher
severity info;
};
channel null {
// toss anything sent to this channel
null;
};
channel default_logfile {
// this channel is only present if named is
// started with the -L option, whose argument
// provides the file name
file "...";
// log at the server's current debug level
severity dynamic;
};
The default_debug
channel has the special property that
it only produces output when the server's debug level is non-zero. It
normally writes to a file called named.run
in the server's
working directory.
For security reasons, when the -u <named -u>
command-line option is used,
the named.run
file is created only after named
has changed to the
new UID, and any debug output generated while named
is starting -and
still running as root - is discarded. To capture this output, run the
server with the -L <named -L>
option to specify a default
logfile, or the -g <named -g>
option to log to standard error
which can be redirected to a file.
Once a channel is defined, it cannot be redefined. The built-in channels cannot be altered directly, but the default logging can be modified by pointing categories at defined channels.
The category
Phrase
There are many categories, so desired logs can be sent anywhere while
unwanted logs are ignored. If a list of channels is not specified for a
category, log messages in that category are sent to the
default
category instead. If no default category is
specified, the following "default default" is used:
category default { default_syslog; default_debug; };
If named
is
started with the -L <named -L>
option, the default category
is:
category default { default_logfile; default_debug; };
As an example, let's say a user wants to log security events to a file, but also wants to keep the default logging behavior. They would specify the following:
channel my_security_channel {
file "my_security_file";
severity info;
};
category security {
my_security_channel;
default_syslog;
default_debug;
};
To discard all messages in a category, specify the null
channel:
category xfer-out { null; };
category notify { null; };
The following are the available categories and brief descriptions of the types of log information they contain. More categories may be added in future BIND releases.
The query-errors
Category
The query-errors
category is used to indicate why and
how specific queries resulted in responses which indicate an error.
Normally, these messages are logged at debug
logging
levels; note, however, that if query logging is active, some are logged
at info
. The logging levels are described below:
At debug
level 1 or higher - or at info
when query logging is active - each response with the rcode of SERVFAIL
is logged as follows:
client 127.0.0.1#61502: query failed (SERVFAIL) for www.example.com/IN/AAAA at query.c:3880
This means an error resulting in SERVFAIL was detected at line 3880
of source file query.c
. Log messages of this level are
particularly helpful in identifying the cause of SERVFAIL for an
authoritative server.
At debug
level 2 or higher, detailed context information
about recursive resolutions that resulted in SERVFAIL is logged. The log
message looks like this:
fetch completed at resolver.c:2970 for www.example.com/A
in 10.000183: timed out/success [domain:example.com,
referral:2,restart:7,qrysent:8,timeout:5,lame:0,quota:0,neterr:0,
badresp:1,adberr:0,findfail:0,valfail:0]
The first part before the colon shows that a recursive resolution for
AAAA records of www.example.com completed in 10.000183 seconds, and the
final result that led to the SERVFAIL was determined at line 2970 of
source file resolver.c
.
The next part shows the detected final result and the latest result of DNSSEC validation. The latter is always "success" when no validation attempt was made. In this example, this query probably resulted in SERVFAIL because all name servers are down or unreachable, leading to a timeout in 10 seconds. DNSSEC validation was probably not attempted.
The last part, enclosed in square brackets, shows statistics
collected for this particular resolution attempt. The
domain
field shows the deepest zone that the resolver
reached; it is the zone where the error was finally detected. The
meaning of the other fields is summarized in the following list.
referral
-
The number of referrals the resolver received throughout the resolution process. In the above
example.com
there are two. restart
-
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 thedomain
zone. qrysent
-
The number of queries the resolver sent at the
domain
zone. timeout
-
The number of timeouts the resolver received since the last response.
lame
-
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. quota
-
The number of times the resolver was unable to send a query because it had exceeded the permissible fetch quota for a server.
neterr
-
The number of erroneous results that the resolver encountered in sending queries at the
domain
zone. One common case is when the remote server is unreachable and the resolver receives an "ICMP unreachable" error message. badresp
-
The number of unexpected responses (other than
lame
) to queries sent by the resolver at thedomain
zone. adberr
-
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. findfail
-
Failures to resolve remote server addresses. This is a total number of failures throughout the resolution process.
valfail
-
Failures of DNSSEC validation. Validation failures are counted throughout the resolution process (not limited to the
domain
zone), but should only happen indomain
.
At debug
level 3 or higher, the same messages as those
at debug
level 1 are logged for errors other than SERVFAIL.
Note that negative responses such as NXDOMAIN are not errors, and are
not logged at this debug level.
At debug
level 4 or higher, the detailed context
information logged at debug
level 2 is logged for errors
other than SERVFAIL and for negative responses such as NXDOMAIN.
parental-agents
Block Grammar
parental-agents
Block
Definition and Usage
parental-agents
lists allow for a common set of parental agents to be easily used by
multiple primary and secondary zones. A parental agent is the entity
that is allowed to change a zone's delegation information (defined in
7344
).
primaries
Block Grammar
primaries
Block Definition
and Usage
primaries
lists
allow for a common set of primary servers to be easily used by multiple
stub and secondary zones in their primaries
or also-notify
lists. (Note: primaries
is a synonym for
the original keyword masters
, which can still be used, but
is no longer the preferred terminology.)
To force the zone transfer requests to be sent over TLS, use tls
keyword, e.g.
primaries { 192.0.2.1 tls tls-configuration-name; };
, where
tls-configuration-name
refers to a previously defined tls statement <tls>
.
Warning
Please note that TLS connections to primaries are not
authenticated unless remote-hostname
or ca-file
are specified within the tls statement <tls>
in
use (see information on Strict TLS <strict-tls>
and Mutual TLS <mutual-tls>
for more details). Not authenticated mode (Opportunistic
TLS <opportunistic-tls>
) provides protection from passive
observers but does not protect from man-in-the-middle attacks on zone
transfers.
options
Block Grammar
This is the grammar of the options
statement in the
named.conf
file:
options
Block
Definition and Usage
The options
statement sets up global options to be used
by BIND. This statement may appear only once in a configuration file. If
there is no options
statement, an options block with each
option set to its default is used.
dnssec-policy
This specifies which key and signing policy (KASP) should be used for this zone. This is a string referring to a
dnssec-policy
block. The default isnone
.
max-zone-ttl
-
- tags
-
deprecated
- short
-
Specifies a maximum permissible time-to-live (TTL) value, in seconds.
This should now be configured as part of
dnssec-policy
. Use of this option inoptions
,view
andzone
blocks is a fatal error ifdnssec-policy
has also been configured for the same zone. In zones withoutdnssec-policy
, this option is deprecated, and will be rendered non-operational in a future release.max-zone-ttl
specifies a maximum permissible TTL value in seconds. For convenience, TTL-style time-unit suffixes may be used to specify the maximum value. When a zone file is loaded, any record encountered with a TTL higher thanmax-zone-ttl
causes the zone to be rejected.This is needed in DNSSEC-maintained zones because when rolling to a new DNSKEY, the old key needs to remain available until RRSIG records have expired from caches. The
max-zone-ttl
option guarantees that the largest TTL in the zone is no higher than the set value.When used in
options
,view
andzone
blocks, settingmax-zone-ttl
to zero is equivalent to "unlimited".
Boolean Options
Forwarding
The forwarding facility can be used to create a large site-wide cache on a few servers, reducing traffic over links to external name servers. It can also be used to allow queries by servers that do not have direct access to the Internet, but wish to look up exterior names anyway. Forwarding occurs only on those queries for which the server is not authoritative and does not have the answer in its cache.
Forwarding can also be configured on a per-domain basis, allowing for
the global forwarding options to be overridden in a variety of ways.
Particular domains can be set to use different forwarders, or have a
different forward only/first
behavior, or not forward at
all; see zone
.
Dual-stack Servers
Dual-stack servers are used as servers of last resort, to work around problems in reachability due to the lack of support for either IPv4 or IPv6 on the host machine.
Access Control
Access to the server can be restricted based on the IP address of the
requesting system. See address_match_lists
for details on how to specify IP
address lists.
Warning
Please note that incoming TLS connections are not
authenticated at the TLS level by default. Please use tsig
to authenticate
requestors or consider implementing Mutual TLS <mutual-tls>
authentication.
Interfaces
The interfaces, ports, and protocols that the server can use to
answer queries may be specified using the listen-on
and listen-on-v6
options.
Query Address
Zone Transfers
BIND has mechanisms in place to facilitate zone transfers and set limits on the amount of load that transfers place on the system. The following options apply to zone transfers.
Server Resource Limits
The following options set limits on the server's resource consumption that are enforced internally by the server rather than by the operating system.
Periodic Task Intervals
The sortlist
Statement
The response to a DNS query may consist of multiple resource records
(RRs) forming a resource record set (RRset). The name server normally
returns the RRs within the RRset in an indeterminate order (but see the
rrset-order
statement
in rrset_ordering
). The
client resolver code should rearrange the RRs as appropriate: that is,
using any addresses on the local net in preference to other addresses.
However, not all resolvers can do this or are correctly configured. When
a client is using a local server, the sorting can be performed in the
server, based on the client's address. This only requires configuring
the name servers, not all the clients.
sortlist {
// IF the local host
// THEN first fit on the following nets
{ localhost;
{ localnets;
192.168.1/24;
{ 192.168.2/24; 192.168.3/24; }; }; };
// IF on class C 192.168.1 THEN use .1, or .2 or .3
{ 192.168.1/24;
{ 192.168.1/24;
{ 192.168.2/24; 192.168.3/24; }; }; };
// IF on class C 192.168.2 THEN use .2, or .1 or .3
{ 192.168.2/24;
{ 192.168.2/24;
{ 192.168.1/24; 192.168.3/24; }; }; };
// IF on class C 192.168.3 THEN use .3, or .1 or .2
{ 192.168.3/24;
{ 192.168.3/24;
{ 192.168.1/24; 192.168.2/24; }; }; };
// IF .4 or .5 THEN prefer that net
{ { 192.168.4/24; 192.168.5/24; };
};
};
The following example illlustrates reasonable behavior for the local host and hosts on directly connected networks. Responses sent to queries from the local host favor any of the directly connected networks. Responses sent to queries from any other hosts on a directly connected network prefer addresses on that same network. Responses to other queries are not sorted.
sortlist {
{ localhost; localnets; };
{ localnets; };
};
RRset Ordering
Note
While alternating the order of records in a DNS response between subsequent queries is a known load distribution technique, certain caveats apply (mostly stemming from caching) which usually make it a suboptimal choice for load balancing purposes when used on its own.
Tuning
Built-in Server Information Zones
The server provides some helpful diagnostic information through a
number of built-in zones under the pseudo-top-level-domain
bind
in the CHAOS
class. These zones are part
of a built-in view (see view
) of class CHAOS
, which is separate
from the default view of class IN
. Most global
configuration options (allow-query
, etc.) apply to this view, but some are
locally overridden: notify
, recursion
, and allow-new-zones
are always set to no
, and
rate-limit
is set to
allow three responses per second.
To disable these zones, use the options below or hide the built-in
CHAOS
view by defining an explicit view of class
CHAOS
that matches all clients.
Built-in Empty Zones
The named
server
has some built-in empty zones, for SOA and NS records only. These are
for zones that should normally be answered locally and for which queries
should not be sent to the Internet's root servers. The official servers
that cover these namespaces return NXDOMAIN responses to these queries.
In particular, these cover the reverse namespaces for addresses from
1918
, 4193
, 5737
, and 6598
. They also include the
reverse namespace for the IPv6 local address (locally assigned), IPv6
link local addresses, the IPv6 loopback address, and the IPv6 unknown
address.
The server attempts to determine if a built-in zone already exists or is active (covered by a forward-only forwarding declaration) and does not create an empty zone if either is true.
The current list of empty zones is:
- 10.IN-ADDR.ARPA
- 16.172.IN-ADDR.ARPA
- 17.172.IN-ADDR.ARPA
- 18.172.IN-ADDR.ARPA
- 19.172.IN-ADDR.ARPA
- 20.172.IN-ADDR.ARPA
- 21.172.IN-ADDR.ARPA
- 22.172.IN-ADDR.ARPA
- 23.172.IN-ADDR.ARPA
- 24.172.IN-ADDR.ARPA
- 25.172.IN-ADDR.ARPA
- 26.172.IN-ADDR.ARPA
- 27.172.IN-ADDR.ARPA
- 28.172.IN-ADDR.ARPA
- 29.172.IN-ADDR.ARPA
- 30.172.IN-ADDR.ARPA
- 31.172.IN-ADDR.ARPA
- 168.192.IN-ADDR.ARPA
- 64.100.IN-ADDR.ARPA
- 65.100.IN-ADDR.ARPA
- 66.100.IN-ADDR.ARPA
- 67.100.IN-ADDR.ARPA
- 68.100.IN-ADDR.ARPA
- 69.100.IN-ADDR.ARPA
- 70.100.IN-ADDR.ARPA
- 71.100.IN-ADDR.ARPA
- 72.100.IN-ADDR.ARPA
- 73.100.IN-ADDR.ARPA
- 74.100.IN-ADDR.ARPA
- 75.100.IN-ADDR.ARPA
- 76.100.IN-ADDR.ARPA
- 77.100.IN-ADDR.ARPA
- 78.100.IN-ADDR.ARPA
- 79.100.IN-ADDR.ARPA
- 80.100.IN-ADDR.ARPA
- 81.100.IN-ADDR.ARPA
- 82.100.IN-ADDR.ARPA
- 83.100.IN-ADDR.ARPA
- 84.100.IN-ADDR.ARPA
- 85.100.IN-ADDR.ARPA
- 86.100.IN-ADDR.ARPA
- 87.100.IN-ADDR.ARPA
- 88.100.IN-ADDR.ARPA
- 89.100.IN-ADDR.ARPA
- 90.100.IN-ADDR.ARPA
- 91.100.IN-ADDR.ARPA
- 92.100.IN-ADDR.ARPA
- 93.100.IN-ADDR.ARPA
- 94.100.IN-ADDR.ARPA
- 95.100.IN-ADDR.ARPA
- 96.100.IN-ADDR.ARPA
- 97.100.IN-ADDR.ARPA
- 98.100.IN-ADDR.ARPA
- 99.100.IN-ADDR.ARPA
- 100.100.IN-ADDR.ARPA
- 101.100.IN-ADDR.ARPA
- 102.100.IN-ADDR.ARPA
- 103.100.IN-ADDR.ARPA
- 104.100.IN-ADDR.ARPA
- 105.100.IN-ADDR.ARPA
- 106.100.IN-ADDR.ARPA
- 107.100.IN-ADDR.ARPA
- 108.100.IN-ADDR.ARPA
- 109.100.IN-ADDR.ARPA
- 110.100.IN-ADDR.ARPA
- 111.100.IN-ADDR.ARPA
- 112.100.IN-ADDR.ARPA
- 113.100.IN-ADDR.ARPA
- 114.100.IN-ADDR.ARPA
- 115.100.IN-ADDR.ARPA
- 116.100.IN-ADDR.ARPA
- 117.100.IN-ADDR.ARPA
- 118.100.IN-ADDR.ARPA
- 119.100.IN-ADDR.ARPA
- 120.100.IN-ADDR.ARPA
- 121.100.IN-ADDR.ARPA
- 122.100.IN-ADDR.ARPA
- 123.100.IN-ADDR.ARPA
- 124.100.IN-ADDR.ARPA
- 125.100.IN-ADDR.ARPA
- 126.100.IN-ADDR.ARPA
- 127.100.IN-ADDR.ARPA
- 0.IN-ADDR.ARPA
- 127.IN-ADDR.ARPA
- 254.169.IN-ADDR.ARPA
- 2.0.192.IN-ADDR.ARPA
- 100.51.198.IN-ADDR.ARPA
- 113.0.203.IN-ADDR.ARPA
- 255.255.255.255.IN-ADDR.ARPA
- 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
- 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
- 8.B.D.0.1.0.0.2.IP6.ARPA
- D.F.IP6.ARPA
- 8.E.F.IP6.ARPA
- 9.E.F.IP6.ARPA
- A.E.F.IP6.ARPA
- B.E.F.IP6.ARPA
- EMPTY.AS112.ARPA
- HOME.ARPA
Empty zones can be set at the view level and only apply to views of class IN. Disabled empty zones are only inherited from options if there are no disabled empty zones specified at the view level. To override the options list of disabled zones, disable the root zone at the view level. For example:
disable-empty-zone ".";
If using the address ranges covered here, reverse zones covering the addresses should already be in place. In practice this appears to not be the case, with many queries being made to the infrastructure servers for names in these spaces. So many, in fact, that sacrificial servers had to be deployed to channel the query load away from the infrastructure servers.
Note
The real parent servers for these zones should disable all empty zones under the parent zone they serve. For the real root servers, this is all built-in empty zones. This enables them to return referrals to deeper in the tree.
Content Filtering
If a response message is rejected due to the filtering, the entire message is discarded without being cached, and a SERVFAIL error is returned to the client.
This filtering is intended to prevent "DNS rebinding attacks," in which an attacker, in response to a query for a domain name the attacker controls, returns an IP address within the user's own network or an alias name within the user's own domain. A naive web browser or script could then serve as an unintended proxy, allowing the attacker to get access to an internal node of the local network that could not be externally accessed otherwise. See the paper available at https://dl.acm.org/doi/10.1145/1315245.1315298 for more details about these attacks.
For example, with a domain named "example.net" and an internal network using an IPv4 prefix 192.0.2.0/24, an administrator might specify the following rules:
deny-answer-addresses { 192.0.2.0/24; } except-from { "example.net"; };
deny-answer-aliases { "example.net"; };
If an external attacker let a web browser in the local network look up an IPv4 address of "attacker.example.com", the attacker's DNS server would return a response like this:
attacker.example.com. A 192.0.2.1
in the answer section. Since the rdata of this record (the IPv4 address) matches the specified prefix 192.0.2.0/24, this response would be ignored.
On the other hand, if the browser looked up a legitimate internal web server "www.example.net" and the following response were returned to the BIND 9 server:
www.example.net. A 192.0.2.2
it would be accepted, since the owner name "www.example.net" matches
the except-from
element, "example.net".
Note that this is not really an attack on the DNS per se. In fact, there is nothing wrong with having an "external" name mapped to an "internal" IP address or domain name from the DNS point of view; it might actually be provided for a legitimate purpose, such as for debugging. As long as the mapping is provided by the correct owner, it either is not possible or does not make sense to detect whether the intent of the mapping is legitimate within the DNS. The "rebinding" attack must primarily be protected at the application that uses the DNS. For a large site, however, it may be difficult to protect all possible applications at once. This filtering feature is provided only to help such an operational environment; turning it on is generally discouraged unless there is no other choice and the attack is a real threat to applications.
Care should be particularly taken if using this option for addresses within 127.0.0.0/8. These addresses are obviously "internal," but many applications conventionally rely on a DNS mapping from some name to such an address. Filtering out DNS records containing this address spuriously can break such applications.
Response Policy Zone (RPZ) Rewriting
BIND 9 includes a limited mechanism to modify DNS responses for requests analogous to email anti-spam DNS rejection lists. Responses can be changed to deny the existence of domains (NXDOMAIN), deny the existence of IP addresses for domains (NODATA), or contain other IP addresses or data.
Rules encoded in response policy zones are processed after those
defined in access_control
. All queries from clients which are not
permitted access to the resolver are answered with a status code of
REFUSED, regardless of configured RPZ rules.
Five policy triggers can be encoded in RPZ records.
RPZ-CLIENT-IP
-
IP records are triggered by the IP address of the DNS client. Client IP address triggers are encoded in records that have owner names that are subdomains of
rpz-client-ip
, relativized to the policy zone origin name, and that encode an address or address block. IPv4 addresses are represented asprefixlength.B4.B3.B2.B1.rpz-client-ip
. The IPv4 prefix length must be between 1 and 32. All four bytes - B4, B3, B2, and B1 - must be present. B4 is the decimal value of the least significant byte of the IPv4 address as in IN-ADDR.ARPA.IPv6 addresses are encoded in a format similar to the standard IPv6 text representation,
prefixlength.W8.W7.W6.W5.W4.W3.W2.W1.rpz-client-ip
. Each of W8,...,W1 is a one- to four-digit hexadecimal number representing 16 bits of the IPv6 address as in the standard text representation of IPv6 addresses, but reversed as in IP6.ARPA. (Note that this representation of IPv6 addresses is different from IP6.ARPA, where each hex digit occupies a label.) All 8 words must be present except when one set of consecutive zero words is replaced with.zz.
, analogous to double colons (::) in standard IPv6 text encodings. The IPv6 prefix length must be between 1 and 128. QNAME
-
QNAME policy records are triggered by query names of requests and targets of CNAME records resolved to generate the response. The owner name of a QNAME policy record is the query name relativized to the policy zone.
RPZ-IP
-
IP triggers are IP addresses in an A or AAAA record in the ANSWER section of a response. They are encoded like client-IP triggers, except as subdomains of
rpz-ip
. RPZ-NSDNAME
-
NSDNAME triggers match names of authoritative servers for the query name, a parent of the query name, a CNAME for the query name, or a parent of a CNAME. They are encoded as subdomains of
rpz-nsdname
, relativized to the RPZ origin name. NSIP triggers match IP addresses in A and AAAA RRsets for domains that can be checked against NSDNAME policy records. Thensdname-enable
phrase turns NSDNAME triggers off or on for a single policy zone or for all zones.If authoritative name servers for the query name are not yet known,
named
recursively looks up the authoritative servers for the query name before applying an RPZ-NSDNAME rule, which can cause a processing delay. To speed up processing at the cost of precision, thensdname-wait-recurse
option can be used; when set tono
, RPZ-NSDNAME rules are only applied when authoritative servers for the query name have already been looked up and cached. If authoritative servers for the query name are not in the cache, the RPZ-NSDNAME rule is ignored, but the authoritative servers for the query name are looked up in the background and the rule is applied to subsequent queries. The default isyes
, meaning RPZ-NSDNAME rules are always applied, even if authoritative servers for the query name need to be looked up first. RPZ-NSIP
-
NSIP triggers match the IP addresses of authoritative servers. They are encoded like IP triggers, except as subdomains of
rpz-nsip
. NSDNAME and NSIP triggers are checked only for names with at leastmin-ns-dots
dots. The default value ofmin-ns-dots
is 1, to exclude top-level domains. Thensip-enable
phrase turns NSIP triggers off or on for a single policy zone or for all zones.If a name server's IP address is not yet known,
named
recursively looks up the IP address before applying an RPZ-NSIP rule, which can cause a processing delay. To speed up processing at the cost of precision, thensip-wait-recurse
option can be used; when set tono
, RPZ-NSIP rules are only applied when a name server's IP address has already been looked up and cached. If a server's IP address is not in the cache, the RPZ-NSIP rule is ignored, but the address is looked up in the background and the rule is applied to subsequent queries. The default isyes
, meaning RPZ-NSIP rules are always applied, even if an address needs to be looked up first.
The query response is checked against all response policy zones, so
two or more policy records can be triggered by a response. Because DNS
responses are rewritten according to at most one policy record, a single
record encoding an action (other than DISABLED
actions)
must be chosen. Triggers, or the records that encode them, are chosen
for rewriting in the following order:
- Choose the triggered record in the zone that appears first in the response-policy option.
- Prefer CLIENT-IP to QNAME to IP to NSDNAME to NSIP triggers in a single zone.
- Among NSDNAME triggers, prefer the trigger that matches the smallest name under the DNSSEC ordering.
- Among IP or NSIP triggers, prefer the trigger with the longest prefix.
- Among triggers with the same prefix length, prefer the IP or NSIP trigger that matches the smallest IP address.
When the processing of a response is restarted to resolve DNAME or CNAME records and a policy record set has not been triggered, all response policy zones are again consulted for the DNAME or CNAME names and addresses.
RPZ record sets are any types of DNS record, except DNAME or DNSSEC,
that encode actions or responses to individual queries. Any of the
policies can be used with any of the triggers. For example, while the
TCP-only
policy is commonly used with
client-IP
triggers, it can be used with any type of trigger
to force the use of TCP for responses with owner names in a zone.
PASSTHRU
-
The auto-acceptance policy is specified by a CNAME whose target is
rpz-passthru
. It causes the response to not be rewritten and is most often used to "poke holes" in policies for CIDR blocks. DROP
-
The auto-rejection policy is specified by a CNAME whose target is
rpz-drop
. It causes the response to be discarded. Nothing is sent to the DNS client. TCP-Only
-
The "slip" policy is specified by a CNAME whose target is
rpz-tcp-only
. It changes UDP responses to short, truncated DNS responses that require the DNS client to try again with TCP. It is used to mitigate distributed DNS reflection attacks. NXDOMAIN
-
The "domain undefined" response is encoded by a CNAME whose target is the root domain (.).
NODATA
-
The empty set of resource records is specified by a CNAME whose target is the wildcard top-level domain (
*.
). It rewrites the response to NODATA or ANCOUNT=0. Local Data
-
A set of ordinary DNS records can be used to answer queries. Queries for record types not in the set are answered with NODATA.
A special form of local data is a CNAME whose target is a wildcard such as *.example.com. It is used as if an ordinary CNAME after the asterisk (*) has been replaced with the query name. This special form is useful for query logging in the walled garden's authoritative DNS server.
All of the actions specified in all of the individual records in a
policy zone can be overridden with a policy
clause in the
response-policy
option.
An organization using a policy zone provided by another organization
might use this mechanism to redirect domains to its own walled
garden.
GIVEN
-
The placeholder policy says "do not override but perform the action specified in the zone."
DISABLED
-
The testing override policy causes policy zone records to do nothing but log what they would have done if the policy zone were not disabled. The response to the DNS query is written (or not) according to any triggered policy records that are not disabled. Disabled policy zones should appear first, because they are often not logged if a higher-precedence trigger is found first.
PASSTHRU
;DROP
;TCP-Only
;NXDOMAIN
;NODATA
-
These settings each override the corresponding per-record policy.
CNAME domain
-
This causes all RPZ policy records to act as if they were "cname domain" records.
By default, the actions encoded in a response policy zone are applied
only to queries that ask for recursion (RD=1). That default can be
changed for a single policy zone, or for all response policy zones in a
view, with a recursive-only no
clause. This feature is
useful for serving the same zone files both inside and outside an 1918
cloud and using RPZ to
delete answers that would otherwise contain 1918
values on the externally
visible name server or view.
Also by default, RPZ actions are applied only to DNS requests that
either do not request DNSSEC metadata (DO=0) or when no DNSSEC records
are available for the requested name in the original zone (not the
response policy zone). This default can be changed for all response
policy zones in a view with a break-dnssec yes
clause. In
that case, RPZ actions are applied regardless of DNSSEC. The name of the
clause option reflects the fact that results rewritten by RPZ actions
cannot verify.
No DNS records are needed for a QNAME or Client-IP trigger; the name
or IP address itself is sufficient, so in principle the query name need
not be recursively resolved. However, not resolving the requested name
can leak the fact that response policy rewriting is in use, and that the
name is listed in a policy zone, to operators of servers for listed
names. To prevent that information leak, by default any recursion needed
for a request is done before any policy triggers are considered. Because
listed domains often have slow authoritative servers, this behavior can
cost significant time. The qname-wait-recurse no
option
overrides the default and enables that behavior when recursion cannot
change a non-error response. The option does not affect QNAME or
client-IP triggers in policy zones listed after other zones containing
IP, NSIP, and NSDNAME triggers, because those may depend on the A, AAAA,
and NS records that would be found during recursive resolution. It also
does not affect DNSSEC requests (DO=1) unless
break-dnssec yes
is in use, because the response would
depend on whether RRSIG records were found during resolution. Using this
option can cause error responses such as SERVFAIL to appear to be
rewritten, since no recursion is being done to discover problems at the
authoritative server.
The TTL of a record modified by RPZ policies is set from the TTL of
the relevant record in the policy zone. It is then limited to a maximum
value. The max-policy-ttl
clause changes the maximum number
of seconds from its default of 5. For convenience, TTL-style time-unit
suffixes may be used to specify the value. It also accepts ISO 8601
duration formats.
For example, an administrator might use this option statement:
response-policy { zone "badlist"; };
and this zone statement:
zone "badlist" {type primary; file "primary/badlist"; allow-query {none;}; };
with this zone file:
$TTL 1H
@ SOA LOCALHOST. named-mgr.example.com (1 1h 15m 30d 2h)
NS LOCALHOST.
; QNAME policy records. There are no periods (.) after the owner names.
nxdomain.domain.com CNAME . ; NXDOMAIN policy
*.nxdomain.domain.com CNAME . ; NXDOMAIN policy
nodata.domain.com CNAME *. ; NODATA policy
*.nodata.domain.com CNAME *. ; NODATA policy
bad.domain.com A 10.0.0.1 ; redirect to a walled garden
AAAA 2001:2::1
bzone.domain.com CNAME garden.example.com.
; do not rewrite (PASSTHRU) OK.DOMAIN.COM
ok.domain.com CNAME rpz-passthru.
; redirect x.bzone.domain.com to x.bzone.domain.com.garden.example.com
*.bzone.domain.com CNAME *.garden.example.com.
; IP policy records that rewrite all responses containing A records in 127/8
; except 127.0.0.1
8.0.0.0.127.rpz-ip CNAME .
32.1.0.0.127.rpz-ip CNAME rpz-passthru.
; NSDNAME and NSIP policy records
ns.domain.com.rpz-nsdname CNAME .
48.zz.2.2001.rpz-nsip CNAME .
; auto-reject and auto-accept some DNS clients
112.zz.2001.rpz-client-ip CNAME rpz-drop.
8.0.0.0.127.rpz-client-ip CNAME rpz-drop.
; force some DNS clients and responses in the example.com zone to TCP
16.0.0.1.10.rpz-client-ip CNAME rpz-tcp-only.
example.com CNAME rpz-tcp-only.
*.example.com CNAME rpz-tcp-only.
Response policy zones can be configured to set an Extended DNS Error (EDE) code on the responses which have been modified by the response policy:
response-policy { zone "badlist" ede filtered; };
The following settings are supported for the ede
option:
none
-
No Extended DNS Error code is set (default).
forged
-
Extended DNS Error code 4 - Forged Answer.
blocked
-
Extended DNS Error code 15 - Blocked.
censored
-
Extended DNS Error code 16 - Censored.
filtered
-
Extended DNS Error code 17 - Filtered.
prohibited
-
Extended DNS Error code 18 - Prohibited.
See 8914
for more
information about the Extended DNS Error codes.
RPZ can affect server performance. Each configured response policy zone requires the server to perform one to four additional database lookups before a query can be answered. For example, a DNS server with four policy zones, each with all four kinds of response triggers (QNAME, IP, NSIP, and NSDNAME), requires a total of 17 times as many database lookups as a similar DNS server with no response policy zones. A BIND 9 server with adequate memory and one response policy zone with QNAME and IP triggers might achieve a maximum queries-per-second (QPS) rate about 20% lower. A server with four response policy zones with QNAME and IP triggers might have a maximum QPS rate about 50% lower.
Responses rewritten by RPZ are counted in the
RPZRewrites
statistics.
The log
clause can be used to optionally turn off
rewrite logging for a particular response policy zone. By default, all
rewrites are logged.
The add-soa
option controls whether the RPZ's SOA record
is added to the section for traceback of changes from this zone. This
can be set at the individual policy zone level or at the response-policy
level. The default is yes
.
Updates to RPZ zones are processed asynchronously; if there is more
than one update pending they are bundled together. If an update to a RPZ
zone (for example, via IXFR) happens less than
min-update-interval
seconds after the most recent update,
the changes are not carried out until this interval has elapsed. The
default is 60
seconds. For convenience, TTL-style time-unit
suffixes may be used to specify the value. It also accepts ISO 8601
duration formats.
Response Rate Limiting
NXDOMAIN Redirection
named
supports
NXDOMAIN redirection via two methods:
Redirect zone <type redirect>
- Redirect namespace
With either method, when named
gets an NXDOMAIN response it examines a
separate namespace to see if the NXDOMAIN response should be replaced
with an alternative response.
With a redirect zone (zone "." { type redirect; };
), the
data used to replace the NXDOMAIN is held in a single zone which is not
part of the normal namespace. All the redirect information is contained
in the zone; there are no delegations.
If both a redirect zone and a redirect namespace are configured, the redirect zone is tried first.
server
Block Grammar
server
Block
Definition and Usage
The server
statement defines characteristics to be associated with a remote name
server. If a prefix length is specified, then a range of servers is
covered. Only the most specific server clause applies, regardless of the
order in named.conf
.
The server
statement can occur at the top level of the configuration file or inside
a view
statement. If a
view
statement contains
one or more server
statements, only those apply to the
view and any top-level ones are ignored. If a view contains no server
statements,
any top-level server
statements are used as defaults.
It is possible to override the following values defined in view
and options
blocks:
edns-udp-size
max-udp-size
notify-source-v6
notify-source
provide-ixfr
query-source-v6
query-source
request-expire
request-ixfr
request-nsid
require-cookie
send-cookie
transfer-format
transfer-source-v6
transfer-source
statistics-channels
Block
Grammar
statistics-channels
Block
Definition and Usage
The statistics-channels
statement declares communication
channels to be used by system administrators to get access to statistics
information on the name server.
This statement is intended to be flexible to support multiple
communication protocols in the future, but currently only HTTP access is
supported. It requires that BIND 9 be compiled with libxml2 and/or
json-c (also known as libjson0); the statistics-channels
statement is still accepted even
if it is built without the library, but any HTTP access fails with an
error.
An inet
control
channel is a TCP socket listening at the specified port
on the specified ip_address
, which can be an
IPv4 or IPv6 address. An ip_address
of *
(asterisk) is
interpreted as the IPv4 wildcard address; connections are accepted on
any of the system's IPv4 addresses. To listen on the IPv6 wildcard
address, use an ip_address
of ::
.
If no port is specified, port 80 is used for HTTP channels. The
asterisk (*
) cannot be used for port
.
Attempts to open a statistics channel are restricted by the optional
allow
clause. Connections to the statistics channel are
permitted based on the address_match_list
. If no allow
clause
is present, named
accepts connection attempts from any address. Since the statistics may
contain sensitive internal information, the source of connection
requests must be restricted appropriately so that only trusted parties
can access the statistics channel.
Gathering data exposed by the statistics channel locks various
subsystems in named
,
which could slow down query processing if statistics data is requested
too often.
An issue in the statistics channel would be considered a security
issue only if it could be exploited by unprivileged users circumventing
the access control list. In other words, any issue in the statistics
channel that could be used to access information unavailable otherwise,
or to crash named
,
is not considered a security issue if it can be avoided through the use
of a secure configuration.
If no statistics-channels
statement is present, named
does not open any
communication channels.
The statistics are available in various formats and views, depending on the URI used to access them. For example, if the statistics channel is configured to listen on 127.0.0.1 port 8888, then the statistics are accessible in XML format at http://127.0.0.1:8888/ or http://127.0.0.1:8888/xml. A CSS file is included, which can format the XML statistics into tables when viewed with a stylesheet-capable browser, and into charts and graphs using the Google Charts API when using a JavaScript-capable browser.
Broken-out subsets of the statistics can be viewed at http://127.0.0.1:8888/xml/v3/status (server uptime and last reconfiguration time), http://127.0.0.1:8888/xml/v3/server (server and resolver statistics), http://127.0.0.1:8888/xml/v3/zones (zone statistics), http://127.0.0.1:8888/xml/v3/net (network status and socket statistics), http://127.0.0.1:8888/xml/v3/mem (memory manager statistics), and http://127.0.0.1:8888/xml/v3/traffic (traffic sizes).
The full set of statistics can also be read in JSON format at http://127.0.0.1:8888/json, with the broken-out subsets at http://127.0.0.1:8888/json/v1/status (server uptime and last reconfiguration time), http://127.0.0.1:8888/json/v1/server (server and resolver statistics), http://127.0.0.1:8888/json/v1/zones (zone statistics), http://127.0.0.1:8888/json/v1/net (network status and socket statistics), http://127.0.0.1:8888/json/v1/mem (memory manager statistics), and http://127.0.0.1:8888/json/v1/traffic (traffic sizes).
tls
Block Grammar
tls
Block Definition and Usage
The tls
statement is
used to configure a TLS connection; this configuration can then be
referenced by a listen-on
or listen-on-v6
statement to cause named
to listen for
incoming requests via TLS, or in the primaries
statement for a zone of type secondary
to cause zone
transfer requests to be sent via TLS.
tls
can only be set
at the top level of named.conf
.
The following options can be specified in a tls
statement:
Warning
TLS configuration is subject to change and incompatible changes might be introduced in the future. Users of TLS are encouraged to carefully read release notes when upgrading.
The options described above are used to control different aspects of TLS functioning. Thus, most of them have no well-defined default values, as these depend on the cryptographic library version in use and system-wide cryptographic policy. On the other hand, by specifying the needed options one could have a uniform configuration deployable across a range of platforms.
An example of privacy-oriented, perfect forward secrecy enabled configuration can be found below. It can be used as a starting point.
tls local-tls {
key-file "/path/to/key.pem";
cert-file "/path/to/fullchain_cert.pem";
dhparam-file "/path/to/dhparam.pem";
ciphers "HIGH:!kRSA:!aNULL:!eNULL:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384";
prefer-server-ciphers yes;
session-tickets no;
};
A Diffie-Hellman parameters file can be generated using e.g. OpenSSL, like follows:
openssl dhparam -out /path/to/dhparam.pem <3072_or_4096>
Ensure that it gets generated on a machine with enough entropy from external sources (e.g. the computer you work on should be fine, the remote virtual machine or server might be not). These files do not contain any sensitive data and can be shared if required.
There are two built-in TLS connection configurations:
ephemeral
, uses a temporary key and certificate created for
the current named
session only, and none
, which can be used when setting up
an HTTP listener with no encryption.
BIND supports the following TLS authentication mechanisms described in the RFC 9103, Section 9.3: Opportunistic TLS, Strict TLS, and Mutual TLS.
Opportunistic TLS provides encryption for data but does not provide
any authentication for the channel. This mode is the default one and it
is used whenever remote-hostname
and ca-file
options are not set in tls
statements in use. RFC
9103 allows optional fallback to clear-text DNS in the cases when TLS is
not available. Still, BIND intentionally does not support that in order
to protect from unexpected data leaks due to misconfiguration. Both BIND
and its complementary tools either successfully establish a secure
channel via TLS when instructed to do so or fail to establish a
connection otherwise.
Strict TLS provides server authentication via a pre-configured
hostname for outgoing connections. This mechanism offers both channel
confidentiality and channel authentication (of the server). In order to
achieve Strict TLS, one needs to use remote-hostname
and, optionally, ca-file
options in the tls
statements used for
establishing outgoing connections (e.g. the ones used to download zone
from primaries via TLS). Providing any of the mentioned options will
enable server authentication. If remote-hostname
is provided but ca-file
is missing, then the
platform-specific certificate authority certificates are used for
authentication. The set roughly corresponds to the one used by
WEB-browsers to authenticate HTTPS hosts. On the other hand, if ca-file
is provided but remote-hostname
is missing,
then the remote side's IP address is used instead.
Mutual TLS is an extension to Strict TLS that provides channel
confidentiality and mutual channel authentication. It builds up upon the
clients offering client certificates when establishing connections and
them doing the server authentication as in the case of Strict TLS. The
server verifies the provided client certificates and accepts the TLS
connection in case of successful verification or rejects it otherwise.
In order to instruct the server to require and verify client TLS
certificates, one needs to specify the ca-file
option in tls
configurations used to configure server listeners.
The provided file must contain certificate authority certificates used
to issue client certificates. In most cases, one should build one's own
TLS certificate authority specifically to issue client certificates and
include the certificate authority certificate into the file.
For authenticating zone transfers over TLS, Mutual TLS might be considered a standalone solution, while Strict TLS paired with TSIG-based authentication and, optionally, IP-based access lists, might be considered acceptable for most practical purposes. Mutual TLS has the advantage of not requiring TSIG and thus, not having security issues related to shared cryptographic secrets.
http
Block Grammar
http
Block Definition and Usage
The http
statement
is used to configure HTTP endpoints on which to listen for
DNS-over-HTTPS (DoH) queries. This configuration can then be referenced
by a listen-on
or listen-on-v6
statement to
cause named
to
listen for incoming requests over HTTPS.
http
can only be set
at the top level of named.conf
.
The following options can be specified in an http
statement:
Any of the options above could be omitted. In such a case, a global
value specified in the options
statement is used (see http-listener-clients
, http-streams-per-connection
.
For example, the following configuration enables DNS-over-HTTPS queries on all local addresses:
http local {
endpoints { "/dns-query"; };
};
options {
....
listen-on tls ephemeral http local { any; };
listen-on-v6 tls ephemeral http local { any; };
};
trust-anchors
Block Grammar
trust-anchors
Block
Definition and Usage
The trust-anchors
statement defines DNSSEC trust anchors. DNSSEC is described in DNSSEC
.
A trust anchor is defined when the public key or public key digest for a non-authoritative zone is known but cannot be securely obtained through DNS, either because it is the DNS root zone or because its parent zone is unsigned. Once a key or digest has been configured as a trust anchor, it is treated as if it has been validated and proven secure.
The resolver attempts DNSSEC validation on all DNS data in subdomains
of configured trust anchors. Validation below specified names can be
temporarily disabled by using rndc nta
, or permanently disabled with the validate-except
option.
All keys listed in trust-anchors
, and their corresponding zones, are
deemed to exist regardless of what parent zones say. Only keys
configured as trust anchors are used to validate the DNSKEY RRset for
the corresponding name. The parent's DS RRset is not used.
trust-anchors
may be
set at the top level of named.conf
or within a view. If it is set in both
places, the configurations are additive; keys defined at the top level
are inherited by all views, but keys defined in a view are only used
within that view.
The trust-anchors
statement can contain multiple trust-anchor entries, each consisting of
a domain name, followed by an "anchor type" keyword indicating the trust
anchor's format, followed by the key or digest data.
If the anchor type is static-key
or
initial-key
, then it is followed with the key's flags,
protocol, and algorithm, plus the Base64 representation of the public
key data. This is identical to the text representation of a DNSKEY
record. Spaces, tabs, newlines, and carriage returns are ignored in the
key data, so the configuration may be split into multiple lines.
If the anchor type is static-ds
or
initial-ds
, it is followed with the key tag, algorithm,
digest type, and the hexadecimal representation of the key digest. This
is identical to the text representation of a DS record. Spaces, tabs,
newlines, and carriage returns are ignored.
Trust anchors configured with the static-key
or
static-ds
anchor types are immutable, while keys configured
with initial-key
or initial-ds
can be kept
up-to-date automatically, without intervention from the resolver
operator. (static-key
keys are identical to keys configured
using the deprecated trusted-keys
statement.)
Suppose, for example, that a zone's key-signing key was compromised,
and the zone owner had to revoke and replace the key. A resolver which
had the original key configured using static-key
or
static-ds
would be unable to validate this zone any longer;
it would reply with a SERVFAIL response code. This would continue until
the resolver operator had updated the trust-anchors
statement with the new key.
If, however, the trust anchor had been configured using
initial-key
or initial-ds
instead, the zone
owner could add a "stand-by" key to the zone in advance. named
would store the
stand-by key, and when the original key was revoked, named
would be able to
transition smoothly to the new key. It would also recognize that the old
key had been revoked and cease using that key to validate answers,
minimizing the damage that the compromised key could do. This is the
process used to keep the ICANN root DNSSEC key up-to-date.
Whereas static-key
and static-ds
trust
anchors continue to be trusted until they are removed from named.conf
, an
initial-key
or initial-ds
is only trusted
once: for as long as it takes to load the managed key database
and start the 5011
key
maintenance process.
It is not possible to mix static with initial trust anchors for the same domain name.
The first time named
runs with an initial-key
or
initial-ds
configured in named.conf
, it fetches the DNSKEY RRset directly
from the zone apex, and validates it using the trust anchor specified in
trust-anchors
. If the
DNSKEY RRset is validly signed by a key matching the trust anchor, then
it is used as the basis for a new managed-keys database.
From that point on, whenever named
runs, it sees the initial-key
or
initial-ds
listed in trust-anchors
, checks to make sure 5011
key maintenance has
already been initialized for the specified domain, and if so, simply
moves on. The key specified in the trust-anchors
statement is not used to validate
answers; it is superseded by the key or keys stored in the managed-keys
database.
The next time named
runs after an initial-key
or
initial-ds
has been removed from the trust-anchors
statement (or
changed to a static-key
or static-ds
), the
corresponding zone is removed from the managed-keys database, and 5011
key maintenance is no
longer used for that domain.
In the current implementation, the managed-keys database is stored as a master-format zone file.
On servers which do not use views, this file is named
managed-keys.bind
. When views are in use, there is a
separate managed-keys database for each view; the filename is the view
name (or, if a view name contains characters which would make it illegal
as a filename, a hash of the view name), followed by the suffix
.mkeys
.
When the key database is changed, the zone is updated. As with any
other dynamic zone, changes are written into a journal file, e.g.,
managed-keys.bind.jnl
or internal.mkeys.jnl
.
Changes are committed to the primary file as soon as possible afterward,
usually within 30 seconds. Whenever named
is using automatic key maintenance, the zone
file and journal file can be expected to exist in the working directory.
(For this reason, among others, the working directory should be always
be writable by named
.)
If the dnssec-validation
option is set to auto
,
named
automatically
sets up an initial-key
for the root zone. This initializing
key is built in to named
, and is current as of the release date. When
the root zone key changes, a running server will detect the change and
roll to the new key, but newly-installed servers being run for the first
time will need to be from a recent enough version of BIND to have been
built with the current key.
dnssec-policy
Block Grammar
dnssec-policy
Block
Definition and Usage
The dnssec-policy
statement defines a key and signing policy (KASP) for zones.
A KASP determines how one or more zones are signed with DNSSEC. For example, it specifies how often keys should roll, which cryptographic algorithms to use, and how often RRSIG records need to be refreshed. Multiple key and signing policies can be configured with unique policy names.
A policy for a zone is selected using a dnssec-policy
statement in
the zone
block, specifying the name of the policy that should be used.
- There are three built-in policies:
-
default
, which uses thedefault policy <dnssec_policy_default>
,insecure
, to be used when you want to gracefully unsign your zone,none
, which means no DNSSEC policy (the same as not selectingdnssec-policy
at all; the zone is not signed.)
Keys are not shared among zones, which means that one set of keys per zone is generated even if they have the same policy. If multiple views are configured with different versions of the same zone, each separate version uses the same set of signing keys.
The dnssec-policy
statement requires dynamic DNS to be set up, or inline-signing
to be
enabled.
If inline-signing
is
enabled, this means that a signed version of the zone is maintained
separately and is written out to a different file on disk (the zone's
filename plus a .signed
extension).
If the zone is dynamic because it is configured with an update-policy
or allow-update
, the DNSSEC
records are written to the filename set in the original zone's file
, unless inline-signing
is explicitly
set.
Key rollover timing is computed for each key according to the key
lifetime defined in the KASP. The lifetime may be modified by zone TTLs
and propagation delays, to prevent validation failures. When a key
reaches the end of its lifetime, named
generates and publishes a new key
automatically, then deactivates the old key and activates the new one;
finally, the old key is retired according to a computed schedule.
Zone-signing key (ZSK) rollovers require no operator input. Key-signing key (KSK) and combined-signing key (CSK) rollovers require action to be taken to submit a DS record to the parent. Rollover timing for KSKs and CSKs is adjusted to take into account delays in processing and propagating DS updates.
Policy default
causes the zone to be signed with a
single combined-signing key (CSK) using algorithm ECDSAP256SHA256; this
key has an unlimited lifetime. (A verbose copy of this policy may be
found in the source tree, in the file
doc/misc/dnssec-policy.default.conf
.)
Note
The default signing policy may change in future releases. This could
require changes to a signing policy when upgrading to a new version of
BIND. Check the release notes carefully when upgrading to be informed of
such changes. To prevent policy changes on upgrade, use an explicitly
defined dnssec-policy
,
rather than default
.
If a dnssec-policy
statement is modified and the server restarted or reconfigured, named
attempts to change
the policy smoothly from the old one to the new. For example, if the key
algorithm is changed, then a new key is generated with the new
algorithm, and the old algorithm is retired when the existing key's
lifetime ends.
Note
Rolling to a new policy while another key rollover is already in progress is not yet supported, and may result in unexpected behavior.
The following options can be specified in a dnssec-policy
statement:
keys
-
This is a list specifying the algorithms and roles to use when generating keys and signing the zone. Entries in this list do not represent specific DNSSEC keys, which may be changed on a regular basis, but the roles that keys play in the signing policy. For example, configuring a KSK of algorithm RSASHA256 ensures that the DNSKEY RRset always includes a key-signing key for that algorithm.
Here is an example (for illustration purposes only) of some possible entries in a
keys
list:keys { ksk key-directory lifetime unlimited algorithm rsasha256 2048; zsk lifetime P30D algorithm 8; csk lifetime P6MT12H3M15S algorithm ecdsa256; };
This example specifies that three keys should be used in the zone. The first token determines which role the key plays in signing RRsets. If set to
ksk
, then this is a key-signing key; it has the KSK flag set and is only used to sign DNSKEY, CDS, and CDNSKEY RRsets. If set tozsk
, this is a zone-signing key; the KSK flag is unset, and the key signs all RRsets except DNSKEY, CDS, and CDNSKEY. If set tocsk
, the key has the KSK flag set and is used to sign all RRsets.An optional second token determines where the key is stored. Currently, keys can only be stored in the configured
key-directory
. This token may be used in the future to store keys in hardware security modules or separate directories.The
lifetime
parameter specifies how long a key may be used before rolling over. In the example above, the first key has an unlimited lifetime, the second key may be used for 30 days, and the third key has a rather peculiar lifetime of 6 months, 12 hours, 3 minutes, and 15 seconds. A lifetime of 0 seconds is the same asunlimited
.Note that the lifetime of a key may be extended if retiring it too soon would cause validation failures. The key lifetime must be longer than the time it takes to do a rollover; that is, the lifetime must be more than the publication interval (which is the sum of
dnskey-ttl
,publish-safety
, andzone-propagation-delay
). It must also be more than the retire interval (which is the sum ofmax-zone-ttl
,retire-safety
andzone-propagation-delay
for ZSKs, and the sum ofparent-ds-ttl
,retire-safety
, andparent-propagation-delay
for KSKs and CSKs). BIND 9 treats a key lifetime that is too short as an error.The
algorithm
parameter specifies the key's algorithm, expressed either as a string ("rsasha256", "ecdsa384", etc.) or as a decimal number. An optional second parameter specifies the key's size in bits. If it is omitted, as shown in the example for the second and third keys, an appropriate default size for the algorithm is used. Each KSK/ZSK pair must have the same algorithm. A CSK combines the functionality of a ZSK and a KSK.
Automated KSK Rollovers
BIND has mechanisms in place to facilitate automated KSK rollovers. It publishes CDS and CDNSKEY records that can be used by the parent zone to publish or withdraw the zone's DS records. BIND will query the parental agents to see if the new DS is actually published before withdrawing the old DNSSEC key.
Note
The DS response is not validated so it is recommended to set up a trust relationship with the parental agent. For example, use TSIG to authenticate the parental agent, or point to a validating resolver.
The following options apply to DS queries sent to parental-agents
:
managed-keys
Block Grammar
managed-keys
Block Definition
and Usage
The managed-keys
statement has been deprecated in favor of trust-anchors
with the initial-key
keyword.
trusted-keys
Block Grammar
trusted-keys
Block Definition
and Usage
The trusted-keys
statement has been deprecated in favor of trust-anchors
with the static-key
keyword.
view
Block Grammar
view view_name [ class ] {
match-clients { address_match_list } ;
match-destinations { address_match_list } ;
match-recursive-only <boolean> ;
[ view_option ; ... ]
[ zone_statement ; ... ]
} ;
view
Block Definition and Usage
The view
statement
is a powerful feature of BIND 9 that lets a name server answer a DNS
query differently depending on who is asking. It is particularly useful
for implementing split DNS setups without having to run multiple
servers.
Zones defined within a view
statement are only accessible to clients that
match the view
. By
defining a zone of the same name in multiple views, different zone data
can be given to different clients: for example, "internal" and
"external" clients in a split DNS setup.
Many of the options given in the options
statement can also be used within a
view
statement, and
then apply only when resolving queries with that view. When no
view-specific value is given, the value in the options
statement
is used as a default. Also, zone options can have default values
specified in the view
statement; these view-specific defaults take precedence over those in
the options
statement.
Views are class-specific. If no class is given, class IN is assumed. Note that all non-IN views must contain a hint zone, since only the IN class has compiled-in default hints.
If there are no view
statements in the config file, a default view that matches any client is
automatically created in class IN. Any zone
statements specified on the top level of the
configuration file are considered to be part of this default view, and
the options
statement applies to the default view. If any explicit view
statements are present,
all zone
statements
must occur inside view
statements.
Here is an example of a typical split DNS setup implemented using
view
statements:
view "internal" {
// This should match our internal networks.
match-clients { 10.0.0.0/8; };
// Provide recursive service to internal
// clients only.
recursion yes;
// Provide a complete view of the example.com
// zone including addresses of internal hosts.
zone "example.com" {
type primary;
file "example-internal.db";
};
};
view "external" {
// Match all clients not matched by the
// previous view.
match-clients { any; };
// Refuse recursive service to external clients.
recursion no;
// Provide a restricted view of the example.com
// zone containing only publicly accessible hosts.
zone "example.com" {
type primary;
file "example-external.db";
};
};
zone
Block Grammar
zone
Block Definition and Usage
Zone Types
Class
The zone's name may optionally be followed by a class. If a class is
not specified, class IN
(for Internet
) is
assumed. This is correct for the vast majority of cases.
The hesiod
class is named for an information service
from MIT's Project Athena. It was used to share information about
various systems databases, such as users, groups, printers, and so on.
The keyword HS
is a synonym for hesiod.
Another MIT development is Chaosnet, a LAN protocol created in the
mid-1970s. Zone data for it can be specified with the CHAOS
class.
Zone Options
allow-notify
-
See the description of
allow-notify
inaccess_control
. allow-query
-
See the description of
allow-query
inaccess_control
. allow-query-on
-
See the description of
allow-query-on
inaccess_control
. allow-transfer
-
See the description of
allow-transfer
inaccess_control
. allow-update
-
See the description of
allow-update
inaccess_control
. update-policy
-
This specifies a "Simple Secure Update" policy. See
dynamic_update_policies
. allow-update-forwarding
-
See the description of
allow-update-forwarding
inaccess_control
. also-notify
-
This option is only meaningful if
notify
is active for this zone. The set of machines that receive aDNS NOTIFY
message for this zone is made up of all the listed name servers (other than the primary) for the zone, plus any IP addresses specified withalso-notify
. A port may be specified with eachalso-notify
address to send the notify messages to a port other than the default of 53. A TSIG key may also be specified to cause theNOTIFY
to be signed by the given key.also-notify
is not meaningful for stub zones. The default is the empty list. check-names
-
This option is used to restrict the character set and syntax of certain domain names in primary files and/or DNS responses received from the network. The default varies according to zone type. For
primary <type primary>
zones the default isfail
; forsecondary <type secondary>
zones the default iswarn
. It is not implemented forhint <type hint>
zones. check-mx
-
See the description of
check-mx
inboolean_options
. check-spf
-
See the description of
check-spf
inboolean_options
. check-wildcard
-
See the description of
check-wildcard
inboolean_options
. check-integrity
-
See the description of
check-integrity
inboolean_options
. check-sibling
-
See the description of
check-sibling
inboolean_options
. zero-no-soa-ttl
-
See the description of
zero-no-soa-ttl
inboolean_options
. update-check-ksk
-
See the description of
update-check-ksk
inboolean_options
. dnssec-loadkeys-interval
-
See the description of
dnssec-loadkeys-interval
inoptions
. dnssec-update-mode
-
See the description of
dnssec-update-mode
inoptions
. dnssec-dnskey-kskonly
-
See the description of
dnssec-dnskey-kskonly
inboolean_options
. try-tcp-refresh
-
See the description of
try-tcp-refresh
inboolean_options
.
dialup
-
See the description of
dialup
inboolean_options
.
forward
-
This option is only meaningful if the zone has a forwarders list. The
only
value causes the lookup to fail after trying the forwarders and getting no answer, whilefirst
allows a normal lookup to be tried. forwarders
-
This is used to override the list of global forwarders. If it is not specified in a zone of type
forward
, no forwarding is done for the zone and the global options are not used.
max-ixfr-ratio
-
See the description of
max-ixfr-ratio
inoptions
. max-journal-size
-
See the description of
max-journal-size
inserver_resource_limits
. max-records
-
See the description of
max-records
inserver_resource_limits
. max-transfer-time-in
-
See the description of
max-transfer-time-in
inzone_transfers
. max-transfer-idle-in
-
See the description of
max-transfer-idle-in
inzone_transfers
. max-transfer-time-out
-
See the description of
max-transfer-time-out
inzone_transfers
. max-transfer-idle-out
-
See the description of
max-transfer-idle-out
inzone_transfers
. notify
-
See the description of
notify
inboolean_options
. notify-delay
-
See the description of
notify-delay
intuning
. notify-to-soa
-
See the description of
notify-to-soa
inboolean_options
. zone-statistics
-
See the description of
zone-statistics
inoptions
.
sig-validity-interval
-
See the description of
sig-validity-interval
intuning
. sig-signing-nodes
-
See the description of
sig-signing-nodes
intuning
. sig-signing-signatures
-
See the description of
sig-signing-signatures
intuning
. sig-signing-type
-
See the description of
sig-signing-type
intuning
. transfer-source
-
See the description of
transfer-source
inzone_transfers
. transfer-source-v6
-
See the description of
transfer-source-v6
inzone_transfers
. notify-source
-
See the description of
notify-source
inzone_transfers
. notify-source-v6
-
See the description of
notify-source-v6
inzone_transfers
. min-refresh-time
;max-refresh-time
;min-retry-time
;max-retry-time
-
See the descriptions in
tuning
. ixfr-from-differences
-
See the description of
ixfr-from-differences
inboolean_options
. (Note that theixfr-from-differences
choices ofprimary <type primary>
andsecondary <type secondary>
are not available at the zone level.) key-directory
-
See the description of
key-directory
inoptions
. auto-dnssec
-
See the description of
auto-dnssec
inoptions
. serial-update-method
-
See the description of
serial-update-method
inoptions
.
multi-master
-
See the description of
multi-master
inboolean_options
. masterfile-format
-
See the description of
masterfile-format
intuning
. max-zone-ttl
-
See the description of
max-zone-ttl
inoptions
. The use of this option inzone
blocks is deprecated and will be rendered nonoperational in a future release.
Dynamic Update Policies
BIND 9 supports two methods of granting clients the right to perform dynamic updates to a zone:
allow-update
- a simple access control listupdate-policy
- fine-grained access control
In both cases, BIND 9 writes the updates to the zone's filename set
in file
.
In the case of a DNSSEC zone, DNSSEC records are also written to the
zone's filename, unless inline-signing
is enabled.
Note
The zone file can no longer be manually updated while
named
is running; it is now necessary to performrndc freeze
, edit, and then performrndc thaw
. Comments and formatting in the zone file are lost when dynamic updates occur.
Multiple Views
When multiple views are in use, a zone may be referenced by more than
one of them. Often, the views contain different zones with the same
name, allowing different clients to receive different answers for the
same queries. At times, however, it is desirable for multiple views to
contain identical zones. The in-view
zone option provides an efficient way to do
this; it allows a view to reference a zone that was defined in a
previously configured view. For example:
view internal {
match-clients { 10/8; };
zone example.com {
type primary;
file "example-external.db";
};
};
view external {
match-clients { any; };
zone example.com {
in-view internal;
};
};
An in-view
option
cannot refer to a view that is configured later in the configuration
file.
A zone
statement
which uses the in-view
option may not use any other options, with the exception of forward
and forwarders
. (These options
control the behavior of the containing view, rather than change the zone
object itself.)
Zone-level ACLs (e.g., allow-query, allow-transfer), and other configuration details of the zone, are all set in the view the referenced zone is defined in. Be careful to ensure that ACLs are wide enough for all views referencing the zone.
An in-view
zone
cannot be used as a response policy zone.
An in-view
zone is
not intended to reference a forward
zone.
Statements
BIND 9 supports many hundreds of statements; finding the right statement to control a specific behavior or solve a particular problem can be a daunting task. To simplify the task for users, all statements have been assigned one or more tags. Tags are designed to group together statements that have broadly similar functionality; thus, for example, all statements that control the handling of queries or of zone transfers are respectively tagged under query and transfer.
dnssec_tag_statements
are those that relate to or
control DNSSEC.
logging_tag_statements
relate to or control logging,
and typically only appear in a logging block.
query_tag_statements
relate to or control queries.
security_tag_statements
relate to or control security
features.
server_tag_statements
relate to or control server
behavior, and typically only appear in a server block.
transfer_tag_statements
relate to or control zone
transfers.
view_tag_statements
relate to or control view selection criteria, and typically only appear
in a view block.
zone_tag_statements
relate to or control zone behavior, and typically only appear in a zone
block.
deprecated_tag_statements
are those that are now
deprecated, but are included here for historical reference.
The following table lists all statements permissible in named.conf
, with their
associated tags; the next section groups the statements by tag. Please
note that these sections are a work in progress.
Statements by Tag
These tables group the various statements permissible in named.conf
by their
corresponding tag.
DNSSEC Tag Statements
Logging Tag Statements
Query Tag Statements
Security Tag Statements
Server Tag Statements
Transfer Tag Statements
View Tag Statements
Zone Tag Statements
Deprecated Tag Statements
BIND 9 Statistics
BIND 9 maintains lots of statistics information and provides several interfaces for users to access those statistics. The available statistics include all statistics counters that are meaningful in BIND 9, and other information that is considered useful.
The statistics information is categorized into the following sections:
- Incoming Requests
-
The number of incoming DNS requests for each OPCODE.
- Incoming Queries
-
The number of incoming queries for each RR type.
- Outgoing Queries
-
The number of outgoing queries for each RR type sent from the internal resolver, maintained per view.
- Name Server Statistics
-
Statistics counters for incoming request processing.
- Zone Maintenance Statistics
-
Statistics counters regarding zone maintenance operations, such as zone transfers.
- Resolver Statistics
-
Statistics counters for name resolutions performed in the internal resolver, maintained per view.
- Cache DB RRsets
-
Statistics counters related to cache contents, maintained per view.
The "NXDOMAIN" counter is the number of names that have been cached as nonexistent. Counters named for RR types indicate the number of active RRsets for each type in the cache database.
If an RR type name is preceded by an exclamation point (!), it represents the number of records in the cache which indicate that the type does not exist for a particular name; this is also known as "NXRRSET". If an RR type name is preceded by a hash mark (#), it represents the number of RRsets for this type that are present in the cache but whose TTLs have expired; these RRsets may only be used if stale answers are enabled. If an RR type name is preceded by a tilde (~), it represents the number of RRsets for this type that are present in the cache database but are marked for garbage collection; these RRsets cannot be used.
- Socket I/O Statistics
-
Statistics counters for network-related events.
A subset of Name Server Statistics is collected and shown per zone
for which the server has the authority, when zone-statistics
is set to
full
(or yes
), for backward compatibility. See
the description of zone-statistics
in options
for further details.
These statistics counters are shown with their zone and view names. The view name is omitted when the server is not configured with explicit views.
There are currently two user interfaces to get access to the
statistics. One is in plain-text format, dumped to the file specified by
the statistics-file
configuration option; the other is remotely accessible via a statistics
channel when the statistics-channels
statement is specified in the
configuration file.
The Statistics File
The text format statistics dump begins with a line, like:
+++ Statistics Dump +++ (973798949)
The number in parentheses is a standard Unix-style timestamp, measured in seconds since January 1, 1970. Following that line is a set of statistics information, which is categorized as described above. Each section begins with a line, like:
++ Name Server Statistics ++
Each section consists of lines, each containing the statistics counter value followed by its textual description; see below for available counters. For brevity, counters that have a value of 0 are not shown in the statistics file.
The statistics dump ends with the line where the number is identical to the number in the beginning line; for example:
--- Statistics Dump --- (973798949)
Statistics Counters
The following lists summarize the statistics counters that BIND 9 provides. For each counter, the abbreviated symbol name is given; these symbols are shown in the statistics information accessed via an HTTP statistics channel. The description of the counter is also shown in the statistics file but, in this document, may be slightly modified for better readability.
Name Server Statistics Counters
Requestv4
-
This indicates the number of IPv4 requests received. Note: this also counts non-query requests.
Requestv6
-
This indicates the number of IPv6 requests received. Note: this also counts non-query requests.
ReqEdns0
-
This indicates the number of requests received with EDNS(0).
ReqBadEDN SVer
-
This indicates the number of requests received with an unsupported EDNS version.
ReqTSIG
-
This indicates the number of requests received with TSIG.
ReqSIG0
-
This indicates the number of requests received with SIG(0).
ReqBadSIG
-
This indicates the number of requests received with an invalid (TSIG or SIG(0)) signature.
ReqTCP
-
This indicates the number of TCP requests received.
AuthQryRej
-
This indicates the number of rejected authoritative (non-recursive) queries.
RecQryRej
-
This indicates the number of rejected recursive queries.
XfrRej
-
This indicates the number of rejected zone transfer requests.
UpdateRej
-
This indicates the number of rejected dynamic update requests.
Response
-
This indicates the number of responses sent.
RespTruncated
-
This indicates the number of truncated responses sent.
RespEDNS0
-
This indicates the number of responses sent with EDNS(0).
RespTSIG
-
This indicates the number of responses sent with TSIG.
RespSIG0
-
This indicates the number of responses sent with SIG(0).
QrySuccess
-
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. QryAuthAns
-
This indicates the number of queries that resulted in an authoritative answer.
QryNoauthAns
-
This indicates the number of queries that resulted in a non-authoritative answer.
QryReferral
-
This indicates the number of queries that resulted in a referral answer. This corresponds to the
referral
counter of previous versions of BIND 9. QryNxrrset
-
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. QrySERVFAIL
-
This indicates the number of queries that resulted in SERVFAIL.
QryFORMERR
-
This indicates the number of queries that resulted in FORMERR.
QryNXDOMAIN
-
This indicates the number of queries that resulted in NXDOMAIN. This corresponds to the
nxdomain
counter of previous versions of BIND 9. QryRecursion
-
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. QryDuplicate
-
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. QryDropped
-
This indicates the number of recursive queries dropped by the server as a result of configured limits. These limits include the settings of the
fetches-per-zone
,fetches-per-server
,clients-per-query
, andmax-clients-per-query
options, as well as therate-limit
option. This corresponds to thedropped
counter of previous versions of BIND 9. QryFailure
-
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 asAuthQryRej
andRecQryRej
that would also fall into this counter are provided, so this counter is not of much interest in practice. QryNXRedir
-
This indicates the number of queries that resulted in NXDOMAIN that were redirected.
QryNXRedirRLookup
-
This indicates the number of queries that resulted in NXDOMAIN that were redirected and resulted in a successful remote lookup.
XfrReqDone
-
This indicates the number of requested and completed zone transfers.
UpdateReqFwd
-
This indicates the number of forwarded update requests.
UpdateRespFwd
-
This indicates the number of forwarded update responses.
UpdateFwdFail
-
This indicates the number of forwarded dynamic updates that failed.
UpdateDone
-
This indicates the number of completed dynamic updates.
UpdateFail
-
This indicates the number of failed dynamic updates.
UpdateBadPrereq
-
This indicates the number of dynamic updates rejected due to a prerequisite failure.
UpdateQuota
-
This indicates the number of times a dynamic update or update forwarding request was rejected because the number of pending requests exceeded
update-quota
. RateDropped
-
This indicates the number of responses dropped due to rate limits.
RateSlipped
-
This indicates the number of responses truncated by rate limits.
RPZRewrites
-
This indicates the number of response policy zone rewrites.
Zone Maintenance Statistics Counters
NotifyOutv4
-
This indicates the number of IPv4 notifies sent.
NotifyOutv6
-
This indicates the number of IPv6 notifies sent.
NotifyInv4
-
This indicates the number of IPv4 notifies received.
NotifyInv6
-
This indicates the number of IPv6 notifies received.
NotifyRej
-
This indicates the number of incoming notifies rejected.
SOAOutv4
-
This indicates the number of IPv4 SOA queries sent.
SOAOutv6
-
This indicates the number of IPv6 SOA queries sent.
AXFRReqv4
-
This indicates the number of requested IPv4 AXFRs.
AXFRReqv6
-
This indicates the number of requested IPv6 AXFRs.
IXFRReqv4
-
This indicates the number of requested IPv4 IXFRs.
IXFRReqv6
-
This indicates the number of requested IPv6 IXFRs.
XfrSuccess
-
This indicates the number of successful zone transfer requests.
XfrFail
-
This indicates the number of failed zone transfer requests.
Resolver Statistics Counters
Queryv4
-
This indicates the number of IPv4 queries sent.
Queryv6
-
This indicates the number of IPv6 queries sent.
Responsev4
-
This indicates the number of IPv4 responses received.
Responsev6
-
This indicates the number of IPv6 responses received.
NXDOMAIN
-
This indicates the number of NXDOMAINs received.
SERVFAIL
-
This indicates the number of SERVFAILs received.
FORMERR
-
This indicates the number of FORMERRs received.
OtherError
-
This indicates the number of other errors received.
EDNS0Fail
-
This indicates the number of EDNS(0) query failures.
Mismatch
-
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. Truncated
-
This indicates the number of truncated responses received.
Lame
-
This indicates the number of lame delegations received.
Retry
-
This indicates the number of query retries performed.
QueryAbort
-
This indicates the number of queries aborted due to quota control.
QuerySockFail
-
This indicates the number of failures in opening query sockets. One common reason for such failures is due to a limitation on file descriptors.
QueryCurUDP
-
This indicates the number of UDP queries in progress.
QueryCurTCP
-
This indicates the number of TCP queries in progress.
QueryTimeout
-
This indicates the number of query timeouts.
GlueFetchv4
-
This indicates the number of IPv4 NS address fetches invoked.
GlueFetchv6
-
This indicates the number of IPv6 NS address fetches invoked.
GlueFetchv4Fail
-
This indicates the number of failed IPv4 NS address fetches.
GlueFetchv6Fail
-
This indicates the number of failed IPv6 NS address fetches.
ValAttempt
-
This indicates the number of attempted DNSSEC validations.
ValOk
-
This indicates the number of successful DNSSEC validations.
ValNegOk
-
This indicates the number of successful DNSSEC validations on negative information.
ValFail
-
This indicates the number of failed DNSSEC validations.
QryRTTnn
-
This provides a frequency table on query round-trip times (RTTs). Each
nn
specifies the corresponding frequency. In the sequence ofnn_1
,nn_2
, ...,nn_m
, the value ofnn_i
is the number of queries whose RTTs are betweennn_(i-1)
(inclusive) andnn_i
(exclusive) milliseconds. For the sake of convenience, we definenn_0
to be 0. The last entry should be represented asnn_m+
, which means the number of queries whose RTTs are equal to or greater thannn_m
milliseconds. NumFetch
-
This indicates the number of active fetches.
BucketSize
-
This indicates the number the resolver's internal buckets (a static number).
REFUSED
-
This indicates the number of REFUSED responses received.
ClientCookieOut
-
This indicates the number of COOKIE sent with client cookie only.
ServerCookieOut
-
This indicates the number of COOKIE sent with client and server cookie.
CookieIn
-
This indicates the number of COOKIE replies received.
CookieClientOk
-
This indicates the number of COOKIE client ok.
BadEDNSVersion
-
This indicates the number of bad EDNS version replies received.
BadCookieRcode
-
This indicates the number of bad cookie rcode replies received.
ZoneQuota
-
This indicates the number of queries spilled due to zone quota.
ServerQuota
-
This indicates the number of queries spilled due to server quota.
ClientQuota
-
This indicates the number of queries spilled due to clients per query quota.
NextItem
-
This indicates the number of waits for next item, when an invalid response is received.
Priming
-
This indicates the number of priming fetches performed by the resolver.
Socket I/O Statistics Counters
Socket I/O statistics counters are defined per socket type, which are
UDP4
(UDP/IPv4), UDP6
(UDP/IPv6),
TCP4
(TCP/IPv4), TCP6
(TCP/IPv6),
Unix
(Unix Domain), and FDwatch
(sockets
opened outside the socket module). In the following list,
<TYPE>
represents a socket type. Not all counters are
available for all socket types; exceptions are noted in the
descriptions.
<TYPE>Open
-
This indicates the number of sockets opened successfully. This counter does not apply to the
FDwatch
type. <TYPE>OpenFail
-
This indicates the number of failures to open sockets. This counter does not apply to the
FDwatch
type. <TYPE>Close
-
This indicates the number of closed sockets.
<TYPE>BindFail
-
This indicates the number of failures to bind sockets.
<TYPE>ConnFail
-
This indicates the number of failures to connect sockets.
<TYPE>Conn
-
This indicates the number of connections established successfully.
<TYPE>AcceptFail
-
This indicates the number of failures to accept incoming connection requests. This counter does not apply to the
UDP
andFDwatch
types. <TYPE>Accept
-
This indicates the number of incoming connections successfully accepted. This counter does not apply to the
UDP
andFDwatch
types. <TYPE>SendErr
-
This indicates the number of errors in socket send operations.
<TYPE>RecvErr
-
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.