Step by Step
TM
Linux Guide.
Page 265
5. The reverse mapping file name uses the subnet number
and .rev i.e.. if the zone is 23.168.192.IN-ADDR.ARPA the file is called 192.168.23.rev.
6. The localhost zone file is called pri.localhost typically
called localhost.zone on BIND distributions. The reverse mapping file is called localhost.rev typically called
named.local in BIND distributions.
Note:
For most Linux distributions you have a small overhead at the beginning to rename the supplied files but the author considers it worthwhile in the
long run to avaoid confusion. Final point on this topic: Whatever your convention be rigorous in its
application
6.2 Master Primary DNS Server
The functionality of the master name server was previously
described
.
Master Name Server Configuration
The BIND DNS configuration provides the following functionality:
1. master DNS for mydomain.com
2. provides caching services for all other domains
3. provides recursive query services for all resolvers
The BIND named.conf is as follows click to look at any file:
MASTER CACHING NAME SERVER for MYDOMAIN, INC. maintained by: me myself alone
CHANGELOG: 1. 9 july 2003 - did something
2. 16 july 2003 - did something else 3. 23 july 2003 - did something more
options { directory varnamed;
Step by Step
TM
Linux Guide.
Page 266
version statement for security to avoid hacking known weaknesses
version not currently available; optional - disables transfers except from slave
transfer-allow {192.168.23.1; };
log to varlognamedmydomain.log all events from info UP in severity no debug
defaults to use 3 files in rotation BIND 8.x logging MUST COME FIRST in this file
BIND 9.x parses the whole file before using the log failure messages up to this point are in syslog
varlogmessages logging{
channel mydomain_log{ file varlognamedmydomain.log versions 3;
severity info; };
category default{ mydomain_log;
}; };
required zone for recursive queries zone . {
type hint; file
root.servers ;
}; zone mydomain.com in{
type master; file
pripri.mydomain.com ;
}; required local host domain
zone localhost in{ type master;
file
pri.localhost ;
allow-update{none;}; };
localhost reverse map zone 0.0.127.in-addr.arpa in{
type master; file
localhost.rev ;
allow-update{none;}; };
reverse map for class C 192.168.0.0 zone 0.168.192.IN-ADDR.ARPA in{
type master; file
192.168.0.rev ;
};
Step by Step
TM
Linux Guide.
Page 267
Sa m ple r oot .se r v e r file
The r oot .ser v er s file con t ains addr esses of ser ver s w hich can supply a list of t he r oot ser v er s t his file is t ypically called nam ed.ca or
nam ed.r oot in a st andar d BI ND dist r ibut ions .
When BI ND loads it uses t his file defined in a special zone t ype hint t o cont act a ser v er t o updat e it s list of r oot - ser ver s. I f t he
r oot .ser ver s files has not been defined BI ND has it s ow n com piled list of ser v er s for class I N only.
This file w ill get out of dat a but as long as t her e is one oper at ion ser v er , BI ND w ill find what it is looking for . Unless y ou need v er y
quick load t im es you can leave t his file alone. The r oot .ser ver s file t ells you w her e t o get an updat ed copy or you can get on e fr on
I CAN N .
; This file is made available by InterNIC registration services ; under anonymous FTP as file domainnamed.root
; on server FTP.RS.INTERNIC.NET ; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services NSI ; submenu InterNIC Registration Archives
; file named.root ; last update: Aug 22, 1997
; related version of root zone: 1997082200 ;
.
3600000 IN NS A.ROOT-SERVERS.NET. A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
; .
3600000 NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
; .
3600000 NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
; .
3600000 NS D.ROOT-SERVERS.NET. D.ROOT-SERVERS.NET. 3600000 A 128.8.10.9
; .
3600000 NS E.ROOT-SERVERS.NET. E.ROOT-SERVERS.NET 3600000 A 192.203.230.10
; .
3600000 NS F.ROOT-SERVERS.NET. F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
; .
3600000 NS G.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
; .
3600000 NS H.ROOT-SERVERS.NET.
Step by Step
TM
Linux Guide.
Page 268
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 ;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 ;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10 ;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12 ;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 ; End of File
pripri.mydomain.com
This file pr i.m ydom ain.com is t he st andar d sam ple zone file used t hr oughout t his Chapt er and has t he follow ing char act er ist ics. NOTE:
Bot h ext er nally visible public ser vices and int er nal host s ar e defined in t his file.
1. Tw o nam e ser v er s ar e used one int er nal
ns1 and one ext er nal ns2 t o t he dom ain 2.
The m ail ser vice is ext er nal t o t he dom ain pr ovided by a t hir d par t y
3. FTP and WWW ser vices ar e pr ovided by t he
sam e h ost 4.
Ther e ar e t w o host s nam ed bill and fr ed 5.
The host addr esses ar e all in t he class C pr ivat e addr ess r ange 1 92.168.0.0 a
slight ly ar t ificial case
The Re sou r ce Re cor d s ar e all defined separ at ely.
Step by Step
TM
Linux Guide.
Page 269
TTL 86400 ; 24 hours could have been written as 24h
ORIGIN mydomain.com. 1D IN
SOA ns1.mydomain.com. mymail.mydomain.com. 2002022401 ; serial
3H ; refresh 15 ; retry
1w ; expire 3h ; minimum
IN NS ns1.mydomain.com. ; in the domain IN NS ns2.smokeyjoe.com. ; external to domain
IN MX 10 mail.another.com. ; external mail provider
; server host definitions ns1 IN A 192.168.0.1 ;name server definition
www IN A 192.168.0.2 ;web server definition ftp IN CNAME www.mydomain.com. ;ftp server
definition ; non server domain hosts
bill IN A 192.168.0.3 fred IN A 192.168.0.4
Sa m ple pr i.loca lh ost z on e file
This file supplied wit h t he st andar d dist r ibut ions t his file is t ypically called localhost .zone in BI ND dist r ibut ions is a m odel of br evit y and
ver y cr ypt ic Com m ent s have been added t o clar ify t he definit ions. This file should not need m odificat ion.
The pr i.localhost file m aps t he nam e localhost t o t he local or loopback addr ess 127.0.0.1 . I t is used by m any sy st em pr ogr am s.
TTL 86400 ; 24 hours could have been written as 24h
ORIGIN localhost. ; line below = localhost 1D IN SOA localhost root.localhost
1D IN SOA root 2002022401 ; serial
3H ; refresh 15 ; retry
1w ; expire 3h ; minimum
1D IN NS 1D IN A 127.0.0.1
Step by Step
TM
Linux Guide.
Page 270
Sa m ple loca lh ost Re v e r se M a p z on e file
The localhost r ev er se- m apping file w hich t his guide calls locahost .r ev is supplied w it h t he st andar d BI ND dist r ibut ions t his file is t ypically
called nam ed.local in BI ND dist r ibut ions . This file should not need m odificat ion. This file lacks an ORI GI N dir ect ive w hich m ight help
clar ify under st anding.
The localhost .r ev file m aps t he I P addr ess 127.0.0.1 t o t he nam e localhost .
TTL 86400 ;
; could use ORIGIN 0.0.127.IN-ADDR.ARPA. IN SOA localhost. root.localhost.
1997022700 ; Serial 3h ; Refresh
15 ; Retry 1w ; Expire
3h ; Minimum IN NS localhost.
1 IN PTR localhost.
1 9 2 .1 6 8 .0 .r e v
This file 192.168.0.r ev is t he sam ple r ev er se m ap zone file used t hr oughout t his Chapt er and has t he follow ing char act er ist ics.
1. Tw o nam e ser v er s ar e used one int er nal
ns1 and one ext er nal ns2 t o t he dom ain 2.
The m ail ser vice is ext er nal t o t he dom ain pr ovided by a t hir d par t y
3. FTP and WWW ser vices ar e pr ovided by t he
sam e h ost 4.
Ther e ar e t w o host s nam ed bill and fr ed
Step by Step
TM
Linux Guide.
Page 271
5. The host addr esses ar e all in t he class C
pr ivat e addr ess r ange 1 92.168.0.0 a slight ly ar t ificial case
The Re sou r ce Re cor d s ar e all defined separ at ely.
TTL 86400 ; 24 hours could have been written as 24h
ORIGIN 0.168.192.IN-ADDR.ARPA. 1D IN SOA ns1.mydomain.com.
mymail.mydomain.com. 2002022401 ; serial
3H ; refresh 15 ; retry
1w ; expire 3h ; minimum
; server host definitions 1 IN PTR ns1.mydomain.com.
2 IN PTR www.mydomain.com. ; non server domain hosts
3 IN PTR bill.mydomain.com. 4 IN PTR fred.mydomain.com.
Host s defined w it h CN AM E Re sou r ce Re cor ds do not have PTR r ecor ds associat ed.
6.3 Slave Secondary DNS Server