Common Statement Types
The following types of statements are commonly used in The An In this statement, replace The following access control lists are already defined as keywords to simplify configuration:
When used in conjunction with other statements (such as the The following example defines two access control lists and uses an This example contains two access control lists, The An In this statement, The The In this statement, the The following are commonly used options:
Specifies which hosts are allowed to query this nameserver. By default, all hosts are allowed to query. An access control list, or collection of IP addresses or networks, may be used here to allow only particular hosts to query the nameserver. Similar to Specifies which hosts are not allowed to query the server.
Specifies the Specifies a list of valid IP addresses for nameservers where requests should be forwarded for resolution.
Specifies the forwarding behavior of a The following options are accepted:
Specifies the network interface on which Using this directive on a DNS server which also acts a gateway, BIND can be configured to only answer queries that originate from one of the networks.
The following is an example of a In this example, only requests that arrive from the network interface serving the private network ( Controls whether Specifies the location of the process ID file created by Turns on the enforcement of delegation properties in top-level domains (TLDs) and root zones with an optional exclude list. Delegation is the process of dividing a single zone into multiple subzones. In order to create a delegated zone, items known as NS records are used. NameServer records (delegation records) announce the authoritative nameservers for a particular zone.
The following Specifies an alternate location for statistics files. By default, There are several other options also available, many of which rely upon one another to work properly. Refer to the BIND 9 Administrator Reference Manual referenced in "Installed Documentation" and the A A In this statement, The If you have installed the For example, if a For more information about zone files, refer to "Zone Files".
The most common Specifies the clients that are allowed to request information about this zone. The default is to allow all query requests. Specifies the slave servers that are allowed to request a transfer of the zone's information. The default is to allow all transfer requests.
Specifies the hosts that are allowed to dynamically update information in their zone. The default is to deny all dynamic update requests.
Be careful when allowing hosts to update information about their zone. Do not enable this option unless the host specified is completely trusted. In general, it is better to have an administrator manually update the records for a zone and reload the Specifies the name of the file in the Specifies the IP addresses from which to request authoritative zone information and is used only if the zone is defined as Specifies whether or not Defines the type of zone.
Below is a list of valid options:
Configures Most changes to the The following is an example of a In the statement, the zone is identified as A slave server's The following is an example slave server This /etc/named.conf
:
acl
Statementacl
statement (or access control statement) defines groups of hosts which can then be permitted or denied access to the nameserver.
acl
statement takes the following form:
acl
<acl-name>
{
<match-element>
;
[<match-element>
; ...]
};<acl-name>
with the name of the access control list and replace <match-element>
with a semi-colon separated list of IP addresses. Most of the time, an individual IP address or IP network notation (such as 10.0.1.0/24
) is used to identify the IP addresses within the acl
statement.
any
- Matches every IP address
localhost
- Matches any IP address in use by the local system
localnets
- Matches any IP address on any network to which the local system is connected
none
- Matches no IP addressesoptions
statement), acl
statements can be very useful in preventing the misuse of a BIND nameserver.
options
statement to define how they are treated by the nameserver:
acl black-hats {
10.0.2.0/24;
192.168.0.0/24;
};
acl red-hats {
10.0.1.0/24;
};
options {
blackhole { black-hats; };
allow-query { red-hats; };
allow-recursion { red-hats; };
};
black-hats
and red-hats
. Hosts in the black-hats
list are denied access to the nameserver, while hosts in the red-hats
list are given normal access.include
Statementinclude
statement allows files to be included in a named.conf
file. In this way, sensitive configuration data (such as keys
) can be placed in a separate file with restrictive permissions.
include
statement takes the following form:
include "
<file-name>
"<file-name>
is replaced with an absolute path to a file.options
Statementoptions
statement defines global server configuration options and sets defaults for other statements. It can be used to specify the location of the named
working directory, the types of queries allowed, and much more.
options
statement takes the following form:
options {
<option>
;
[<option>
; ...]
};<option>
directives are replaced with a valid option.
allow-query
allow-recursion
allow-query
, this option applies to recursive queries. By default, all hosts are allowed to perform recursive queries on the nameserver.
blackhole
directory
named
working directory if different from the default value, /var/named/
.
forwarders
forward
forwarders
directive.
first
- Specifies that the nameservers listed in the forwarders
directive be queried before named
attempts to resolve the name itself.
only
- Specifies that named
does not attempt name resolution itself in the event that queries to nameservers specified in the forwarders
directive fail.listen-on
named
listens for queries. By default, all interfaces are used.
listen-on
directive:
options {
listen-on { 10.0.1.1; };
};
10.0.1.1
) are accepted.
notify
named
notifies the slave servers when a zone is updated. It accepts the following options:
yes
- Notifies slave servers.
no
- Does not notify slave servers.
explicit
- Only notifies slave servers specified in an also-notify
list within a zone statement.pid-file
named
.
root-delegation-only
root-delegation-only
example specifies an exclude list of TLDs from whom undelegated responses are expected and trusted:
options {
root-delegation-only exclude { "ad"; "ar"; "biz"; "cr"; "cu"; "de"; "dm"; "id";
"lu"; "lv"; "md"; "ms"; "museum"; "name"; "no"; "pa";
"pf"; "se"; "sr"; "to"; "tw"; "us"; "uy"; };
};
statistics-file
named
statistics are saved to the /var/named/named.stats
file.bind.conf
man page for more details.zone
Statementzone
statement defines the characteristics of a zone, such as the location of its configuration file and zone-specific options. This statement can be used to override the global options
statements.
zone
statement takes the following form:
zone
<zone-name>
<zone-class>
{
<zone-options>
;
[<zone-options>
; ...]
};<zone-name>
is the name of the zone, <zone-class>
is the optional class of the zone, and <zone-options>
is a list of options characterizing the zone.
<zone-name>
attribute for the zone statement is particularly important. It is the default value assigned for the $ORIGIN
directive used within the corresponding zone file located in the /var/named/
directory. The named
daemon appends the name of the zone to any non-fully qualified domain name listed in the zone file.
caching-nameserver
package, the default configuration file will be in /etc/named.rfc1912.zones
.
zone
statement defines the namespace for example.com
, use example.com
as the <zone-name>
so it is placed at the end of hostnames within the example.com
zone file.
zone
statement options include the following:
allow-query
allow-transfer
allow-update
named
service.
file
named
working directory that contains the zone's configuration data.
masters
type
slave
.
notify
named
notifies the slave servers when a zone is updated. This directive accepts the following options:
yes
- Notifies slave servers.
no
- Does not notify slave servers.
explicit
- Only notifies slave servers specified in an also-notify
list within a zone statement.type
delegation-only
- Enforces the delegation status of infrastructure zones such as COM, NET, or ORG. Any answer that is received without an explicit or implicit delegation is treated as NXDOMAIN
. This option is only applicable in TLDs or root zone files used in recursive or caching implementations.
forward
- Forwards all requests for information about this zone to other nameservers.
hint
- A special type of zone used to point to the root nameservers which resolve queries when a zone is not otherwise known. No configuration beyond the default is necessary with a hint
zone.
master
- Designates the nameserver as authoritative for this zone. A zone should be set as the master
if the zone's configuration files reside on the system.
slave
- Designates the nameserver as a slave server for this zone. Also specifies the IP address of the master nameserver for the zone.zone-statistics
named
to keep statistics concerning this zone, writing them to either the default location (/var/named/named.stats
) or the file listed in the statistics-file
option in the server
statement. Refer to "Other Statement Types" for more information about the server
statement.Sample
zone
Statements/etc/named.conf
file of a master or slave nameserver involves adding, modifying, or deleting zone
statements. While these zone
statements can contain many options, most nameservers require only a small subset to function efficiently. The following zone
statements are very basic examples illustrating a master-slave nameserver relationship.
zone
statement for the primary nameserver hosting example.com
(192.168.0.1
):
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
};
example.com
, the type is set to master
, and the named
service is instructed to read the /var/named/example.com.zone
file. It also tells named
not to allow any other hosts to update.
zone
statement for example.com
is slightly different from the previous example. For a slave server, the type is set to slave
and in place of the allow-update
line is a directive telling named
the IP address of the master server.
zone
statement for example.com
zone:
zone "example.com" {
type slave;
file "example.com.zone";
masters { 192.168.0.1; };
};
zone
statement configures named
on the slave server to query the master server at the 192.168.0.1
IP address for information about the example.com
zone. The information that the slave server receives from the master server is saved to the /var/named/example.com.zone
file.