|
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.ca, named.local, hosts, and host.rev.
named.boot
The 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.
named.ca
named.ca establishes the names of root servers and lists their addresses. If you are connected to the internet, named.ca lists the Internet name servers; otherwise, it lists the root domain name servers for your local network.
hosts
The
hosts file contains all the data about the machines in the local zone.
hosts.rev
The
hosts.rev file specifies a zone in the IN-ADDR.ARPA domain (the special domain that allows inverse mapping).
named.local
The
named.local file specifies the address for the local loopback interface, or localhost, with the network address 127.0.0.1.
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 . named.ca #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.doc.com sirius
#The lines indicate that the server is also a primary server for #45.123.in-addr.arpa (that is reverse address domain) and #0.0.127.in-addr.arpa (that is the local host loopback)
primary 45.123.in-addr.arpa sirius.rev primary 0.0.127.in-addr.arpa 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 . altair.ca
#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.sales.doc.com 123.45.6.1 111.22.3.4 altair.host secondary 3.22.111.in-addr.arpa 123.45.6.1 111.22.3.4 altair.rev primary 0.0.127.in-addr.arpa 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 www.sun.com)
; ; SOA rec doc.com IN SOA sirius.doc.com sysop.centauri.doc.com ( 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 doc.com IN NS sirius.doc.com sales.doc.com IN NS altair.sales.doc.com ; Addresses localhost IN A 127.0.0.1 sirius IN A 123.45.6.1 rigel IN A 123.45.6.112 antares IN A 123.45.6.90 polaris IN A 123.45.6.101 procyon IN A 123.45.6.79 tauceti IN A 123.45.6.69 altair.sales.doc.com IN A 111.22.3.4 ; aliases durvasa IN CNAME sirius.doc.com dnsmastr IN CNAME sirius.doc.com dnssales IN CNAME altair.sales.doc.com
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 www.sun.com)
; SOA rec 0.0.127.in-addr.arpa. IN SOA sirius.doc.com sysop.centauri.doc.com ( 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 0.0.127.in-addr.arpa. IN NS sirius.doc.com 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 www.sun.com)
; SOA rec 6.45.123.in-addr.arpa. IN SOA sirius.doc.com sysop.centauri.doc.com ( 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 6.45.123.in-addr.arpa. IN NS sirius.doc.com 1 IN PTR sirius.doc.com
1.3.6 Setting up named.ca file
The
named.ca 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
named.ca file (taken from www.sun.com)
; ; formerly NS1.ISI.EDU . 3600000 NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107 ; ; formerly C.PSI.NET . 3600000 NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 ; ; formerly TERP.UMD.EDU . 3600000 NS D.ROOT-SERVERS.NET. D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90 ; ; formerly NS.NASA.GOV ;. 3600000 NS E.ROOT-SERVERS.NET. E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 ; ; formerly NS.ISC.ORG . 3600000 NS F.ROOT-SERVERS.NET. F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 ; ; formerly NS.NIC.DDN.MIL . 3600000 NS G.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 ; ; formerly AOS.ARL.ARMY.MIL . 3600000 NS H.ROOT-SERVERS.NET. H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 ; ; formerly NIC.NORDU.NET . 3600000 NS I.ROOT-SERVERS.NET. I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 ; ; temporarily housed at NSI (InterNIC) . 3600000 NS J.ROOT-SERVERS.NET. J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10 ; ; temporarily housed at NSI (InterNIC) . 3600000 NS K.ROOT-SERVERS.NET. K.ROOT-SERVERS.NET. 3600000 A 198.41.0.11 ; ; temporarily housed at ISI (IANA) . 3600000 NS L.ROOT-SERVERS.NET. L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12 ; ; temporarily housed at ISI (IANA) . 3600000 NS M.ROOT-SERVERS.NET. M.ROOT-SERVERS.NET. 3600000 A 198.32.65.12 ; 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
$ORIGIN
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 ( serial refresh retry expire minimum )
Example (taken from www.sun.com):
; sample hosts file @ IN SOA nismaster.doc.com. root.nismaster.doc.com. ( 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
Example:
;{name}{ttl} class NS Name-server name IN NS sirius.doc.com
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
Example:
;{name} {ttl} class A address sirius IN A 123.45.6.1
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
Example:
;{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
Example:
;{name} {ttl} class WKS Address Protocol list of services IN WKS 128.32.0.10 UDP who route times domain IN WKS 128.32.0.10 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 domain nameserver)
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
Example:
;nickname {ttl} class CNAME Canonical name durvasa IN CNAME sirius.doc.com
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
Example:
;special name {ttl} class PTR real name 7.0 IN PTR joe.doc.com 2.2.18.128.in-addr.arpa IN PTR scott.doc.com
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
Example:
;{name} {ttl} class MX preference value mailer exchanger post.doc.com IN MX 0 mail1.doc.com posta.doc.com IN MX 10 mail2.doc.com poste.doc.com IN MX 20 mail3.doc.com
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
hostname=hostname
Example:
hostname=doc.com
2. Make sure that the following line is in the startup script:
/usr/sbin/in.named
|