Installation guide

Chapter 16. Berkeley Internet Name Domain (BIND) 235
nameservers use only few of them. The following zone statements are very basic examples that can
be used in a master-slave nameserver relationship.
The following is an example of a zone statement for the primary nameserver hosting domain.com:
zone "domain.com" IN {
type master;
file "domain.com.zone";
allow-update { none; };
};
In the statement, the zone is identified as domain.com, the type is set to master, and the named
service is instructed to read the /var/named/domain.com.zone file. It also tells named not to
allow by any other hosts to update.
A slave server’s zone statement for domain.com looks slightly different form 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.
A slave server’s zone statement for domain.com may look like this:
zone "domain.com" {
type slave;
file "domain.com.zone";
masters { 192.168.0.1; };
};
This zone statement tells named on the slave server to look for the master server at the 192.168.0.1
IP address to find information for the domain.com zone. The information the slave server receives
from the master server is saved in the /var/named/domain.com.zone file.
16.2.2. Zone Files
Zone files, which contain information about a particular namespace, are stored in the named working
directory. By default, this is /var/named. Each zone file is named according to the file option data
in the zone statement, usually in a way that relates to the domain in question and identifies the file as
containing zone data, such as example.com.zone.
Each zone file may contain directives and resource records. Directives tell the nameserver to do a
certain thing or apply a special setting to the zone. Resource records define the parameters of the
zone, assigning an identity within the zone’s namespace to particular systems. Directives are optional,
but resource records are required to provide nameservice to that zone. All directives and resource
records should go on their own lines.
Comments can be placed after semicolon characters (;) in zone files.
16.2.2.1. Zone File Directives
Directives are identified by the leading $ character before the name of the directive and usually placed
at the top of the zone file.
The following directives are the most commonly used:
$INCLUDE Tells named to include another zone file in this zone file at the place where the
directive is used. This allows additional zone settings to be stored apart from the main zone file.
$ORIGIN Sets the domain name to be appended to any unqualified records, such as those that
only specify the host and nothing more.