Aqua Phoenix
     >>  References >>  Operating Systems  


1.3 Setting up a Domain Name Server

1.3.1 Creating Boot and Data Files

In addition to the daemon named, DNS on a name server consits of a boot file and local data files. The default location of the boot file is /etc/named.boot. Common names for the local data files are, named.local, hosts, and host.rev.

named.bootThe boot file named.boot establishes the server as a primary, a secondary, or a caching-only name server. It also specifies the zones over which the server has authority, and which data files it should read to get its initial data.

The boot file is read by named when the daemon is started by the server's startup script /etc/inet/rc.inet. establishes the names of root servers and lists their addresses. If you are connected to the internet, lists the Internet name servers; otherwise, it lists the root domain name servers for your local network.

hostsThe hosts file contains all the data about the machines in the local zone.

hosts.revThe hosts.rev file specifies a zone in the IN-ADDR.ARPA domain (the special domain that allows inverse mapping).

named.localThe named.local file specifies the address for the local loopback interface, or localhost, with the network address

1.3.2 Setting up the Boot file

The following is a sample boot file for a primary server:

#The following line in the boot file designates the directory in which
#you want the name server to run
directory /var/named

#A name server needs to know which servers are the authoritive name
#servers for the root zone.
cache      .              
#The first field designates the server as primary for the zone
#stated in the second field. The third field is the name of the
#file from which authorative data is read.
primary      sirius

#The lines indicate that the server is also a primary server for (that is reverse address domain) and (that is the local host loopback)

primary      sirius.rev
primary    named.local
The following is a sample boot file for a secondary server in the same domain as the above primary server:

directory /var/named
cache      .              

#The word secondary establishes that this is a secondary server for the zone
#listed in the second field, and that it is to get its data from the listed
#servers. If there is a filename after the list of servers, data for the zone
#will be put into that file as a backup.
secondary  altair.rev
primary    altair.local

1.3.3 Setting up the Data Files

All the data files used by the DNS daemon named are written in Standard Resource Record Format. In Standard Resource Record Format, each line of a file is a record, called a Resource Record (RR). Each DNS data file must contain certain Resource Records.

1.3.4 Setting up the Host Data Files

The hosts file contains all the data about all the machines in your zone including server names, addresses, host information (hardware and operating system information), cannonical names and aliases, the service supported by a particular protocol at a specific address, and group and user information related to mail services. This information is represented in the records NS, A, HINFO, CNAME, WKS, MX, MB, MR, MG. The file also includes the SOA record, which indicates the start of a zone and includes the names of the host on which the data files reside.

