Configuring DNS in Linux Server
Configuring DNS in Linux Server
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
Contents
1 ntro!uction " ntro!uction to DNS "#1 DNS Dom$ins "#" % ND "#& DNS C'ients "#( )uthorit$ti*e DNS Ser*ers "#+ How DNS Ser*ers Fin! Out ,our Site nform$tion "#- When To .se ) DNS C$ching N$me Ser*er "#/ When To .se ) St$tic DNS Ser*er "#8 When To .se ) D0n$mic DNS Ser*er "#1 How To 2et ,our Own Dom$in "#13 %$sic DNS Testing of DNS 4eso'ution "#13#1 The Host Comm$n! "#13#" The ns'ooku5 Comm$n! "#11 Down'o$!ing $n! nst$''ing the % ND 6$ck$ges "#1" 7$n$ging the % ND Ser*er "#1& The 8etc8reso'*#conf Fi'e "#1 T$9'e 18#1 :e0wor!s n 8etc8reso'*#conf & m5ort$nt Fi'e Loc$tions  4e!H$t 8 Fe!or$ &#" T$9'e 18#" Differences n Fe!or$ )n! 4e!h$t DNS Fi'e Loc$tions &#& De9i$n 8 .9untu ( Configuring ,our N$meser*er (#1 Configuring reso'*#conf (#" Cre$ting $ n$me!#conf %$se Configur$tion (#"#1 T$9'e 18#& The 6rim$r0 % ND Configur$tion Fi'es (#& Configuring % ND ;iews in n$me!#conf (# Forw$r! <one Fi'e 4eferences in n$me!#conf (#&#" 4e*erse <one Fi'e 4eferences in n$me!#conf (#&#& The C$ching N$meser*er 'oc$'host=reso'*er ;iew (#&#( The ntern$' ;iew (#&#+ The >xtern$' ;iew (#( Configuring The <one Fi'es (#(#1 Time to Li*e ;$'ue (#(#" DNS 4esource 4ecor!s (#(#& The SO) 4ecor! (#(#( T$9'e 18#( The SO) 4ecor! Form$t (#(#+ NS? 7@? ) )n! CN)7> 4ecor!s (#(#- T$9'e 18#+ NS? 7@? )? 6T4 $n! CN)7> 4ecor! Form$ts (#(#/ T@T 4ecor!s (#+ S$m5'e Forw$r! <one Fi'e (#- S$m5'e 4e*erse <one Fi'e
Other Linux Home Networking To5ics ntro!uction to Networking Linux Networking Sim5'e Network Trou9'eshooting Trou9'eshooting Linux with S0s'og nst$''ing Linux Softw$re The Linux %oot 6rocess Configuring the DHC6 Ser*er Linux .sers $n! su!o Win!ows? Linux $n! S$m9$ Sh$ring 4esources with S$m9$ S$m9$ Securit0 $n! Trou9'eshooting Linux Wire'ess Networking
1 of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
(#/ Lo$!ing ,our New Configur$tion Fi'es (#8 7$ke Sure ,our 8etc8hosts Fi'e s Correct'0 .5!$te! (#1 Configure ,our Firew$'' (#13 Fix ,our Dom$in 4egistr$tion + Trou9'eshooting % ND +#1 Configur$tion Trou9'eshooting Ste5s +#" Network Trou9'eshooting Ste5s - 7igr$ting ,our We9 Site nAHouse / DHC6 Consi!er$tions For DNS 8 Sim5'e DNS Securit0 8#1 <one Tr$nsfer 6rotection 8#" Se'ecti*e'0 Dis$9'ing 4ecursion 8#& N$ming Con*ention Securit0 1 Conc'usion
Linux Firew$''s .sing i5t$9'es Linux FT6 Ser*er Setu5 Te'net? TFT6 $n! xinet! Secure 4emote Logins $n! Fi'e Co50ing Configuring DNS D0n$mic DNS The )5$che We9 Ser*er Configuring Linux 7$i' Ser*ers 7onitoring Ser*er 6erform$nce )!*$nce! 74T2 For Linux The NT6 Ser*er NetworkA%$se! Linux nst$''$tion Linux Softw$re 4) D >x5$n!ing Disk C$5$cit0 7$n$ging Disk .s$ge with Quot$s 4emote Disk )ccess with NFS Configuring N S Centr$'iIe! Logins .sing LD)6 $n! 4)D .S Contro''ing We9 )ccess with SFui! 7o!if0ing the :erne' to m5ro*e 6erform$nce %$sic 70SQL Configur$tion
ntro!uction
Dom$in N$me S0stem BDNSC con*erts the n$me of $ We9 site Bwww#'inuxhomenetworking#comC to $n 6 $!!ress B-+#11+#/1#&(C# This ste5 is im5ort$nt? 9ec$use the 6 $!!ress of $ We9 siteDs ser*er? not the We9 siteDs n$me? is use! in routing tr$ffic o*er the nternet# This ch$5ter wi'' ex5'$in how to configure 0our own DNS ser*er to he'5 gui!e We9 surfers to 0our site#
LHN Linux Forums A L$test Thre$!s Linux B7intC c$nDt $ccess Fe!or$ Ser*er BLinux A H$r!w$re? Networking J Securit0C h$*e $ fresh Linux7int B.9untu *$ri$ntC inst$'' on m0 '$5to5? $n! nee! to $ccess the music fi'es on m0 ;ortex9ox $55'i$nce running Fe!or$# c$n### 6ro9'em with Cisco >HW CA(>S2 B2ener$' Ch$tC Kust won!ering if the >HW CA(>S2 B.4L 9e use! in $ Cisco 833 router# w$nt to $!! $t 'e$st one### .9untu 1"#3( LTS Setting .5 Network 9etween @58/ $n! .9untu 1"#3(LTS BLinux A H$r!w$re? Networking J Securit0C i $m $ )9so'ute New9ie $t Linux i wou'! 'ike to h$*e it where the win!ows com5uters see $n! tr$nsfer fi'es with the 'inux 9ox $n! see $n! tr$nsfer### Cisco C$t$'0st "1-3@ >thernet Switch B2ener$' Ch$tC L w$nt to 9u0 C$t$'0st "1-3A@ series switches 'ike WSAC"1-3@A "(6SAL?WSAC"1-3@A"(6DAL? 9u0 Dm not *er0 we'' know $9out c"1-3x series# C$n someone### Linux *5n c'ient BLinux A Softw$re? )55'ic$tions J 6rogr$mmingC Our com5$n0 h$s one *5n ser*er?it is C SCO"1318:1 router# We c$n conntect it with cisco *5n too's in win!ows m$chine#%ut $9out 'inux c'ient? we h$*e### Norih$n T$'i9 HereM B2ener$' Ch$tC He''o >*er0one m0 n$me is Norih$n T$'i9 i Eoine! this forum to m$ke new connections on frien!s see 0ou $'' on the 9o$r!s 6eni5u Dr# O9$i! %usit Leg$' Consu't$ntsM new mem9er 5ost## B2ener$' Ch$tC He''o to $'' forum mem9ers#### $m Dr# O9$i! %usit new mem9er hereM Ho5e e*er0one is fine $n! enEo0 9eing hereM 4eg$r!s Dr# O9$i! %usit h$ni !$'F$mouni hereM B2ener$' Ch$tC he''o e*er09o!0M i $m h$ni !$'F$mouni### i $m new to this forum $nn! i $m h$550 to Eoin here to meet new frien!s $n! to s$hre interests with 0ou### %est w$0 to know Cisco C$t$'0st "(A6ort Network Switch WSAC"1-3A"(TCAL BLinux A H$r!w$re? Networking J Securit0C Cisco "1-3AS switches $re the 'e$!ing fixe!A
ntro!uction to DNS
%efore 0ou !ig too !ee5 in DNS? 0ou nee! to un!erst$n! $ few foun!$tion conce5ts on which the rest of the ch$5ter wi'' 9e 9ui't#
DNS Dom$ins
>*er0one in the wor'! h$s $ first n$me $n! $ '$st? or f$mi'0? n$me# The s$me thing is true in the DNS wor'!: ) f$mi'0 of We9 sites c$n 9e 'oose'0 !escri9e! $ !om$in# For ex$m5'e? the !om$in 'inuxhomenetworking#com h$s $ num9er of chi'!ren? such $s www#'inuxhomenetworking#com $n! m$i'#'inuxhomenetworking#com for the We9 $n! m$i' ser*ers? res5ecti*e'0#
% ND
% ND is $n $cron0m for the %erke'e0 nternet N$me Dom$in 5roEect? which is $ grou5 th$t m$int$ins the DNSAre'$te! softw$re suite th$t runs un!er Linux# The most we'' known 5rogr$m in % ND is n$me!? the !$emon th$t res5on!s to DNS Fueries from remote m$chines#
DNS C'ients
) DNS c'ient !oesnDt store DNS inform$tionG it must $'w$0s refer to $ DNS ser*er to get it# The on'0 DNS configur$tion fi'e for $ DNS c'ient is the 8etc8reso'*#conf fi'e? which !efines the 6 $!!ress of the DNS ser*er it shou'! use# ,ou shou'!nDt nee! to configure $n0 other fi'es# ,ouD'' 9ecome we'' $cFu$inte! with the 8etc8reso'*#conf fi'e soon#
" of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
f 0ou w$nt to $!*ertise 0our We9 site www#m0Asite#com to the rest of the wor'!? then $ regu'$r DNS ser*er is wh$t 0ou reFuire# Setting u5 $ c$ching DNS ser*er is f$ir'0 str$ightforw$r! $n! works whether or not 0our S6 5ro*i!es 0ou with $ st$tic or !0n$mic nternet 6 $!!ress# )fter 0ou set u5 0our c$ching DNS ser*er? 0ou must configure e$ch of 0our home network 6Cs to use it $s their DNS ser*er# f 0our home 6Cs get their 6 $!!resses using DHC6? then 0ou h$*e to configure 0our DHC6 ser*er to m$ke it $w$re of the 6 $!!ress of 0our new DNS ser*er? so th$t the DHC6 ser*er c$n $!*ertise the DNS ser*er to its 6C c'ients# OffAtheAshe'f router8firew$'' $55'i$nces use! in most home networks usu$''0 c$n $ct $s 9oth the c$ching DNS $n! DHC6 ser*er? ren!ering $ se5$r$te DNS ser*er is unnecess$r0# ,ou c$n fin! the configur$tion ste5s for $ Linux DHC6 ser*er in Ch$5ter 8? LConfiguring the DHC6 Ser*erL#
configur$tion L$0er " e!ge $ccess switches $n! "1-3AS most 5orts $re 2>#The C$t$'0st "1-3AS Series### he''o##4o9ert Di!i$n$ here## B2ener$' Ch$tC i$m g'$! to 9e $ 5$rt of this forum it seems 'ike $ 5rett0 coo' communit0 th$t is r$n here $n! c$n te'' thereDs goo! $!ministr$tion Eust 90### K$ck 4$f$e' 2oro!eIk0 7irsk0 new9ie hereM B2ener$' Ch$tC 70 n$me is K$ck 4$f$e' 2oro!eIk0 $s 0ou c$n see i $m $ new mem9er of the forum# $m intereste! to meet new 'ike min!e! 5eo5'e :in! reg$r!s?###
)s 0ou c$n see? the forw$r! $n! re*erse entries !onDt m$tch# The re*erse entr0 m$tches the entr0 of the S6#
& of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
The first !om$in 'iste! $fter the se$rch !irecti*e must 9e the home !om$in of 0our network? in this c$se m0Asite#com# 6'$cing $ !om$in $n! se$rch entr0 in the 8etc8reso'*#conf is re!un!$nt? therefore#
( of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
4e!H$t 8 Fe!or$
4e!H$t 8 Fe!or$ % ND norm$''0 runs $s the n$me! 5rocess owne! 90 the un5ri*i'ege! n$me! user# Sometimes % ND is $'so inst$''e! using LinuxDs chroot fe$ture to not on'0 run n$me! $s user n$me!? 9ut $'so to 'imit the fi'es n$me! c$n see# When inst$''e!? n$me! is foo'e! into thinking th$t the !irector0 /var/named/chroot is $ctu$''0 the root or / !irector0# Therefore? n$me! fi'es norm$''0 foun! in the /etc !irector0 $re foun! in /var/named/chroot/etc !irector0 inste$!? $n! those 0ouD! ex5ect to fin! in 8*$r8n$me! $re $ctu$''0 'oc$te! in /var/named/chroot/var/named# The $!*$nt$ge of the chroot fe$ture is th$t if $ h$cker enters 0our s0stem *i$ $ % ND ex5'oit? the h$ckerDs $ccess to the rest of 0our s0stem is iso'$te! to the fi'es un!er the chroot !irector0 $n! nothing e'se# This t05e of securit0 is $'so known $s $ chroot E$i'# ,ou c$n !etermine whether 0ou h$*e the chroot $!!Aon 467 90 using this comm$n!? which returns the n$me of the 467#
[root@bigboy tmp]# rpm -q bind-chroot bind-chroot-9.2.3-13 [root@bigboy tmp]#
There c$n 9e confusion with the 'oc$tions: 4egu'$r % ND inst$''s its fi'es in the norm$' 'oc$tions? $n! the chroot % ND $!!Aon 467 inst$''s its own *ersions in their chroot 'oc$tions# .nfortun$te'0? the chroot *ersions of some of the fi'es $re em5t0# %efore st$rting Fe!or$ % ND? co50 the configur$tion fi'es to their chroot 'oc$tions:
[root@bigboy tmp]# cp -f /etc/named.conf /var/named/chroot/etc/ [root@bigboy tmp]# cp -f /etc/rndc.* /var/named/chroot/etc/
%efore 0ou go to the next ste5 of configuring $ regu'$r n$me ser*er? it is im5ort$nt to un!erst$n! ex$ct'0 where the fi'es $re 'oc$te!# T$9'e 18#" 5ro*i!es $ m$5#
n$me!#conf Te''s the n$mes of the Ione fi'es to 9e use! for e$ch of 0our we9site !om$ins# rn!c#ke0 rn!c#conf Ione fi'es Links $'' the 6 $!!resses in 0our !om$in to their corres5on!ing ser*er Fi'es use! in n$me! $uthentic$tion
8*$r8n$me!8chroot8etc
8etc
8*$r8n$me!8chroot 8*$r8n$me!
8*$r8n$me!
Note: Fe!or$ Core inst$''s % ND chroot 90 !ef$u't# 4e!H$t 1 $n! e$r'ier !onDt#
De9i$n 8 .9untu
With De9i$n 8 .9untu? $'' the configur$tion fi'es? the 5rim$r0 named.conf fi'e $n! $'' the DNS Ione fi'es resi!e in the /etc/bind !irector0# .n'ike in 4e!h$t 8 Fe!or$? references to other fi'es within these configur$tion fi'es shou'! inc'u!e the fu'' 5$th# The n$me! !$emon wonDt $utom$tic$''0 $ssume the0 $re 'oc$te! in the /etc/bind !irector0#
Configuring reso'*#conf
,ouD'' h$*e to m$ke 0our DNS ser*er refer to itse'f for $'' DNS Fueries 90 configuring the 8etc8reso'*#conf fi'e to reference 'oc$'host on'0#
nameserver 127.0.0.1
+ of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
8etc8n$me!#rfc111"#Iones %$se configur$tion fi'e for $ c$ching n$me ser*er# 8*$r8n$me!8n$me!#c$ ) 'ist of the 1& root $uthorit$ti*e DNS ser*ers#
The first t$sk is to m$ke sure 0our DNS ser*er wi'' 'istening of reFuests on $'' the reFuire! network interf$ces# The o5tions section of n$me!#conf m$0 9e configure! to 'isten exc'usi*e'0 on its intern$' hi!!en 'oc$'host interf$ce with $n 6 $!!ress of 1"/#3#3#1 $s we see in this ex$m5'e#
# File: /etc/named.conf options { listen-on port 53 { 127.0.0.1; }; };
f other !e*ices $re going to re'0 on 0our ser*er for Fueries? then 0ouH'' nee! to either ch$nge this or $!! $ se'ecte! num9er of 6 $!!resses on 0our ser*er# n this ex$m5'e? we $''ow Fueries on $n0 interf$ce#
listen-on port 53 { any; };
Note: )'w$0s m$ke sure 'oc$'host? 1"/#3#3#1 is inc'u!e!# Though it is not reFuire!? it is $ goo! 5r$ctice to configure 0our DNS ser*erDs n$me!#conf fi'e to su55ort % ND *iews# This wi'' 9e !iscusse! next#
- of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
'oc$'host: 'oc$'host 4efers to the DNS ser*er itse'f 'oc$'nets: 'oc$'nets 4efers to $'' the networks to which the DNS ser*er is !irect'0 connecte! $n0: $n0 which is se'f ex5'$n$tor0# LetDs ex$mine % ND *iews more c$refu''0 using $ num9er of s$m5'e configur$tion sni55ets from the 8etc8n$me!#conf fi'e use for m0 home network# )'' the st$tements 9e'ow were inserte! $fter the o5tions $n! contro's sections in the fi'e# h$*e se'ecte! generic n$mes intern$'? for *iews gi*en to truste! hosts Bhome? nonAinternet or cor5or$te usersC? $n! extern$' for the *iews gi*en to nternet c'ients? 9ut the0 c$n 9e n$me! wh$te*er 0ou wish# First 'etDs t$'k $9out how we shou'! refer to the Ione fi'es in e$ch *iew#
n $!!ition? 0ou c$n insert more entries in the n$me!#conf fi'e to reference other We9 !om$ins 0ou host# Here is $n ex$m5'e for $notherAsite#com using $ Ione fi'e n$me! $notherAsite#Ione#
zone another-site.com { type master; notify no; allow-query { any; }; file another-site.zone; };
Note: The $''owAFuer0 !irecti*e !efines the networks th$t $re $''owe! to Fuer0 0our DNS ser*er for inform$tion on $n0 Ione# For ex$m5'e? to 'imit Fueries to on'0 0our 11"#1-8#1#3 network? 0ou cou'! mo!if0 the !irecti*e to:
allow-query { 192.168.1.0/24; };
,our 5$tience wi'' soon 9e rew$r!e!# tDs time to t$'k $9out the *iewsM LetDs goM
/ of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
There $re some Fuick f$cts 0ou shou'! 9e $w$re of with 0our c$ching n$me ser*er configur$tion: 1# f 0ou w$nt 0our ser*er to 9e on'0 $ c$ching DNS ser*er? then !e'ete $'' other *iews in n$me!#conf $n! rest$rt the n$me! !$emon#
[root@bigboy tmp]# systemctl restart named.service
"# 7$ke $'' the other m$chines on 0our network 5oint to the c$ching DNS ser*er $s their 5rim$r0 DNS ser*er# &# 4emem9er th$t $'' DNS Fueries !one on 0our DNS ser*er $55e$r to come from 'oc$'host# f 0our ser*er is $'so $n $uthorit$ti*e ser*er for 0our !om$in? 0ou wi'' h$*e to inc'u!e $ reference to 0our !om$inDs Ione fi'es in this section for the ser*erDs own DNS 'ooku5s to work# f not? Fueries from c'ients !efine! 90 the intern$' $n! extern$' )CLs wi'' work correct'0? 9ut Fueries for the !om$in from the ser*er itse'f wi'' f$i'# n this ex$m5'e we h$*e inc'u!e! $ reference to the intern$'=Iones#conf Ione fi'e which weD'' *isit $g$in soon# This 'ine c$n 9e !e'ete! if 0our ser*er isnDt $n $uthorit$ti*e ser*er for 0our !om$in# Note: f 0ou h$*e $ 'oc$'host on'0 *iew 'ike this? m$ke sure 0ou !onDt reference 'oc$'host in $n0 of 0our other *iews $s one *iew wi'' t$ke 5rece!ence o*er the other for Fueries from 0our ser*er# This cou'! 'e$! to un5re!ict$9'e resu'ts#
The Fuestion 0ou m$0 h$*e on 0our min! is? LWhere $re the Ione fi'e !efinitionsPL# DonDt worr0? there is $n inc'u!e st$tement th$t refers to $ fi'e n$me! intern$'=Iones#conf th$t cont$ins them $'' $s we see here:
// File internal_zones.conf zone "1.168.192.in-addr.arpa" IN { type master; file "/var/named/zones/internal/192.168.1.zone"; allow-update { none; }; }; zone "my-web-site.org" IN { type master; file "/var/named/zones/internal/my-web-site.org.zone"; allow-update { none; }; };
D'' !iscuss how to h$n!'e Fueries from c'ients outsi!e 0our truste! networks in the next section where $n extern$' *iew c$n 9e use!#
8 of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
Notice th$t the re*erse Ione fi'e gi*es resu'ts for 5u9'ic internet $!!resses? $n! of course? the forw$r! Ione fi'e shou'! on'0 5ro*i!e res5onses with nternet $ccessi9'e $!!resses# Note: n the extern$' *iew? 0ou m$0 9e tem5te! to use $n exc'$m$tion m$rk BMC to e'imin$te networks use! in the intern$' *iew 'ike this# %e c$refu'? it is 9est to use L$n0GL for 0our extern$' *iew $s the exc'$m$tion m$rk BMC is not honore! with some *ersions of % ND in *iews n$me! Lextern$'L#
; !!! CAUTION !!! match-clients { !localnets; !localhost; !safe-subnet; }; match-destinations { !localnets; !localhost; !safe-subnet; };
The *iews 'iste! here $re 5ure'0 to i''ustr$te their use# The s$m5'e home network we h$*e 9een using !oesnHt nee! to h$*e the )CL st$tement $t $'' $s the 9ui't in )CLs 'oc$'nets $n! 'oc$'host $re sufficient# The s$m5'e network wonHt nee! the s$feAsu9net section in the m$tchAc'ients 'ine either $s there is on'0 one su9net in the configur$tion# ;iews $re $'so not Eust for N)T# f 0ou run $n nternet !$t$ center? 0ou c$n set u5 0our DNS ser*er to $ct $s $ c$ching ser*er to ser*ers on $'' the nternet networks 0ou own $n! no one e'se? $n! then 5ro*i!e $uthorit$ti*e res5onses to 0our customersD !om$ins to e*er0one# ;iews c$n 9e *er0 usefu'#
% ND recogniIes se*er$' suffixes for timeAre'$te! *$'ues# ) D signifies !$0s? $ W signifies weeks? $n! $n H signifies hours# n the $9sence of $ suffix? % ND $ssumes the *$'ue is in secon!s#
1 of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
There $re !ifferent t05es of recor!s for m$i' B7@C? forw$r! 'ooku5s B)C? re*erse 'ooku5s B6T4C? $'i$ses BCN)7>C $n! o*er$'' Ione !efinitions? St$rt of )uthorit0 BSO)C# The !$t$ 5ortion is form$tte! $ccor!ing to the recor! t05e $n! m$0 consist of se*er$' *$'ues se5$r$te! 90 s5$ces# Simi'$r'0? the n$me is $'so su9Eect to inter5ret$tion 9$se! on this f$ctor#
The recor! c$n 9e 'ong? $n! wi'' sometimes wr$5 $roun! on 0our screen# For the s$ke of form$tting? 0ou c$n insert new 'ine ch$r$cters 9etween the fie'!s $s 'ong $s 0ou insert 5$renthesis $t the 9eginning $n! en! of the insertion to $'ert % ND th$t 5$rt of the recor! wi'' str$!!'e mu'ti5'e 'ines# ,ou c$n $'so $!! comments to the en! of e$ch new 'ine se5$r$te! 90 $ semico'on when 0ou !o this# Here is $n ex$m5'e:
@ IN SOA ns1.my-site.com. 2004100801 ; 4H ; 1H ; 1W ; 1D ) ; hostmaster.my-site.com. ( serial # refresh retry expiry minimum
N$me Fie'!
T05e Fie'!
D$t$ Fie'!
13 of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
NS
.su$''0 9'$nk
NS
7@
Dom$in to 9e use! for m$i'# .su$''0 the s$me $s the !om$in of the Ione fi'e itse'f#
7@
) CN)7>
N N
) CN)7>
6T4
6T4
1# f the se$rch ke0 to $ DNS resource recor! is 9'$nk it reuses the se$rch ke0 from the 5re*ious recor! which in this c$se of is the SO) Q sign# "# For most home 8 SOHO scen$rios? the C'$ss fie'! wi'' $'w$0s 9e N or nternet# ,ou shou'! $'so 9e $w$re th$t N is the !ef$u't C'$ss? $n! % ND wi'' $ssume $ recor! is of this t05e un'ess otherwise st$te!# f 0ou !onDt 5ut $ 5erio! $t the en! of $ host n$me in $ SO)? NS? )? or CN)7> recor!? % ND wi'' $utom$tic$''0 t$ck on the Ione fi'eDs !om$in n$me to the n$me of the host# So? % ND $ssumes $n ) recor! with www refers to www#m0Asite#com# This m$0 9e $cce5t$9'e in most c$ses? 9ut if 0ou forget to 5ut the 5erio! $fter the !om$in in the 7@ recor! for m0Asite#com? % ND $tt$ches the m0Asite#com $t the en!? $n! 0ou wi'' fin! 0our m$i' ser*er $cce5ting m$i' on'0 for the !om$in m0Asite#com#m0site#com#
T@T 4ecor!s
There is $'so $ 'ess freFuent'0 use! DNS T@T recor! th$t c$n 9e configure! to cont$in $!!ition$' generic inform$tion# The !$t$ section of the recor! t05ic$''0 h$s the form$t Ln$meR*$'ueL? where Ln$meL is the n$me to 9e gi*en to the t05e of !$t$? $n! L*$'ueL is the *$'ue $ssigne! to the n$me $s seen in this ex$m5'e#
my-web-site.org. TXT "v=spf1 -all"
T@T recor!s $re incre$sing'0 9eing use! to he'5 fight S6)7 using the Sen!er 6o'ic0 Fr$mework BS6FC metho!# S6F T@T recor!s $re use! 90 s0stems recei*ing m$i' to interrog$te the DNS of the !om$in which $55e$rs in the em$i' Bthe sen!erC $n! !etermine if the origin$ting 6 $!!ress of the m$i' Bthe sourceC is $uthoriIe! to sen! m$i' for the sen!erDs !om$in# Further !escri5tion of the use of T@T recor!s is 9e0on! the sco5e of this 9ook? 9ut 0ou shou'! $t 'e$st 9e $w$re th$t the0 c$n 9e u5 to "++ ch$r$cters in 'ength $n! th$t this fe$ture is often ex5'oite! in !istri9ute! !eni$' of ser*ice BDDoSC $tt$cks# The section on LSim5'e DNS Securit0L ex5'$ins how to configure 0our DNS ser*er to not 5$rtici5$te in such $n e*ent#
hostmaster.my-site.com. ( serial# refresh, seconds retry, seconds expire, seconds minimum, seconds ; Inet Address of nameserver ; Primary Mail Exchanger
Notice th$t in this ex$m5'e: Ser*er ns1#m0Asite#com is the n$me ser*er for m0Asite#com# n cor5or$te en*ironments there m$0 9e $ se5$r$te n$me ser*er for this 5ur5ose# 6rim$r0 n$me ser*ers $re more common'0 c$''e! ns1 $n! secon!$r0 n$me ser*ers ns"# The minimum TTL *$'ue BSTTLC is three !$0s? therefore remote DNS c$ching ser*ers wi'' store 'e$rne! DNS inform$tion from 0our Ione for three !$0s 9efore f'ushing it out of their c$ches# The 7@ recor! for m0Asite#com 5oints to the ser*er n$me! m$i'#m0Asite#com $n! this ser*er h$s the 6 $!!ress 1/#1+8#"+&#"/# ns1 is $ctu$''0 $ CN)7> or $'i$s for the We9 ser*er www# So here 0ou h$*e $n ex$m5'e of the n$me ser*er? $n! We9 ser*er 9eing the s$me m$chine# f the0 were $'' !ifferent m$chines? then 0ouD! h$*e $n ) recor! entr0 for e$ch#
11 of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
www ns
A A
97.158.253.26 97.158.253.125
t is $ reFuire! 5r$ctice to increment 0our seri$' num9er whene*er 0ou e!it 0our Ione fi'e# When DNS is setu5 in $ re!un!$nt configur$tion? the s'$*e DNS ser*ers 5erio!ic$''0 5o'' the m$ster ser*er for u5!$te! Ione fi'e inform$tion? $n! use the seri$' num9er to !etermine whether the !$t$ on the m$ster h$s 9een u5!$te!# F$i'ing to increment the seri$' num9er? e*en though the contents of the Ione fi'e h$*e 9een mo!ifie!? cou'! c$use 0our s'$*es to h$*e out!$te! inform$tion# Note: The DNS s5ecific$tion B4FC "181C !oes not $''ow for $n 7@ recor! to 9e $ CN)7># t m$0 work in most c$ses? 9ut some m$i' ser*ers m$0 refuse to sen! to 0ou 9ec$use of this#
hostmaster.my-site.com. ( ; serial number ; refresh, seconds ; retry, seconds ; expire, seconds ; minimum, seconds ; Nameserver Address
NS 100 103 102 105 32 33 34 35 36 PTR PTR PTR PTR PTR PTR PTR PTR PTR
inc'u!e! entries for $!!resses 11"#1-8#1#&" to 11"#1-8#1#&-? which $re the $!!resses the DHC6 ser*er issues# S7T6 m$i' re'$0 wou'!nDt work for 6Cs th$t get their 6 $!!resses *i$ DHC6 if these 'ines werenDt inc'u!e!# ,ou m$0 $'so w$nt to cre$te $ re*erse Ione fi'e for the 5u9'ic N)T 6 $!!resses for 0our home network# .nfortun$te'0? S6s wonDt usu$''0 !e'eg$te this $9i'it0 for $n0one with 'ess th$n $ C'$ss C 9'ock of "+- 6 $!!resses# 7ost home DSL sites wou'!nDt Fu$'if0#
T$ke $ 'ook $t the en! of 0our 8*$r8'og8mess$ges fi'e to m$ke sure there $re no errors#
1" of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
Once 0ouD*e 'ogge! in with the registr$rDs usern$me $n! 5$sswor!? 0ouD'' h$*e t$ke two ste5s: 1C Cre$te $ new n$me ser*er recor! entr0 for the 6 $!!ress 1/#1+8#"+&#"- to m$5 to ns#m0Asite#com or www#m0A site#com or wh$te*er 0our n$me ser*er is c$''e!# BThis screen 5rom5ts 0ou for 9oth the ser*erDs 6 $!!ress $n! n$me#C "C )ssign ns#m0Asite#com to h$n!'e 0our !om$in# This screen wi'' 5rom5t 0ou for the ser*er n$me on'0# Sometimes? the registr$r reFuires $t 'e$st two registere! n$me ser*ers 5er !om$in# f 0ou on'0 h$*e one? then 0ou cou'! either cre$te $ secon! n$me ser*er recor! entr0 with the s$me 6 $!!ress? 9ut !ifferent n$me? or 0ou cou'! gi*e 0our We9 ser*er $ secon! 6 $!!ress using $n 6 $'i$s? cre$te $ secon! N)T entr0 on 0our firew$'' $n! then cre$te the secon! n$me ser*er recor! entr0 with the new 6 $!!ress? $n! !ifferent n$me# t norm$''0 t$kes $9out three to four !$0s for 0our u5!$te! DNS inform$tion to 9e 5ro5$g$te! to $'' 1& of the wor'!Ds root n$me ser*ers# ,ouD'' therefore h$*e to w$it $9out this $mount of time 9efore st$rting to notice 5eo5'e hitting 0our new We9 site# ,ou c$n use the ch$5terDs trou9'eshooting section to test s5ecific DNS ser*ers for the inform$tion the0 h$*e on 0our site# ,ouD'' most 'ike'0 w$nt to test 0our new DNS ser*er? which shou'! 9e u5 to !$te? 5'us $ few we'' known ones? which shou'! h$*e !e'$0e! *$'ues#
Trou9'eshooting % ND
% ND trou9'eshooting is usu$''0 e$s0 to !o# The n$me! !$emon u5!$tes the 8*$r8'og8mess$ges fi'e with !et$i'e! st$tus mess$ges th$t $re freFuent'0 e$s0 to inter5ret when 0ou sus5ect $ configur$tion error# The usu$' trou9'eshooting ste5s for network 5ro9'ems $re $'so $55'ic$9'e# %oth metho!o'ogies wi'' 9e co*ere! next#
The n$me!#conf fi'e refers to $n un!efine! secret ke0 in the !!ns=ke0 of n$me!#conf# .se the !nsAke0gen or !nske0gen comm$n!s to cre$te $ correct entr0#
Feb 25 20:38:49 bigboy named[4593]: /etc/named.conf:99: configuring key 'ddns_key': bad base64 encoding Feb 25 20:38:49 bigboy named[4593]: loading configuration: bad base64 encoding
The n$me!#root#hints fi'e referre! to in n$me!#conf isnDt 5resent in the 8etc or the chroot 8etc !irector0#
[root@bigboy tmp]# systemctl start named.service Starting named: Error in named configuration: /etc/named.conf:58: open: /etc/named.root.hints: file not found [FAILED] [root@bigboy tmp]#
,ou $re using $ chroot *ersion of % ND with $ s$m5'e rn!c#ke0 fi'e 'oc$te! in the 8etc !irector0 inste$! of the 8*$r8n$me!8chroot8etc8 !irector0# Co50 the fi'e to the correct 'oc$tion $n! rest$rt n$me! to fix the 5ro9'em#
1& of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
[root@bigboy tmp]# systemctl restart named.service Stopping named: rndc: connect failed: connection refused [ OK ] Starting named: [ OK ] [root@bigboy tmp]#
n 0our n$me!#conf fi'e 0ou refer to $ Ione fi'e th$t !oesnDt exist# This ex$m5'e inc'u!es 9oth errors to the conso'e screen $n! errors in the 8*$r8'og8mess$ges fi'e#
[root@bigboy tmp]# systemctl start named.service Starting named: Error in named configuration: zone localdomain/IN: loaded serial 42 zone localhost/IN: loaded serial 42 zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700 zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700 zone 255.in-addr.arpa/IN: loaded serial 42 zone 0.in-addr.arpa/IN: loaded serial 42 zone 2.168.192.in-addr.arpa/IN: loaded serial 2006052301 zone my-web-site.org/IN: loaded serial 2006052302 zone my-web-site.com/IN: loading master file /var/named/zones/internal/my-web-site.com.zone: file not found internal/my-web-site.com/IN: file not found zone 1.168.192.in-addr.arpa/IN: loaded serial 2006052301 zone my-web-site.org/IN: loaded serial 2006052302 [FAILED] [root@bigboy tmp]# Feb 26 01:47:10 smallfry named: zone my-web-site.com/IN: loading master file /var/named/zones/internal/my-web-site.com.zone: file not found Feb 26 01:47:10 smallfry named: internal/my-web-site.com/IN: file not found
This is $ trick0 one th$t wou'! occur in some e$r'0 *ersions of Fe!or$# % ND wou'! $55e$r to st$rt correct'0? 9ut none of the Ione fi'es wou'! 9e 'o$!e!# n this scen$rio cou'! 9e using $ chroot *ersion of % ND with $ s$m5'e n$me!#conf fi'e 'oc$te! in the 8etc !irector0 inste$! of the 8*$r8n$me!8chroot8etc8 !irector0# Co50 the fi'e to the correct 'oc$tion $n! rest$rt n$me! to fix the 5ro9'em# De'ete the 8etc $n! cre$te $ s0m9o'ic 'ink to 8*$r8n$me!8chroot8etc8n$me!#conf from 8etc to ensure 0ou $'w$0s e!it the correct fi'e#
Nov Nov Nov Nov Nov Nov Nov Nov 9 9 9 9 9 9 9 9 17:35:41 17:35:41 17:35:41 17:35:41 17:35:41 17:35:41 17:35:41 17:35:41 bigboy bigboy bigboy bigboy bigboy bigboy bigboy bigboy named[1157]: named[1157]: named[1157]: named[1157]: named[1157]: named[1157]: named[1157]: named[1157]: starting BIND 9.2.3 -u named -t /var/named/chroot using 1 CPU loading configuration from /etc/named.conf listening on IPv4 interface lo, 127.0.0.1#53 listening on IPv4 interface eth0, 10.41.32.71#53 command channel listening on 127.0.0.1#953 command channel listening on ::1#953 running
f there $re no n$me! errors to the screen or 8*$r8'og8mess$ges? $n! 0our !om$in !oesnDt reso'*e correct'0 when Fuerie! using the host comm$n! when 0ou $re 'ogge! into 0our new n$meser*er? then the 5ro9'em cou'! 9e !ue to 0ou forgetting to $!! $ Ione fi'e entr0 for the !om$in in n$me!#confG there cou'! 9e $ t05ogr$5hic$' error in 0our Ione fi'eG or 0ou cou'! h$*e forgotten to u5!$te 0our Ione fi'e seri$' num9ers# This isnDt $ com5rehensi*e configur$tion error 'ist? 9ut it co*ers some common mist$kes with $ new configur$tion#
&C .se the host Bns'ooku5 in Win!owsC comm$n! for 9oth forw$r! $n! re*erse 'ooku5s to m$ke sure the Ione fi'es were configure! correct'0# f this f$i's? tr0: Dou9'e check for 0our u5!$te! seri$' num9ers in the mo!ifie! fi'es $n! $'so ins5ect the in!i*i!u$' recor!s within the fi'es for mist$kes# >nsure there isnDt $ firew$'' th$t cou'! 9e 9'ocking DNS tr$ffic on TC6 $n!8or .D6 5ort +& 9etween 0our ser*er $n! the
1( of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
DNS ser*er# .se the !ig comm$n! to !etermine whether the n$me ser*er for 0our !om$in is configure! correct'0# Here is $n ex$m5'e of Fuer0ing DNS ser*er ns1#m0Asite#com for the 6 $!!ress of www#'inuxhomenetworking#com# B,ou c$n $'so re5'$ce the n$me ser*erDs n$me with its 6 $!!ress#C
[root@bigboy tmp]# host www.linuxhomenetworking.com ns1.my-site.com Using domain server: Name: ns1.my-site.com Address: 192.168.1.100#53 Aliases: www.linuxhomenetworking.com has address 65.115.71.34 [root@bigboy tmp]#
Here is $n ex$m5'e of Fuer0ing 0our !ef$u't DNS ser*er for the 6 $!!ress of www#'inuxhomenetworking#com# )s 0ou c$n see? the n$me of the s5ecific DNS ser*er to Fuer0 h$s 9een 'eft off the en!# F$i'ure in this c$se cou'! 9e !ue not on'0 to $n error on 0our % ND configur$tion or !om$in registr$tion 9ut $'so to $n error in 0our DNS c'ientDs DNS ser*er entr0 in 0our Linux 8etc8reso'*#conf fi'e or the Win!ows TC68 6 5ro5erties for 0our N C#
[root@bigboy tmp]# host www.linuxhomenetworking.com www.linuxhomenetworking.com has address 65.115.71.34 [root@bigboy tmp]#
(C ,ou c$n $'so use the !ig comm$n! to !etermine whether known DNS ser*ers on the nternet h$*e recei*e! $ *$'i! u5!$te for 0our Ione# B4emem9er if 0ou !eci!e to ch$nge the DNS ser*ers for 0our !om$in th$t it cou'! t$ke u5 to four !$0s for it to 5ro5$g$te $cross the nternet#C The form$t for the comm$n! is:
dig <domain-name> <name-server> soa
The n$me ser*er is o5tion$'# f 0ou s5ecif0 $ n$me ser*er? then !ig Fueries th$t n$me ser*er inste$! of the Linux ser*erDs !ef$u't n$me ser*er# t is sometimes goo! to Fuer0 9oth 0our n$me ser*er? $s we'' $s $ we'' known n$me ser*er such $s ns1#0$hoo#com to m$ke sure 0our DNS recor!s h$*e 5ro5$g$te! 5ro5er'0# The !ig comm$n! on'0 works with fu''0 Fu$'ifie! !om$in n$mes on'0? 9ec$use it !oesnDt refer to the 8etc8reso'*#conf fi'e# This comm$n! uses the 'oc$' DNS ser*er for the Fuer0# t returns the SO) recor! inform$tion $n! the $!!resses of the !om$inDs DNS ser*ers in the $uthorit0 section#
[root@bigboy tmp]# dig linuxhomenetworking.com SOA ... ... ;; AUTHORITY SECTION: linuxhomenetworking.com. 3600 IN NS ns1.myisp.net. linuxhomenetworking.com. 3600 IN NS ns2.myisp.net. ;; ADDITIONAL SECTION: ns1.myisp.net. 3600 ns2.myisp.net. 3600 ... ... [root@bigboy tmp]#
IN IN
A A
65.115.70.68 65.115.70.69
Here is $ successfu' !ig using DNS ser*er ns1#0$hoo#com for the Fuer0# )s 9efore? it returns the SO) recor! for the Ione#
[root@bigboy tmp]# dig ns1.yahoo.com linuxhomenetworking.com SOA ... ... ;; AUTHORITY SECTION: linuxhomenetworking.com. 3600 IN NS ns2.myisp.net. linuxhomenetworking.com. 3600 IN NS ns1.myisp.net. ;; ADDITIONAL SECTION: ns1.myisp.net. 3600 ns2.myisp.net. 3600 ... ... [root@bigboy tmp]#
IN IN
A A
65.115.70.68 65.115.70.69
Sometimes 0our SO) !ig wi'' f$i'# This comm$n! uses the DNS ser*er ns1#0$hoo#com for the Fuer0# n this c$se the $uthorit0 section !oesnDt know of the !om$in $n! 5oints to the n$me ser*er for the entire #com !om$in $t ;eriSign#
[root@bigboy tmp]# dig ns1.yahoo.com linuxhomeqnetworking.com SOA ... ... ;; QUESTION SECTION: ;linuxhomeqnetworking.com. IN SOA ;; AUTHORITY SECTION: com. 0 IN SOA a.gtld-servers.net. nstld.verisign-grs.com. ... ... [root@bigboy tmp]#
6ossi9'e c$uses of f$i'ure inc'u!e: T05ogr$5hic$' errors# n this c$se the miss5e''ing L'inuxhomeFnetworking#comL w$s entere! on the comm$n! 'ine# ncorrect !om$in registr$tion# Correct !om$in registr$tion? 9ut there is $ '$g in the 5ro5$g$tion of the !om$in inform$tion $cross the nternet# De'$0s of u5 to four !$0s $re not uncommon# ) firew$'' cou'! 9e 9'ocking DNS tr$ffic on TC6 $n!8or .D6 5ort +& 9etween 0our ser*er $n! the DNS ser*er#
1+ of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
www.my-site.com. hostmaster.my-site.com. 2004110701 ns1.my-site.com. 10 mail.my-site.com. 192.168.1.96 192.168.1.97 192.168.1.98 192.168.1.100 192.168.1.1 127.0.0.1 www.my-site.com. www.my-site.com. www.my-site.com.
1- of 1/
1183(8"31( 1:31 67
htt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h58Quick=H###
This m$0 not seem 'ike $n im5ort$nt securit0 thre$t $t first g'$nce? 9ut it is# )n0one c$n use this comm$n! to !etermine $'' 0our ser*erDs 6 $!!resses $n! from the n$mes !etermine wh$t t05e of ser*er it is $n! then '$unch $n $55ro5ri$te c09er $tt$ck# n $ sim5'e home network? without m$ster $n! s'$*e ser*ers? Ione tr$nsfers shou'! 9e !is$9'e!# ,ou c$n !o this 90 $55'0ing the $''owAtr$nsfer !irecti*e to the g'o9$' o5tions section of 0our n$me!#conf fi'e#
options { allow-transfer {none;}; };
Note: This !oes not restrict forw$r! or re*erse 'ooku5s !efine! 90 the Ione fi'es on the ser*er# The ser*er wi'' $nswer $'' Fueries for m0Awe9Asite#org if it owns th$t !om$in? 9ut it wonDt res5on! to Fueries for ser*ers in $nother !om$in such $s goog'e#com#
Conc'usion
DNS m$n$gement is $ critic$' 5$rt of the m$inten$nce of $n0 We9 site# Fortun$te'0? $'though it c$n 9e $ 'itt'e com5'ic$te!? DNS mo!ific$tions $re usu$''0 infreFuent? 9ec$use the 6 $!!ress of $ ser*er is norm$''0 fixe! or st$tic# This is not $'w$0s the c$se# There $re situ$tions in which $ ser*erDs 6 $!!ress wi'' ch$nge un5re!ict$9'0 $n! freFuent'0? m$king DNS m$n$gement extreme'0 !ifficu't# D0n$mic DNS w$s cre$te! $s $ so'ution to this $n! is ex5'$ine! in Ch$5ter 11? LD0n$mic DNSL# 4etrie*e! from Lhtt5:88www#'inuxhomenetworking#com8wiki8in!ex#5h5Ptit'eRQuick=HOWTO=:=Ch18=:=Configuring=DNSJ o'!i!R(&""L
This 5$ge w$s '$st mo!ifie! on 13 )ugust "31"? $t 3-:31# Content is $*$i'$9'e un!er )ttri9utionANonCommerci$'ANoDeri*s "#+ #
1/ of 1/
1183(8"31( 1:31 67