8/13/2019 Basic DNS Step by Step Guide in Linux
1/9
Submitter: Matthew Carpenter
Color Conventions in this document:Configuration Files in this document have been color-coded to better ease inreading.
Red Items you must change
Blue Various Filenames and Paths
Dark Green Comments and Record Description
Dark Purple Optional Records
How this document is organized:
BS!C "#S $H%&'()%$$!#) "#S $& *&'+ ,)eneralCCH!#) ( CF!)/'$! ,and appropriate filesS$#"'" CF!)/'$! ,and appropriate filesF!%S C&MM $& CF!)/'$!S
"Above all else, know thyself"
0%'( BS!C ,and loosel1 correct $H%&'(
!f 1ou don2t understand "#S !2ll cover it 0%'( briefl1. !f 1ou need moreinformation3 see the man pages for namedand the DNS-HowTo.
"#S is a 4.566 compliant3 hierarchical distributed data s1stem. $hat means theinformation is spread all over the world with several 78nown7 points of origin8nown and a 7tree-li8e7 organization. $hese points of origins are 8nown as 'oot#ame Servers. %ver1 "#S client ,9ni3 *in;3 #$3 #etware3 etc.. is given one or
more 7local7 servers. ,for dialup !S
8/13/2019 Basic DNS Step by Step Guide in Linux
2/9
$here is much more to this3 such as caching3 local host files3 etc.. but this is thebasic information about "#S server protocol.
)%$$!#) "#S $& *&'+ ,)eneral
Directions:>%dit Configuration Files?Start ,or restart "#S
Commands:$o Start "#S,as root: ndc start,@usr@sbin@ndc is the filename$o 'estart "#S: ndc restart$o Stop "#S: ndc stop
CCH!#)-( CF!)/'$!
7caching onl17 "#S server is one which is configured without an1 domains forwhich to be responsible for.
Configuration Files for DNS proper
/etc/named.conf this defines a directory to store the DN confi! files
"DNROO#$/root.hints Contains %pointers% to the Root er&ers''
"DNROO#$/()*.+.+ Contains confi! for the local host/su,net''
''note- the files in "DNROO#$ may ,e named somethin!else. #his is defined in /etc/named.conf
Configuration Files for the Local Host Name Resolution (important for testing)
/etc/resol&.conf Only to make this computer use itself for DN
/etc/nssitch Only to make this computer check /etc/hosts and DN'
/etc/host.conf Only to make this computer check /etc/hosts and DN'
'note- hich of these to is important depends on your li,c
&ersion usually chan!e ,oth
8/13/2019 Basic DNS Step by Step Guide in Linux
3/9
CONFIGURING DNS:
$he following section shows wor8ing configuration files complete with comments
/etc/named.conf,Caching &nl1 Configuration----------------------------------------------$his file must be named named.conf and be in @etcA!t is used b1 the 7named7 daemon to determine the basic configuration and what files contain the details
options { #Global DNS settings
directory "/var/named"; #tells DNS to use the listed directory
for other config files
#forward first;#chec the "forwarders" before doing any
resolution#forwarders {# list of domain servers the chec !"local" DNS
#$%&$%''%(;#internal DNS server for company
#);
);
*one "%" { #Settings for the +,,- .,N
type hint; #Specifies this as the +,,- .,N type
file "root%hints"; #0ile that containing lins to the +,,-
S+1+S!/var/named/root.hints
);
*one "$%$%'(%in2addr%arpa" { #3sed for reverse looup !ie 45 6ddress
to Name
#notice it is your networ address bacwards7"in2addr%arpa"
#So this is for '(%$%$ networ
type master; #Specifies this as a 86S-+ .,N
file "p*/'(%$%$"; #0ile that contains the details for this
*one!/var/named/pz/127.0.0
);----------------------------------------------
#otice the structure for each section of the file. *hen troubleshooting 8eep this inmind:
8/13/2019 Basic DNS Step by Step Guide in Linux
4/9
sectiontype {
optiontype setting;
optiontype setting;
optiontype setting;
/etc/reso!".conf#Cachin$ On!% Confi$&ration'----------------------------------------------Achange the domain info to fit 1ours. "on2t change the nameserver entr1
search subdomain%e2i2s%cc e2i2s%cc;where subdomain%e2i2s%cc is the
subdomain the DNS server is in
;and e2i2s%cc is your domain
nameserver '(%$%$%----------------------------------------------
#&$%: (ou must also see the configuration files common to all configurationshere
CH(NGING TH) CONFIGUR(TION
s the Caching &nl1 "#S simpl1 retrieves and stores the !< information as newhost resolutions are re=uested3 there is not a whole lot of configuration changeinvolved. !t Dust wor8s. ,nd hopefull1 !2ve done a good enough Dob showing 1ouso that it "&%S $here is one thing 1ou can change3 and that is to ma8e theserver chec8 with one or more "#S servers before going to the '&&$S%'0%'S. $hese are 8nown as Forwarders. (ou can configure forwarding b1uncommenting ,removing the 7A7 from the beginning of the purple lines in@[email protected].
S$#"'" CF!)/'$!
7standard configuration7 "#S server is one which is configured to beresponsible to resolve names to !< ddresses ,and vice versa for a domain.
Configuration Files for DNS proper
/etc/named.conf this defines a directory to store the DN confi! files
"DNROO#$/root.hints Contains %pointers% to the Root er&ers''
"DNROO#$/()*.+.+ Confi! for re&erse0lookup to the local host/su,net''
"DNROO#$/"domain$ Confi! for domain''
"DNROO#$/"in0
addr.arpa file$
Confi! for re&erse lookup for your domain
http://linux-sxs.org/internet_serving/dns.html#common%23commonhttp://linux-sxs.org/internet_serving/dns.html#common%23common8/13/2019 Basic DNS Step by Step Guide in Linux
5/9
''note- the files in "DNROO#$ may ,e named somethin!else. #his is defined in /etc/named.conf
Configuration Files for the Local Host Name Resolution (important for testing)
/etc/resol&.conf Only to make this computer use itself for DN
/etc/nssitch Only to make this computer check /etc/hosts and DN'
/etc/host.conf Only to make this computer check /etc/hosts and DN'
'note- hich of these to is important depends on your li,c
&ersion usually chan!e ,oth
CONFIGURING DNS:
$he following section shows wor8ing configuration files complete with comments
/etc/named.conf#Standard Confi$&ration'----------------------------------------------$his file must be named named.conf and be in @etc
A!t is used b1 the 7named7 daemon to determine the basic configuration and what files contain the details
options { #Global DNS settings
directory "/var/named"; #tells named where to find the rest of
the config files
#forward first;#chec the "forwarders" before doing any
resolution
#forwarders {# list of domain servers the chec !"local" DNS
#$%&$%''%(;#internal DNS server for company
#);
);
*one "%" { #Settings for the +,,- .,N
type hint; #Specifies this as the +,,- .,N type
file "root%hints"; #0ile that containing lins to the +,,-
S+1+S!/var/named/root.hints
8/13/2019 Basic DNS Step by Step Guide in Linux
6/9
);
*one "$%$%'(%in2addr%arpa" { #3sed for reverse looup !ie 45 6ddress
to Name
#notice it is your networ address bacwards7"in2addr%arpa"
#So this is for '(%$%$ networ
type master; #Specifies this as a 86S-+ .,N
file "p*/'(%$%$"; #0ile that contains the details for this
*one!/var/named/pz/127.0.0
);
*one "e2i2s%cc" { #9our *one name !domain name
notify no; # notify is used with master/slave DNS servers% Not
necessary for one DNS svr%
type master; # Specify this as a 86S-+ .,N
file "p*/e2i2s%cc"; #0ile that contains details for this *one
!/var/named/pz/e-i-s.cc
);
*one "$%::%$%in2addr%arpa" { #6gain2+everse ooup
type master; #6gain286S-+ .,N
file "p*/$%::%$"; #6gain2Details file%
!/var/named/pz/10.133.10
);----------------------------------------------
#otice the structure for each section of the file. *hen troubleshooting 8eep this inmind:
sectiontype {
optiontype setting;
optiontype setting;
optiontype setting;
);
#otice the use of a trailing 7.7 on hostnames. !n zone files3 the use of a trailing 7.7
is to signif1 that the address is the distinguished name. #ames without thetrailing7.7 are assumed to be relative names and will have the zone name addedto the end3 thus names in reverse-loo8up zones use the trailing 7. 7 ,! wouldH$% to have a machine named 7carp1.e-i-s.cc.6.6.>?E.in-addr.arpa7 (c8
/etc/reso!".conf#Standard Confi$&ration'----------------------------------------------Achange the domain info to fit 1ours. "on2t change the nameserver entr1
domain e2i2s%cc
8/13/2019 Basic DNS Step by Step Guide in Linux
7/9
search subdomain%e2i2s%cc e2i2s%cc
;where subdomain%e2i2s%cc is the subdomain the DNS server is in
;and e2i2s%cc is your domain
nameserver $%::%$%:D 4N NS G%+,,-2S+1+S%N-
% >D 4N NS ?%+,,-2S+1+S%N-
% >D 4N NS @%+,,-2S+1+S%N-% >D 4N NS %+,,-2S+1+S%N-
% >D 4N NS 8%+,,-2S+1+S%N-
% >D 4N NS 6%+,,-2S+1+S%N-
% >D 4N NS A%+,,-2S+1+S%N-
% >D 4N NS B%+,,-2S+1+S%N-
% >D 4N NS C%+,,-2S+1+S%N-
% >D 4N NS D%+,,-2S+1+S%N-
% >D 4N NS %+,,-2S+1+S%N-
http://linux-sxs.org/internet_serving/dns.html#common%23commonhttp://linux-sxs.org/internet_serving/dns.html#common%23common8/13/2019 Basic DNS Step by Step Guide in Linux
8/9
% >D 4N NS 4%+,,-2S+1+S%N-
% >D 4N NS 0%+,,-2S+1+S%N-
G%+,,-2S+1+S%N-% &w>d>h 4N 6 '%'%:>%E
?%+,,-2S+1+S%N-% &w>d>h 4N 6 d>h 4N 6 :%$%E%'
%+,,-2S+1+S%N-% &w>d>h 4N 6 d>h 4N 6 '$'%'%'(%::
6%+,,-2S+1+S%N-% &w>d>h 4N 6 d>h 4N 6 ':%'%&:
B%+,,-2S+1+S%N-% &w>d>h 4N 6 'd>h 4N 6 '%::%E%'
D%+,,-2S+1+S%N-% &w>d>h 4N 6 'h 4N 6 '%'$:%':$%$
4%+,,-2S+1+S%N-% &w>d>h 4N 6 '%:>%Ed>h 4N 6 '%&%&%'E----------------------------------------------
#otice that each line in the first section begins with a 7.7 $he rest ! have #& !"%about.
/"ar/named/,/0.1.1,Common2 ----------------------------------------------
;Defines the local *one%Change the various names to suit your networ
F 4N S,6 carpy%e2i2s%cc% netdude%e2i2s%cc% !
;Serial
8/13/2019 Basic DNS Step by Step Guide in Linux
9/9
earch
http://linux-sxs.org/site_search.htmlhttp://linux-sxs.org/parent.htmlhttp://linux-sxs.org/site_search.html