Example of hosts file (taken from

; SOA rec  IN SOA (
                1997071401      ;  serial number (YYYYMMDD##)
                      10800      ;  refresh every 3 hours
                      10800      ;  retry every 3 hours
                      604800      ;  expire after a week
                      86400 )    ;  TTL of 1 day
; Name Servers                  IN  NS            IN  NS
; Addresses
localhost                IN  A
sirius                    IN  A
rigel                    IN  A
antares                  IN  A
polaris                  IN  A
procyon                  IN  A
tauceti                  IN  A      IN  A
; aliases
durvasa                  IN  CNAME
dnsmastr                  IN  CNAME
dnssales                  IN  CNAME

1.3.5 Setting up named.local file

The named.local file sets up the local loopback interface for your name server.

Example of named.local file (taken from

; SOA rec IN SOA (
                          1997071401      ;  serial number (YYYYMMDD##)           
                          10800          ;  refresh every 3 hours
                          10800          ;  retry every 3 hours
                          604800          ;  expire after a week
                          86400 )        ;  TTL of 1 day
; Name Servers      IN  NS
1                          IN  PTR  localhost.
Seting up hosts.rev

hosts.rev is the file that sets up inverse mapping.

Example of hosts.rev file (taken from

; SOA rec  IN SOA (
                1997071401      ;  serial number (YYYYMMDD##)
                      10800      ;  refresh every 3 hours
                      10800      ;  retry every 3 hours
                      604800      ;  expire after a week
                      86400 )    ;  TTL of 1 day
; Name Servers  IN  NS
1                        IN  PTR

1.3.6 Setting up file

The file contains the names and addresses of the root servers. Server names are indicated in the record NS and address in the record A. You need to add an NS record and an A record for each root server you want to include in the file.

Example of file (taken from

; formerly NS1.ISI.EDU
.                        3600000    NS  B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET.      3600000    A
; formerly C.PSI.NET
.                        3600000    NS  C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET.      3600000    A
; formerly TERP.UMD.EDU
.                        3600000    NS  D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET.      3600000    A
; formerly NS.NASA.GOV
;.                      3600000    NS  E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET.      3600000    A
; formerly NS.ISC.ORG
.                        3600000    NS  F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET.      3600000    A
; formerly NS.NIC.DDN.MIL
.                        3600000    NS  G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET.      3600000    A
; formerly AOS.ARL.ARMY.MIL
.                        3600000    NS  H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET.      3600000    A
; formerly NIC.NORDU.NET
.                        3600000    NS  I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET.      3600000    A
; temporarily housed at NSI (InterNIC)
.                        3600000    NS  J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET.      3600000    A
; temporarily housed at NSI (InterNIC)
.                        3600000    NS  K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000    A
; temporarily housed at ISI (IANA)
.                        3600000    NS  L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000    A
; temporarily housed at ISI (IANA)
.                        3600000    NS  M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000    A
; End of File

1.3.7 Understanding Standard Resource Record Format

In the Standard Resource Record Format, each line of a data file is a record called a Resource Record (RR), containing the following fields separated by white space:

{name} {ttl} class RecordType Record-specific-data

The order of the fields is always the same; however, the first two are optional, and the contents of the last vary according to the Record Type field.

name : The first field is the name of the domain that applies to the record. If this field is left blank in a given RR, it defaults to the name of the previous RR.

ttl : The second field is an optional time-to-live field. This specifies how long (in seconds) this data will be cached in the database before it is disregarded and new information is requested from a server. By leaving this field blank, the ttl defaults to the minimum time specified in the Start of Authority (SOA) resource record.

class : The third field is the record class. Only one class is in use: IN for the TCP/IP protocol family.

type : The fourth field states the type of the resource record.

RR data : The contents of the data field depend on the type of the particular Resource Record.

Special Characters:

. : A free Standing dot in the name field refers to the current domain.

@ : A free standing @ in the name field denotes the current origin.

.. : Two free standing dots represent the null domain name of the root when used in the name field.

\X : Where X is any character other than a digit (0-9), quotes that character so that its special meaning does not apply.

\DDD : Where D is a digit, this is the octet corresponding to the decimal number described by DDD.

() : Use parentheses to group data that crosses a line.

; - Semicolon starts a comment; the remainder of the line is ignored.

* : An asterisk signifies wildcarding.

1.3.8 Control Entities

The only lines that do not conform to the standard RR format in a data file are control entry lines.

There are two kinds of control entries:

$INCLUDE /etc/named/data/mailboxes

This line is interpreted as a request to load the file /etc/named/data/mailboxes


The origin command is a way of changing the origin on a data file.

1.3.9 Most commonly used types of RR's

SOA : Start of Authority

NS : Name Server

A : Internet Address

CNAME : Canonical name (nickname)

HINFO : Host Information

WKS: Well Known Services

PTR : Pointer

MX : Mail Exchanger

1.3.10 SOA : Start of Authority

The following is the format of a Start of Authority resource record:

name {ttl}  {class}  SOA  origin  person-in-charge (
                      minimum )
Example (taken from

; sample  hosts  file
@ IN      SOA (
  109 ; Serial
  10800 ; Refresh
                  1800 ; Retry
  3600000 ; Expire
  86400 ) ; Minimum

name : indicates the name of the zone. In the example above, @ indicates the current zone or origin.

IN : is the address class.

SOA : is the type of Resource Record.

Origin : is the name of the host where this data file resides.

Person in charge : is the mailing address for the person responsible for the name server.

Serial : is the version number of this data file. Secondary servers use the Serial field to detect whether the data file has been changed since the last time they copied the file from the mail server.

Refresh : indicates how often, in seconds, a secondary server should check with the primary name server to see if an update is needed.

Retry : indicates how long, in seconds, a secondary server is to retry after a failure to check for a refresh.

Expire : is the upper limit, in seconds, that a secondary name server is to use the data before it expires for lack of getting a refresh.

Minimum : is the default number of seconds to be used for the time to live field on resource record that don't have a ttl specified.

There should only be one SOA record per zone.

1.3.11 NS : Name Server

The following is the format of an NS resource record:

{name} {ttl}  class  NS  Name-server name

;{name}{ttl}  class  NS  Name-server name
              IN      NS
The Name Server record (NS) lists by name a server responsible for a given domain.

1.3.12 A : Address

The following is the format of an A resource record:

{name} {ttl}  class  A  address

;{name} {ttl}  class  A  address
sirius          IN      A
The address record (A) lists the address for a given machine.

HINFO : Host Information

The following is the format of an HINFO resource record:

{name} {ttl}  class  HINFO  Hardware  OS

;{name} {ttl}  class  HINFO  Hardware  OS
                IN      HINFO  Sun-3/280  UNIX
The Host Information resource record (HINFO) contains host specific data.

1.3.13 WKS : Well Known Services

The following is the format of a WKS resource record:

{name} {ttl}  class  WKS  Address  Protocol  list of services

;{name} {ttl}  class  WKS  Address      Protocol  list of services
                IN      WKS  UDP        who route times domain
                IN      WKS  TCP        (echo telnet
                                                      discard rpc sftp
                                                      uucp-path systat daytime
                                                      netstat qotd nntp
                                                      link chargen ftp
                                                      auth time whots mtp
                                                      pop rje finger smtp
                                                      suqdup hostnames
The well known Services record (WKS) describes the well known services supported by a particular protocol at a specified address. The list of services and port numbers come from the list of services specified in the services database. Only one WKS record should exist per protocol per address.

1.3.14 CNAME : Canonical Name

The format of a CNAME resource record:

nickname {ttl}  class  CNAME  Canonical name

;nickname {ttl}  class  CNAME  Canonical name
durvasa          IN      CNAME
The Canonical Name resource record (CNAME) specifies a nickname for a canonical name. A nickname should be unique. All other resource records should be associated with the canonical name and not with the nickname.

1.3.15 PTR : Domain Name Pointer

The format of a PTR resource record:

special name {ttl}      class  PTR  real name

;special name {ttl}      class  PTR  real name
7.0                      IN      PTR  IN      PTR
A pointer record (PTR) allows special names to point to some other location in the domain.

1.3.16 MX : Mail Exchanger

{name} {ttl}  class  MX  preference value  mailer exchanger

;{name} {ttl}  class  MX  preference value  mailer exchanger  IN      MX  0          IN      MX  10        IN      MX  20      
The Mail Exchanger (MX) resource records are used to specify a machine that knows how to deliver mail to a domain or machines in a domain.

1.3.17 Modifying the Startup Script

Once you create the boot and data files that named needs, you have to edit the startup script /etc/inet/rc.inet, following these steps:

1. set up the host name.

Set the hostname in the startup script to the full domain name by adding the line

2. Make sure that the following line is in the startup script: