\documentclass[letterpaper,english]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{DNS HOWTO ¤¤Ä¶ª©}
\author{§@ªÌ: Nicolai Langfeldt {\ttfamily \onlynameurl{janl@math.uio.no}}\\ 
Ä¶ªÌ: \onlynameurl{Asd L. Chen}
\& \onlynameurl{C.W.Huang}}
\date{v1.4.2, 1 January 1998
Â½Ä¶¤é´Á: 8 January 1998}
\abstract{¦p¦ó¦¨¬°¤@­ÓºÙÂ¾ªº¤p«¬ DNS ºÞ²zªÌ¡D}


\begin{document}
\maketitle
\tableofcontents

\section{«e¨¥}

ÃöÁä¦r: DNS, bind, named, dialup, ppp, slip, Internet, domain, name, hosts, resolving




\subsection{ª©Åv«Å§i}

(C)opyright 1995 Nicolai Langfeldt.  Do not modify without amending
copyright, distribute freely but retain copyright message.\\ 
¨S¦³­×­qª©ÅvªÌ½Ð¤Å­×§ï¡A¥i¦Û¥Ñ´²§G¦ý¥²¶·«O¯dª©Åv°T®§¡D




\subsection{·PÁÂ»P¨D§U}

§Ú­n¦VµL¼Æ¦¸¾\Åª³o¥÷¤å¥óªº¯ó½Z¨Ã´£¨Ñ³\¦h¦³¥Î«ØÄ³ªº Arnt Gulbrandsen ªí¹F·PÁÂ¤§·N¡D
§Ú¤]­n·PÁÂ¨º¨Ç±N«ØÄ³±Hµ¹§Úªº¤H¡D

³o¥÷¤å¥ó±N¥Ã»·¤£·|¦³§¹¦¨ªº¤@¤Ñ¡A½Ð§â§Aªº°ÝÃD¥H¤Î¦¨¥\ªº¸gÅç±Hµ¹§Ú¡A
³o¥i¥H¨Ï¥¦¦¨¬°¤@¥÷§ó¦nªº»¡©ú¤å¥ó¡D©Ò¥H½Ð§â¿ú¡Aµû½×¥H¤Î/©Î¬O°ÝÃD±Hµ¹ 
\onlynameurl{janl@ifi.uio.no}¡D
¦pªG§A±H«Hµ¹§Ú¨Ã§Æ±æ±o¨ì¦^µª½Ðªí²{°ò¥»ªºÂ§»ª¡A{\itshape ½T©w\/}¦^«H¦a§}¬O¥¿½T¦Ó¥B¥i¥H¹B§@ªº¡D
ÁÙ¦³¡A¼g«Hµ¹§Ú«e{\bfseries ½Ð}¥ý¾\Åª \ref{qanda} {(FAQ)} ¤@¸`¡D

¦pªG§A·QÂ½Ä¶³o½g HOWTO ½Ð»P§ÚÁpµ¸¡A³o¼Ë§Ú¤~ª¾¹D§Úªº¤å³¹³QÅÜ¦¨¦óºØ»y¨¥ :-).




\subsection{ÃDÄmÃã}

ÂÔ¥H³o¥÷»¡©ú¤å¥óÄmµ¹ Anne Line Norheim Langfeldt¡DÁöµM¦o¥i¯à¥Ã»·³£¤£·|¾\Åª³o¥÷¤å¥ó¡A¦]¬°¦o¤£¬O³oÃþ«¬ªº¤k«Ä¡D




\section{Â²¤¶\label{intro}}

{\bfseries ³o¬O¤°»ò¥H¤Î³o¤£¬O¤°»ò}

­º¥ý¡ADNS ´N¬O»â°ì¦WºÙ¨t²Î(Domain Name System)¡D
¬°¾÷¾¹©R¦Wªº³W«h¥H¤Î±N³o¨Ç¦WºÙÂà´«¬° IP ¼Æ¦rªº³nÅé¡D
³o¥÷ HOWTO ¤å¥ó»¡©ú¤F¦p¦ó¥Î Linux ©w¸q³o¼Ëªº¹ïÀ³¡D
¹ïÀ³«üªº¬O³o¨â¥ó¨ÆªºÁpÃ´¡A¾÷¾¹¦WºÙ¡A¹³ {\ttfamily ftp.linux.org}¡A
¥H¤Î¾÷¾¹ªº IP ¼Æ¦r¡A¹³¬O {\ttfamily 199.249.150.4}¡D

DNS¡A¹ï·s¤â(§A¡F¡Ð)¦Ó¨¥¡A¬Oºô¸ôºÞ²z¤¤¤ñ¸û±â·t¤£©úªº¦a¤è¤§¤@¡D
³o¥÷»¡©ú¤å¥ó±N·|¸ÕµÛÅý´X¥ó¨Æ±¡¯à²M·¡¤@ÂI¡D¥¦´y­z¦p¦ó³]¥ß¤@­Ó{\itshape Â²³æ\/}ªº DNS ¦WºÙ¦øªA¾¹¡D
¶}©l¥ý»¡©ú¼È¦s±M¥Î(caching only)¦øªA¾¹¡AµM«á¬O¬°¤@»â°ì³]¥ß¥D­n(primary)¦WºÙ¦øªA¾¹¡D
¦Ü©ó§ó½ÆÂøªº³]©w§A¥i¥H°Ñ¦Ò³o¥÷¤å¥óªº \ref{qanda} {(FAQ)} ¤@¸`¡D
¤£¥Î»¡§A±N±o{\itshape ¾\Åª\/}¯u¥¿ªº¤å¥ó¡D
§Ú±N·|¦b
\ref{bigger} {(³Ì«á¤@³¹)}
¦^¹LÀY¨Ó»¡©ú³o¸Ì©Ò¿×¯u¥¿ªº¤å¥ó¥]§t¦³­þ¨Ç¡D

¦b§A¥i¥H¶}©l¶i¦æ³o¶µ¤u§@¤§«e§AÀ³¸Ó­n¥ý°t¸m¦n§Aªº¾÷¾¹¥H«K¥i¥H±q»·ºÝÃ±¤J¥¦¥H¤Î¥Ñ¥¦¹ï¨ä¥¦¾÷¾¹§@»·ºÝÃ±¤J¡A
¨Ã¥B¨Ï©Ò¦³¦UºØ¹ïºô¸ôªº³s½u³£¯à¦¨¥\¦a¶i¦æ¡A¤×¨ä§AÀ³¸Ó­n¯à°÷¹ï {\ttfamily 127.0.0.1} ¶i¦æ»·ºÝÃ±¤J¨Ã¥B¶i¤J§A¦Û¤vªº³o¥x¾÷¾¹(²{¦b´N¸Õ¸Õ!)¡D
¦P®É§A¤]»Ý­n¤@¥÷¹B§@¨}¦nªº {\ttfamily /etc/host.conf}, {\ttfamily /etc/resolv.conf} ¥H¤Î {\ttfamily /etc/hosts} ÀÉ®×§@¬°¶}©l¡D
¦]¬°§Ú±N¤£·|¦b³o¸Ì¸ÑÄÀ¥¦­Ìªº¥\¯à¡D¦pªG§AÁÙ¨S¦³§¹¦¨©Ò¦³³o¨Ç³]©w¨Ã¨Ï¨ä¹B§@¨º»ò the networking/NET-2 HOWTO ·|¸ÑÄÀ¦p¦ó³]¥ß¥¦­Ì¡D¾\Åª¤§¡D

¦pªG§A¨Ï¥Î SLIP ©ÎªÌ¬O PPP ¨º»ò§A±o­n¯àÅý¥¦¹B§@¡D­Y¬O¥¦ÁÙ¤£¯à¹B§@ªº¸Ü¾\Åª \onlynameurl{PPP HOWTO}¡D

·í§Ú»¡¡¥§Aªº¾÷¾¹¡¦®É§Úªº·N«ä¬O§A¥¿­n¹Á¸Õ¦b¤W­±³]¥ß DNS  ªº¨º¥x¾÷¾¹¡D
¤£¬O¥ô¦ó¥i¯à¦b§Aºô¸ôÀô¹Ò¸Ìªº¨ä¥¦¾÷¾¹¡D

§Ú°²³]§A¨Ã¤£¬O³B©ó¥ô¦ó·|ªýÃª¦WºÙ¬d¸ßªº¨¾¤õÀð«á­±¡D¦pªG§A¬O¨º»ò§A±N·|»Ý­n¯S§Oªº³]©w¡A
°Ñ¨£ \ref{qanda} {(FAQ)} ¤@¸`¡D

¦b Unix ¤Wªº¦WºÙªA°È¬OÂÇ¥Ñ¤@¤äºÙ¬° {\ttfamily named} ªºµ{¦¡¨Ó°õ¦æªº¡D
³o¬OÄÝ©ó bind ®M¥óªº¤@³¡¥÷¡A³o­Ó®M¥ó¬O¥Ñ Paul Vixie ¬°ºô»Úºô¸ô³nÅé¶°¹Î(Internet Software Consortium)©Ò¨ó½Õµo®iªº¡D
¤j³¡¤Àªº Linux µo¦æ®M¥ó³£¥]§t¦³ {\ttfamily named}¡A¦Ó¥B³q±`¦w¸Ë©ó {\ttfamily /usr/sbin/named}¡D
¦pªG§Aªº¨t²Î¦³­Ó {\ttfamily named} ¨º»ò§A¤j·§¥i¥Hª½±µ¨Ï¥Î¥¦¡F¦pªG¨S¦³ªº¸Ü¨º»ò§A¥i¥H±q¬Y­Ó Linux ftp ¯¸¨ú¦^¤@¥÷¤G¶i¦ì°õ¦æÀÉ¡A©Î¬O±q {\ttfamily \onlynameurl{ftp.isc.org:/isc/bind/src/cur/}} ¥Ø¿ý¸Ì¨ú±o³Ì·s³Ì´Îªº­ì©lµ{¦¡½X¡D
¥»¤å¥ó¬O»¡©ú bind version 4 ªº¡D¦pªG§A¦w¸Ë version 8 §A­n¦Û¤v·Q¿ìªk¡Dµy«á¦³¤@¸`¥i¯à·|¹ï§A¦³¨ÇÀ°§U¡D

DNS ¬O­Ó¥H¾ã­Óºô¸ô¬°½d³òªº(net-wide)¸ê®Æ®w¡D­n¤p¤ß§A©ñ¶i¸Ì­±ªº¸ê®Æ¡D
¦pªG§A©ñ¨Ç¼oª«¶i¥h¡A§A¡A¥H¤Î¨ä¥¦¤H³£±N·|±q¤¤¨ú¥X¨Ç¼oª«¡D
«O«ù§A DNS ªº¾ã»ô¤@­P¨º»ò§A±N¯à±q¤¤¨ú±o¨}¦nªºªA°È¡D
¾Ç²ß¥h¨Ï¥Î¥¦¡AºÞ²z¥¦¡A°l¬d¥¦ªº¿ù»~¨º»ò§A±N·|¬O¥t¤@­Ó«O«ùºô¸ô§K©ó¦]¬°ºÞ²z¤£µ½¦Ó®Ä²v§C¸¨ªº¦nºÞ²zªÌ¡D

¦b³o¥÷¤å¥ó¸Ì§ÚÂ_µM¦a±Ô­z´X¥ó¨Ã¤£§¹¥þ¬O¯u¹êªº¨Æ±¡(ÁöµM¥¦­Ì¦Ü¤Ö¦³¤@¥b¬O¯uªº)¡D
³o¥þ³£¬O¬°¤FÂ²¤Æ¡D¦pªG§A¬Û«H§Ú©Ò»¡ªº¨º»ò³o¨Ç¤j·§´N¯à¹B§@¡D

{\bfseries ­n³Z:} ¦pªG§A¤w¸g¾Ö¦³§Ú­n§A¥h§ïÅÜªºÀÉ®×¡A¨º»ò©Ò¦³³o¨ÇÀÉ®×³£­n¥ý°µ³Æ¥÷¡A
³o¼Ë¤@¨Ó¦pªG¸g¾ú³o¨Ç§ïÅÜ¤§«á¨S¦³ªF¦è·|°Êªº¸Ü§A¥i¥H¦^´_¨ì§AÂÂªº¡A¥i¥H¹B§@ªº±¡§Î¡D




\section{¼È¦s±M¥Î¦WºÙ¦øªA¾¹\label{caching}}

{\bfseries DNS °t¸mªº­ººØ¹Á¸Õ¡A¹ï¼·±µ¨Ï¥ÎªÌ«D±`¦³¥Î¡D}

¤@¥x¼È¦s±M¥Î¦WºÙ¦øªA¾¹±N·|¬°¦WºÙ¬d¸ß§ä¥Xµª®×¨Ã¥B¦b¤U¤@¦¸§A»Ý­n¨º­Ó¦WºÙªº®É­Ô°O±oµª®×¡D

­º¥ý§A»Ý­n¤@­ÓºÙ¬° {\ttfamily /etc/named.boot} ªºÀÉ®×¡D·í {\ttfamily named} ±Ò°Ê®É·|Åª¨ú³o­ÓÀÉ®×¡D
¥Ø«e¥¦À³¸Ó³æ¯Â¦a¥]§t:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
;  Boot file for nicolais caching name server
;
directory /var/named
;
; type          domain                          source file or host
cache           .                               root.cache
primary         0.0.127.in-addr.arpa            pz/127.0.0
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\bfseries «D±`­«­n:} ¦b³o¤å¥óªº¬Y¨Çª©¥»¤¤³o­ÓÀÉ®×ªº³o¥÷¦Cªí·|¦b²Ä¤@­Ó«DªÅ¥Õ¦r¤¸«e¥]§t¤@¨ÇªÅ®æ©Î tab Áä¡D
³o¨Ç¤£À³¸Ó¥X²{¦bÀÉ®×¤¤¡D¦pªG§A±q³o¥÷ HOWTO °Å¶K¤U¨Ó¡A°O±o{\bfseries §R°£¥ô¦ó«e­±ªºªÅ¥Õ}¡D

`{\ttfamily directory}' ³o¤@¦æ§i¶D {\ttfamily named} ¨ì­þ¸Ì¥h§ä´MÀÉ®×¡D©Ò¦³¨ä«á©R¦WªºÀÉ®×³£±N¬O¬Û¹ï©ó¦¹¥Ø¿ýªº¡D
®Ú¾Ú Linux ÀÉ®×¨t²Î¼Ð·Ç¥¿½Tªº¥Ø¿ýÀ³¸Ó¬O¦b {\ttfamily /var/named}¡D
¦]¦¹ {\ttfamily pz} ¬O¦ì©ó {\ttfamily /var/named} ¤§¤Uªº¡A¤]´N¬O¡A{\ttfamily /var/named/pz}¡D

ºÙ¬° {\ttfamily /var/named/root.cache} ªº³o­ÓÀÉ®×¬O¦b¦¹©R¦Wªº¡D
³o­Ó {\ttfamily /var/named/root.cache} À³¸Ó¥]§t:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
 .       518400  NS      D.ROOT-SERVERS.NET.
 .       518400  NS      E.ROOT-SERVERS.NET.
 .       518400  NS      I.ROOT-SERVERS.NET.
 .       518400  NS      F.ROOT-SERVERS.NET.
 .       518400  NS      G.ROOT-SERVERS.NET.
 .       518400  NS      A.ROOT-SERVERS.NET.
 .       518400  NS      H.ROOT-SERVERS.NET.
 .       518400  NS      B.ROOT-SERVERS.NET.
 .       518400  NS      C.ROOT-SERVERS.NET.
;
D.ROOT-SERVERS.NET.     3600000 A       128.8.10.90
E.ROOT-SERVERS.NET.     3600000 A       192.203.230.10
I.ROOT-SERVERS.NET.     3600000 A       192.36.148.17
F.ROOT-SERVERS.NET.     3600000 A       192.5.5.241
G.ROOT-SERVERS.NET.     3600000 A       192.112.36.4
A.ROOT-SERVERS.NET.     3600000 A       198.41.0.4
H.ROOT-SERVERS.NET.     3600000 A       128.63.2.53
B.ROOT-SERVERS.NET.     3600000 A       128.9.0.107
C.ROOT-SERVERS.NET.     3600000 A       192.33.4.12
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\bfseries °O¦í§Ú»¡¹L­n¥h±¼ªÅ¥Õ¦r¤¸!}

³o­ÓÀÉ®×´y­z¤F¦b³o­Ó¥@¬É¤Wªº®Ú¦WºÙ¦øªA¾¹¡D³o·|ÀH®É¶¡¦Ó§ïÅÜ¨Ã¥B{\itshape ¥²¶·\/}¥[¥HºûÅ@¡D
¦p¦ó¯à«O«ù¥¦ÀH®É§ó·s½Ð°Ñ¨£\ref{maint} {(ºûÅ@½g)}¡D
¦b {\ttfamily named} ªº½u¤W¨Ï¥Î¤â¥U¸Ì¦³³o­ÓÀÉ®×ªº´y­z¡A¦ý¬O³o¡A¥H§Ú¬Ý¨Ó¡A³Ì¾A¦X¨º¨Ç¤w¸g¤F¸Ñ {\ttfamily named} ªº¤H­Ì¡D

¦b {\ttfamily named.boot} ¸Ìªº¤U¤@¦æ¬O {\ttfamily primary} ³o¤@¦æ¡D
§Ú±N·|¦bµy«áªº³¹¸`¸Ì¸ÑÄÀ¥¦ªº¥Îªk¡A¥Ø«e¥u­n§â¥¦³]¬°¦b {\ttfamily pz} ¤l¥Ø¿ý¤U¤@­ÓºÙ¬° {\ttfamily 127.0.0} ªºÀÉ®×:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@               IN      SOA     linux.bogus. hostmaster.linux.bogus. (
                                1       ; Serial
                                28800   ; Refresh
                                7200    ; Retry
                                604800  ; Expire
                                86400)  ; Minimum TTL
                        NS      ns.linux.bogus.
1                       PTR     localhost.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


±µ¤U¨Ó¡A§A»Ý­n¤@¥÷¬Ý°_¨Ó¹³³o¼Ëªº {\ttfamily /etc/resolv.conf} ÀÉ®×:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
search subdomain.your-domain.edu your-domain.edu
nameserver 127.0.0.1
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


`{\ttfamily search}' ³o¤@¦æ«ü¥X¹ï©ó¥ô¦ó§A·Q³s©¹ªº¥D¾÷¦WºÙÀ³¸Ó·j´Mªº»â°ì¡D
`{\ttfamily nameserver}' ³o¤@¦æ«ü¥X§Aªº¾÷¾¹¥i¥H¦b­þ­Ó¦ì§}¤W§ä¨ì¤@¥x¦WºÙ¦øªA¾¹¡A
¦b³o­Ó¨Ò¤l¤¤¬O§A¦Û¤vªº³o¥x¾÷¾¹¡A¦]¬°§A¦b¥¦¤W­±°õ¦æ {\ttfamily named}¡D
¦pªG§A·Q¦C¥X¦n´X­Ó¦WºÙ¦øªA¾¹§â¥¦­Ì³£©ñ¦b¤@¦æ `{\ttfamily nameserver}' ¸Ì¡A¥ÎªÅ®æ¹j¶}¡D
(ª`·N: {\ttfamily named} ±q¤£Åª¨ú³o­ÓÀÉ®×¡A¦Ó¬O¨Ï¥Î {\ttfamily named} ªº¦WºÙ¸Ñµª¾¹·|Åª¨ú¡D)

¨Ó»¡©ú¤@¤U³o­ÓÀÉ®×¦³¤°»ò§@¥Î: ¦pªG¬Y­Ó«È¤áºÝ¹Á¸Õ­n§ä´M {\ttfamily foo} ªº¸Ü¡A
¨º»ò­º¥ý¹Á¸Õªº¬O {\ttfamily foo.subdomain.your-domain.edu} ³o­Ó¦WºÙ¡A
µM«á±µ¤U¨Ó¬O {\ttfamily foo.your-fomain.edu} ³o­Ó¦WºÙ¡A³Ì«á«h¬O {\ttfamily foo} ³o­Ó¦WºÙ¡D
¦pªG¦³¬Y­Ó«È¤áºÝ¹Á¸Õ­n§ä´M {\ttfamily sunsite.unc.edu} ªº¸Ü¡A
¨º­º¥ý¹Á¸Õªº¬O {\ttfamily sunsite.unc.edu.subdomain.your-domain.edu} ³o­Ó¦WºÙ(¨S¿ù¡A¥¦¯u²Â! ¤£¹L¥¦´N¬O³o»ò°µ)¡A
µM«á±µ¤U¨Ó¬O {\ttfamily sunsite.unc.edu.your-domain.edu} ³o­Ó¦WºÙ¡A³Ì«á«h·|¬O {\ttfamily sunsite.unc.edu} ³o­Ó¦WºÙ¡D
§A¥i¯à¤£·|·Q©ñ¤Ó¦h»â°ì¨ì {\ttfamily search} ¸Ó¦æ¸Ì¥h¡A·j´M¥¦­Ì·|¦hªá®É¶¡¡D

³o­Ó½d¨Ò°²³]§AÄÝ©ó {\ttfamily subdomain.your-domain.edu} ³o­Ó»â°ì¡A
¨º»ò§Aªº¾÷¾¹¡A¥i¯à·|ºÙ¬° {\ttfamily your-machine.subdomain.your-domain.edu}¡D
¦b {\ttfamily search} ³o¦æ¸Ì¤£À³¸Ó¥]§t§Aªº TLD (³»¼h»â°ì Top Level Domain¡A¦b³o­Ó¨Ò¤l¤¤¬O {\ttfamily edu} ³o­Ó»â°ì)¡D
¦pªG§A¸g±`»Ý­n³s½u¨ì¦b¥t¥~¤@­Ó»â°ì¸Ìªº¥D¾÷§A»ò§A¥i¥H§â¸Ó»â°ì¹³³o¼Ë¦a¥[¶i {\ttfamily search} ³o¦æ¸Ì:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
search subdomain.your-domain.edu your-domain.edu other-domain.com
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¨Ì¦¹Ãþ±À¡D«Ü©úÅãªº¬O§A±o©ñ¤J¯u¹êªº»â°ì¦WºÙ¨Ó¨ú¥N³o¨Ç¦WºÙ¡D½Ðª`·N¦b»â°ì¦WºÙªº³Ì«á­±¨Ã¨S¦³¥y¸¹ '.'¡D

±µ¤U¨Ó¡A®Ú¾Ú§A libc ª©¥»ªº¤£¦P»Ý­n­×¥¿ {\ttfamily /etc/nsswitch.conf} ©ÎªÌ¬O {\ttfamily /etc/host.conf} ÀÉ®×¡D

{\bfseries /etc/nsswitch.conf}

³o¬O¤@­Ó«ÜªøªºÀÉ®×¡A¥¦«ü¥X¨ì¦ó³B¥h¨ú±o¦UºØ¤£¦Pªº¸ê®Æ«¬ºA¡A±q¤°»òÀÉ®×©Î¬O¸ê®Æ®w¨ú±o¡D
¥¦ªº³»ºÝ¸g±`·|¥]§t¤@¨Ç¦³¥Îªºµù¸Ñ¡D§ä¥X¥H `{\ttfamily hosts:}'  §@¬°¶}ÀYªº¨º¤@¦æ¡A¥¦À³¸Ó¬O³o¼Ë:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
hosts:      files dns
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¦pªGÀÉ®×¸Ì¨S¦³¥H `{\ttfamily hosts:}' §@¬°¶}ÀYªº¦æ¨º»ò§â¤W­±³o¤@¦æ¥[¤W¥h¡D
¥¦¬O»¡µ{¦¡À³¸Ó¥ý¦b {\ttfamily /etc/hosts} ÀÉ®×¸Ì§ä´M¡AµM«á®Ú¾Ú {\ttfamily resolv.conf} ¸ß°Ý DNS¡D

{\bfseries /etc/host.conf} 

¥¦¥i¯à¥]§t¦³¼Æ¦æ¡A¨ä¤¤À³¸Ó¦³¤@¦æ¥H {\ttfamily order} §@¬°¶}©l¦Ó¥B¥¦¬Ý°_¨Ó·|¹³³o¼Ë:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
order hosts,bind
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¦pªGÀÉ®×¸Ì¨S¦³ `{\ttfamily order}'  ³o¤@¦æªº¸Ü¨º»ò§AÀ³¸Ó¶K¤@¥÷¤W¥h¡D
¥¦§i¶D¥D¾÷¦WºÙ¸ÑªR¨ç¦¡¥ý¦b {\ttfamily /etc/hosts} ¸Ì§ä´M¡AµM«á¬d°Ý¦WºÙ¦øªA¾¹
(¦b {\ttfamily resolv.conf} ¸Ì§A»¡¦b 127.0.0.1 ³o­Ó¦a¤è)¡D
¦b¤j³¡¤À Linux µo¦æ®M¥ó¤¤³Ì«á³o¨â­ÓÀÉ®×ªº¤å¥ó¦b resolv(8) ªº½u¤W¨Ï¥Î¤â¥U¤¤(°õ¦æ `{\ttfamily man 8 resolv}' §Y¥i)¡D
³o¥÷½u¤W¥Î¤â¥U§ÚÄ±±o¥i¬Ý¡A¦Ó¥B¨C­Ó¤H¡A¯S§O¬O DNS ºÞ²zªÌ¡A³£À³¸Ó­n¾\Åª¥¦¡D
²{¦b´N°µ¡A¦pªG§A¹ï§A¦Û¤v»¡{``}§Úµy«á±N·|¥h°µ{''}¡A§A±N¥Ã»·¤£·|¥h±µªñ¥¦¡D




\subsection{°_©l named}

³o¨Ç¥þ³¡§¹¦¨«á´N¥i¥H°_©l {\ttfamily named} ¤F¡D¦pªG§A¨Ï¥Î¼·±µ³s½uªº¸Ü¨º»ò½Ð¥ý³s¤Wºô¸ô¡D
Áä¤J `{\ttfamily ndc start}'  ¨Ã¥B«ö¤U {\ttfamily RETURN} Áä¡A¨S¦³¿ï¶µ¡D
¦pªG¥¦¤£¦æªº¸Ü¨º»ò¸ÕµÛ¨Ï¥Î `{\ttfamily /usr/sbin/ndc start}' ¨Ó¨ú¥N¡D
¦A¤£¦æªº¸Ü½Ð°Ñ¦Ò \ref{qanda} {(FAQ)} ¤@¸`¡D
²{¦b§A¥i¥H´ú¸Õ§Aªº³]©w¡D·í§A¦b°_©l {\ttfamily named} ªº®É­Ô¦pªG§AÆ[¹î¤@¤U
(¨Ï¥Î {\ttfamily tail -f /var/adm/messages} «ü¥O)¨t²Î°O¿ý°T®§ÀÉ®×
(³q±`¬OºÙ¬° {\ttfamily /var/adm/messages} ªºÀÉ®×¡A¦ý¤]¥i¯à¦b {\ttfamily /var/log} ¤U¡A©Î¬O¥s {\ttfamily syslog} ªºÀÉ®×)
¨º»ò§AÀ³¸Ó·|¬Ý¨£¹³¼Ëªº¤@¨ÇªF¦è:
\begin{tscreen}
\begin{verbatim}
Jun 30 21:50:55 roke named[2258]: starting.  named 4.9.4-REL Sun Jun 30 21:29:03 MET DST 1996   janl@roke.slip.ifi.uio.no:/var/tmp/bind/named
Jun 30 21:50:55 roke named[2258]: cache zone "" loaded (serial 0)
Jun 30 21:50:55 roke named[2258]: primary zone "0.0.127.in-addr.arpa" loaded (serial 1)
\end{verbatim}
\end{tscreen}


¦pªG¦³¥ô¦óÃö©ó¿ù»~ªº°T®§¨º»ò´N¬O¦³­Ó¿ù»~µo¥Í¡A
{\ttfamily named} ±N·|«ü¦W¦³¿ù»~ªºÀÉ®×(§Ú·Q¬O {\ttfamily named.boot} ¥H¤Î {\ttfamily root.cache} ¨ä¤¤¤§¤@:-)¡D
±þ±¼ {\ttfamily named} µ{§Ç¨Ã¦^ÀYÀË¬d¨º¨ÇÀÉ®×¡D

²{¦b¥i¥H¥Î {\ttfamily nslookup} ¨ÓÀË¬d¤@¤U§Aªº¤u§@:
\begin{tscreen}
\begin{verbatim}
$ nslookup
Default Server:  localhost
Address:  127.0.0.1

>
\end{verbatim}
\end{tscreen}


¦pªG³o¬O§A©Ò±o¨ìªº¦^À³¨º»ò¥¦¤w¸g¯à°÷¹B§@¡D§Ú­Ì§Æ±æ¬O³o¼Ë¡D±o¨ì¥ô¦ó¨ä¥¦¦^À³³£½Ð¦^ÀYÀË¬d¨C¤@¥ó¨Æ¡D
¨C¤@¦¸§A§ïÅÜ {\ttfamily named.boot} ÀÉ®×¤§«á§A³£±o¨Ï¥Î {\ttfamily ndc restart} ³o­Ó«ü¥O­«·s°_©l {\ttfamily named} µ{¦¡¡D

²{¦b§A¥i¥H¿é¤J¬d¸ß¡D¹Á¸Õ§ä´M¬Y¨Ç¾aªñ§Aªº¾÷¾¹¡D{\ttfamily pat.uio.no} Â÷§Ú¤£»·¡A¦b Oslo ªº¤j¾Ç¸Ì:
\begin{tscreen}
\begin{verbatim}
> pat.uio.no
Server:  localhost
Address:  127.0.0.1

Name:    pat.uio.no
Address:  129.240.2.50
\end{verbatim}
\end{tscreen}


²{¦b {\ttfamily nslookup} ­n¨D§Aªº {\ttfamily named} §ä´M {\ttfamily pat.uio.no} ³o¥x¾÷¾¹¡D
µM«á¥¦({\ttfamily named})ÁpÃ´¦b§A {\ttfamily root.cache} ÀÉ®×¸Ì©Ò«ü¦Wªº¦WºÙ¦øªA¾÷¾¹¨ä¤¤¤@¥x¡A
¨Ã¥B±q¨º¸Ì¬d°Ý¥¦¸Ó¦p¦óÄ~Äò¤U¥h¡D¦b§A¨ú±oµ²ªG¤§«e¥i¯à±oªá¶O¤@ÂI®É¶¡¡A
¦]¬°¥¦·j´M§A¦b {\ttfamily /etc/resolv.conf} ¸Ì«ü¦Wªº©Ò¦³»â°ì¡D

¦pªG§A¦A¸Õ¤@¦¸ªº¸Ü¨º»ò§A±N·|±o¨ì:
\begin{tscreen}
\begin{verbatim}
> pat.uio.no
Server:  localhost
Address:  127.0.0.1

Non-authoritative answer:
Name:    pat.uio.no
Address:  129.240.2.50
\end{verbatim}
\end{tscreen}


ª`·N³o¦^§Ú­Ì©Ò±o¨ìªº `{\ttfamily Non-authoritative answer:}' ³o¤@¦æ¡D
³o¥Nªí {\ttfamily named} ¦¹¦¸¨Ã¥¼¨ìºô¸ô¥~¥h¬d°Ý¡A¨ú¦Ó¥N¤§ªº¬O¦b¥¦ªº¼È¦s°Ï¸Ì§ä´M¨Ã¥B¦b¨º¸Ì§ä¨ìµª®×¡D
¦ý¬O¼È¦sªº¸ê°T{\itshape ¥i¯à\/}·|¹L®É¡D©Ò¥H¥¦ÂÇ¥Ñ `{\ttfamily Non-authorative answer:}' ¨Óª¾·|§A¦³³o­Ó(«Ü»´·Lªº)¦MÀI©Ê¦s¦b¡D
·í {\ttfamily nslookup} »¡³o¬O§A²Ä¤G¦¸¬d°Ý¬Y¥x¥D¾÷®É¡A³o¬O {\ttfamily named} ¯à¼È¦s¸Ó¶µ¸ê°T¨Ã¥B¥¿±`¹B§@ªº¤@­Ó°T®§¡D
§A¥i¥H¨Ï¥Î `exit' «ü¥OÂ÷¶} {\ttfamily nslookup} µ{¦¡¡D

¦pªG§A¬O­Ó¼·±µ(ppp, slip) ¨Ï¥ÎªÌ½Ð¾\Åª\ref{auto} {(¼·±µ³s½u±M¸`)}¡A¸Ì­±¦³¤@¨Çµ¹§Aªº«ØÄ³¡D

²{¦b§Aª¾¹D¦p¦ó³]¥ß¤@­Ó¯à°÷¼È¦sªº {\ttfamily named} ¨t²Î¡D¨ÓªM°à°s¡A¤û¥¤¡A©Î¬O¥ô¦ó§A³ßÅwªºªF¦è¨Ó¼y¯¬§a¡D




\section{¤@­Ó{\itshape Â²³æ\/}ªº»â°ì\label{simple}}

{\bfseries ¦p¦ó«Ø¥ß§A¦Û¤vªº»â°ì}




\subsection{¥ý¨Ó¤@ÂI¯Â²z½×}

¦b§Ú­Ì{\itshape ¯uªº\/}¶}©l¶i¦æ³o¤@¸`¥H«e§Ú±N·|´£¨Ñ§A¤@¨ÇÃö©ó DNS ¦p¦ó¹B§@ªº²z½×¡D
¦Ó§AÀ³¸Ó¾\Åª¥¦¦]¬°³o¹ï§A¦³¯q¡D¦pªG§A¤£¡¥·Q­n¡¦¨º»ò¦Ü¤Ö§A¤]±o«Ü§Ö¦a²¤Åª¤@¤U¡D
·í§A¬Ý¨ìÀ³¸Ó©ñ¶i {\ttfamily named.boot} ÀÉ®×¸Ì¥hªº¤º®e®É¦A°±¤î³oºØ²¤Åª¤è¦¡¡D

DNS ¬O¤@­Ó¶¥¼h¦¡ªº¨t²Î¡D¨ä³»ºÝ¼g§@ `{\ttfamily .}' ¦Ó¨äµo­µ¬° `root' ¡D
¦b . ¤§¤U¦³´X­Ó³»¼h»â°ì(TLDs)¡A³Ìª¾¦Wªº¬O ORG, COM, EDU  ¥H¤Î NET ³o´X­Ó¡A¦ý¬OÁÙ¦³§ó¦h¡D

¦b´M§ä¤@¥x¾÷¾¹¦WºÙ®É¬d¸ß·|¥H»¼°j¤èªk±q³»ºÝ¶}©l¡D
·í§A·Q­n§ä¥X {\ttfamily prep.ai.mit.edu} ªº¦ì§}®É§Aªº¦WºÙ¦øªA¾¹¥²¶·§ä¨ì­t³d {\ttfamily edu} ªº¤@¥x¦WºÙ¦øªA¾¹¡D
³o­Ó°ÝÃD¥¦·|¥h¬d°Ý {\ttfamily root.cache} ÀÉ®×¡A¦Ó {\ttfamily .} ¦øªA¾¹·|µ¹¥¦¤@¥÷ {\ttfamily edu} ¦øªA¾¹¦Cªí¡D
\begin{tscreen}
\begin{verbatim}
$ nslookup
Default Server:  localhost
Address:  127.0.0.1
\end{verbatim}
\end{tscreen}


¶}©l¬d°Ý¬Y¥x®Ú¦øªA¾¹¡D
\begin{tscreen}
\begin{verbatim}
> server c.root-servers.net.
Default Server:  c.root-servers.net
Address:  192.33.4.12
\end{verbatim}
\end{tscreen}


³]©w¬d¸ß«¬ºA¬° NS (¦WºÙ¦øªA¾¹°O¿ý name server records)¡D
\begin{tscreen}
\begin{verbatim}
> set q=ns
\end{verbatim}
\end{tscreen}


¬d°ÝÃö©ó {\ttfamily edu.} ªº¸ê®Æ¡D
\begin{tscreen}
\begin{verbatim}
> edu.
\end{verbatim}
\end{tscreen}


µ²§Àªº . ¦b³o¸Ì«D±`­«­n¡A¥¦§i¶D¸Ó¦øªA¾¹§Ú­Ì©Ò¬d°Ýªº {\ttfamily edu} ¬O¦b . ¤§¤Uªº¨º¤@­Ó¡A
³oµy¯àÁY¤p·j´Mªº½d³ò¡D
\begin{tscreen}
\begin{verbatim}
edu     nameserver = A.ROOT-SERVERS.NET
edu     nameserver = H.ROOT-SERVERS.NET
edu     nameserver = B.ROOT-SERVERS.NET
edu     nameserver = C.ROOT-SERVERS.NET
edu     nameserver = D.ROOT-SERVERS.NET
edu     nameserver = E.ROOT-SERVERS.NET
edu     nameserver = I.ROOT-SERVERS.NET
edu     nameserver = F.ROOT-SERVERS.NET
edu     nameserver = G.ROOT-SERVERS.NET
A.ROOT-SERVERS.NET      internet address = 198.41.0.4
H.ROOT-SERVERS.NET      internet address = 128.63.2.53
B.ROOT-SERVERS.NET      internet address = 128.9.0.107
C.ROOT-SERVERS.NET      internet address = 192.33.4.12
D.ROOT-SERVERS.NET      internet address = 128.8.10.90
E.ROOT-SERVERS.NET      internet address = 192.203.230.10
I.ROOT-SERVERS.NET      internet address = 192.36.148.17
F.ROOT-SERVERS.NET      internet address = 192.5.5.241
G.ROOT-SERVERS.NET      internet address = 192.112.36.4
\end{verbatim}
\end{tscreen}


³o§i¶D§Ú­Ì {\ttfamily *.root-servers.net} ªA°È {\ttfamily edu.} »â°ì¡A©Ò¥H§Ú­Ì¥i¥HÂÇ¦¹Ä~Äò¬d°Ý {\ttfamily c} ¦øªA¾¹¡D
²{¦b§Ú­Ì·Q­nª¾¹D¬O½Ö­t³d¤U¤@¼h {\ttfamily mit.edu.} ªº»â°ì¦WºÙ:
\begin{tscreen}
\begin{verbatim}
> mit.edu.
Server:  c.root-servers.net
Address:  192.33.4.12

Non-authoritative answer:
mit.edu nameserver = STRAWB.mit.edu
mit.edu nameserver = W20NS.mit.edu
mit.edu nameserver = BITSY.mit.edu

Authoritative answers can be found from:
STRAWB.mit.edu  internet address = 18.71.0.151
W20NS.mit.edu   internet address = 18.70.0.160
BITSY.mit.edu   internet address = 18.72.0.3
\end{verbatim}
\end{tscreen}


{\ttfamily steawb}, {\ttfamily w20ns} ¥H¤Î {\ttfamily bitsy} ­t³d {\ttfamily mit} »â°ì¡A¿ï¾Ü¨ä¤¤¤@­Ó¨Ã¥B¬d¸ß {\ttfamily ai.mit.edu}:
\begin{tscreen}
\begin{verbatim}
> server W20NS.mit.edu.
\end{verbatim}
\end{tscreen}


¥D¾÷¦WºÙ¤£¤À¤j¤p¼g¡A¦ý¬O§Ú¨Ï¥Î·Æ¹«¨Ó°Å¶K©Ò¥H³o¨Ç¸ê®Æ¬O¿Ã¹õªº«þ¨©¡D
\begin{tscreen}
\begin{verbatim}
Server:  W20NS.mit.edu
Address:  18.70.0.160

> ai.mit.edu.
Server:  W20NS.mit.edu
Address:  18.70.0.160

Non-authoritative answer:
ai.mit.edu      nameserver = WHEATIES.AI.MIT.EDU
ai.mit.edu      nameserver = ALPHA-BITS.AI.MIT.EDU
ai.mit.edu      nameserver = GRAPE-NUTS.AI.MIT.EDU
ai.mit.edu      nameserver = TRIX.AI.MIT.EDU
ai.mit.edu      nameserver = MUESLI.AI.MIT.EDU

Authoritative answers can be found from:
AI.MIT.EDU      nameserver = WHEATIES.AI.MIT.EDU
AI.MIT.EDU      nameserver = ALPHA-BITS.AI.MIT.EDU
AI.MIT.EDU      nameserver = GRAPE-NUTS.AI.MIT.EDU
AI.MIT.EDU      nameserver = TRIX.AI.MIT.EDU
AI.MIT.EDU      nameserver = MUESLI.AI.MIT.EDU
WHEATIES.AI.MIT.EDU     internet address = 128.52.32.13
WHEATIES.AI.MIT.EDU     internet address = 128.52.35.13
ALPHA-BITS.AI.MIT.EDU   internet address = 128.52.32.5
ALPHA-BITS.AI.MIT.EDU   internet address = 128.52.37.5
GRAPE-NUTS.AI.MIT.EDU   internet address = 128.52.32.4
GRAPE-NUTS.AI.MIT.EDU   internet address = 128.52.36.4
TRIX.AI.MIT.EDU internet address = 128.52.32.6
TRIX.AI.MIT.EDU internet address = 128.52.38.6
MUESLI.AI.MIT.EDU       internet address = 128.52.32.7
MUESLI.AI.MIT.EDU       internet address = 128.52.39.7
\end{verbatim}
\end{tscreen}


©Ò¥H {\ttfamily weaties.ai.mit.edu} ¬O {\ttfamily ai.mit.edu} ªº¤@¥x¦WºÙ¦øªA¾¹:
\begin{tscreen}
\begin{verbatim}
> server WHEATIES.AI.MIT.EDU.
Default Server:  WHEATIES.AI.MIT.EDU
Addresses:  128.52.32.13, 128.52.35.13
\end{verbatim}
\end{tscreen}


²{¦b§Ú§ïÅÜ¬d¸ßªº«¬ºA¡A§Ú­Ì¤w¸g§ä¨ì¸Ó¦WºÙ¦øªA¾¹©Ò¥H²{¦b§Ú­Ì±N­n¸ß°Ý {\ttfamily wheaties} Ãö©ó {\ttfamily prep.ai.mit.edu} ¥¦©Òª¾¹Dªº¥ô¦ó¨Æ±¡¡D
\begin{tscreen}
\begin{verbatim}
> set q=any
> prep.ai.mit.edu.
Server:  WHEATIES.AI.MIT.EDU
Addresses:  128.52.32.13, 128.52.35.13

prep.ai.mit.edu CPU = dec/decstation-5000.25    OS = unix
prep.ai.mit.edu
        inet address = 18.159.0.42, protocol = tcp
         #21 #23 #25 #79
prep.ai.mit.edu preference = 1, mail exchanger = life.ai.mit.edu
prep.ai.mit.edu internet address = 18.159.0.42
ai.mit.edu      nameserver = alpha-bits.ai.mit.edu
ai.mit.edu      nameserver = wheaties.ai.mit.edu
ai.mit.edu      nameserver = grape-nuts.ai.mit.edu
ai.mit.edu      nameserver = mini-wheats.ai.mit.edu
ai.mit.edu      nameserver = trix.ai.mit.edu
ai.mit.edu      nameserver = muesli.ai.mit.edu
ai.mit.edu      nameserver = count-chocula.ai.mit.edu
ai.mit.edu      nameserver = life.ai.mit.edu
ai.mit.edu      nameserver = mintaka.lcs.mit.edu
life.ai.mit.edu internet address = 128.52.32.80
alpha-bits.ai.mit.edu   internet address = 128.52.32.5
wheaties.ai.mit.edu     internet address = 128.52.35.13
wheaties.ai.mit.edu     internet address = 128.52.32.13
grape-nuts.ai.mit.edu   internet address = 128.52.36.4
grape-nuts.ai.mit.edu   internet address = 128.52.32.4
mini-wheats.ai.mit.edu  internet address = 128.52.32.11
mini-wheats.ai.mit.edu  internet address = 128.52.54.11
mintaka.lcs.mit.edu     internet address = 18.26.0.36
\end{verbatim}
\end{tscreen}


©Ò¥H§Ú­Ì±q {\ttfamily .} ¶}©l³sÄò§ä¥X¦b»â°ì¦WºÙ¸Ìªº¤U¤@¼h¦WºÙ¦øªA¾¹¡D
¦pªG§A¨Ï¥Î§A¦Û¤vªº DNS ¦øªA¾¹¦Ó¤£¬O©Ò¦³³o¨Ç­Ó¨ä¥¦ªº¦øªA¾¹¡A
§Aªº {\ttfamily named} ·íµM·|¼È¦s©Ò¦³³o¨Ç¦b¬°§A´M§ä³o­Óµª®×®É©Ò§ä¨ìªº¸ê°T¡A
¦Ó¥B¦b¤@¬q®É¶¡¤º¥¦¤£¥²¦A¦¸¬d°Ý¡D

¤@­Ó¤ñ¸û°_¨Ó«Ü¤Ö³Q½×¤Î¡A¦ý¬O¦P¼Ë­«­nªº¬O {\ttfamily in-addr.arpa} »â°ì¡D¥¦¤]¹³¡¥¥¿±`ªº¡¦»â°ì¤@¼Ë¬O±_ª¬ªº¡D
{\ttfamily in-addr.arpa} Åý§Ú­Ì¥i¥H¦b¾Ö¦³¥D¾÷¦ì§}ªº®É­Ô±oª¾¸Ó¥D¾÷ªº¦WºÙ¡D
¦b³o¸Ì¦³¥ó­«­nªº¨Æ±¡­nª`·Nªº¬O¦b {\ttfamily in-addr.arpa} ³o­Ó»â°ì¤¤ ip ¼Æ¦r¬O¥H¤Ï¦V¶¶§Ç®Ñ¼gªº¡D
¦pªG§A¦³¬Y¥x¾÷¾¹ªº¦ì§}: 192.128.52.43 ¨º»ò {\ttfamily named} ·|¥HÃþ¦ü {\ttfamily prep.ai.mit.edu} ³o­Ó½d¨Òªº¤è¦¡¨Ó³B²z:
§ä¥X {\ttfamily arpa.} ªº¦øªA¾¹¡A§ä¥X {\ttfamily in-addr.arpa.} ªº¦øªA¾¹¡AµM«á¦A§ä¥X {\ttfamily 192.in-addr.arpa.} ªº¦øªA¾¹¡A
§ä¥X {\ttfamily 128.192.in-addr.arpa.} ªº¦øªA¾¹¡A±µµÛ§ä¥X {\ttfamily 52.128.192.in-addr.arpa.} ªº¦øªA¾¹¡A
³Ì«á¦A§ä¥X©Ò»Ý¤§ {\ttfamily 43.52.128.192.in-addr.arpa.} ªº°O¿ý¡DÁo©ú¥G? (»¡¡¥¬Oªº¡¦)¡D
ÀY¨â¦~³o¤Ï¦Vªº¼Æ¦r¤]¤Þ°_¹L¤@¨Ç§xÂZ¡D

¨ä¹ê§Ú¬OÄF§Aªº¡DDNS ¨Ã«D§¹§¹¥þ¥þ¦a¹³§Ú§i¶D§Aªº³o¼Ë¹B§@¡D¦ý¬O³o¤w¸g°÷±µªñªº¤F¡D




\subsection{§Ú­Ì¦Û¤vªº»â°ì}

²{¦b¨Ó©w¸q§Ú­Ì¦Û¤vªº»â°ì¡D§Ú­Ì±N·|³Ð³y¥X {\itshape linux.bogus\/} ³o­Ó»â°ì¨Ã¥B©w¸q¨ä¤¤ªº¾÷¾¹¡D
§Ú¨Ï¥Î¤@­Ó§¹¥þ¬OµêÀÀ¥X¨Óªº»â°ì¦WºÙ¥H«K½T©w§Ú­Ì¤£·|ÂZ¶Ã¨ìºô¸ô¤Wªº¨ä¥¦¦a¤è¡D

§Ú­Ì¦­´N¤w¸g¥H {\ttfamily named.boot} ¸Ìªº³o¤@¦æ¶}©l¤F³o­Ó³¡¥÷ªº³]©w:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
primary         0.0.127.in-addr.arpa            pz/127.0.0
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


½Ðª`·N¦b³o­ÓÀÉ®×¸Ìªº»â°ì¦WºÙµ²§À¨Ã¨S¦³¥[¤W `{\ttfamily .}' ²Å¸¹¡D
²Ä¤@¦æ§â©w¸q {\ttfamily 0.0.127.in-addr.arpa} ªºÀÉ®×©R¦W¬° {\ttfamily pz/127.0.0}¡D
§Ú­Ì¦­¤w¸g«Ø¥ß¤F³o­ÓÀÉ®×¡A¥¦¬O³o¼Ëªº:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@               IN      SOA     linux.bogus. hostmaster.linux.bogus. (
                                1       ; Serial
                                28800   ; Refresh
                                7200    ; Retry
                                604800  ; Expire
                                86400)  ; Minimum TTL
                        NS      ns.linux.bogus.
1                       PTR     localhost.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


½Ðª`·N¦b³o­ÓÀÉ®×¸Ì©Ò¦³ªº§¹¾ã»â°ì¦WºÙµ²§Àªº `{\ttfamily .}' ²Å¸¹¡A³o»P¤W­±´£¨ìªº named.boot ÀÉ®×§Î¦¨¹ï¤ñ¡D
¦³¨Ç¤H³ßÅw¥H {\ttfamily \$ORIGIN} «ü¥O±Ò©l¨C­Ó°Ï°ìÀÉ®×¡A¦ý³o¬O¤£¥²­nªº¡D
¤@­Ó°Ï°ìÀÉ®×ªº°òÂI(´N¬O¨ä©ÒÄÝªº DNS ¶¥¼h¬[ºc¦ì¸m)¬O¦b {\ttfamily named.boot} ÀÉ®×ªº¡¥»â°ì¡¦¦æ¸Ì«ü©wªº¡A
¦b³o­Ó¨Ò¤l¸Ì¬O {\ttfamily 0.0.127.in-addr.arpa}¡D

³o­Ó¡¥°Ï°ìÀÉ®×¡¦¤¤¥]§t¤TºØ¡¥¸ê·½°O¿ý¡¦(resource records, RRs):
¤@­Ó¬O SOA ¸ê·½°O¿ý¡D¤@­Ó¬O NS ¸ê·½°O¿ý¥H¤Î¤@­Ó PTR °O¿ý¡D
SOA ¬O±ÂÅv°_©l(Start Of Authority)ªºÁY¼g¡D`@' ¬O­Ó·N«ä¬°°òÂIªº¯S®í¼Ð°O¡A
¦Ó¦]¬°³o­ÓÀÉ®×ªº¡¥»â°ì¡¦¦æ»¡¬O {\ttfamily 0.0.127.in-addr.arpa} ©Ò¥H²Ä¤@¦æ¹ê»Ú¤W¬O«ü
\begin{tscreen}
\begin{verbatim}
  0.0.127.IN-ADDR.ARPA. IN      SOA ...
\end{verbatim}
\end{tscreen}


NS ¬O¦WºÙ¦øªA¾¹¸ê·½°O¿ý¡A¥¦§i¶D DNS ¤°»ò¾÷¾¹¬O³o­Ó»â°ì {\ttfamily 0.0.127.in-addr.arpa} ªº¦WºÙ¦øªA¾¹¡A¤]´N¬O {\ttfamily ns.linux.bogus}.
¦Ó³Ì«áªº PTR °O¿ý»¡ {\ttfamily 1} (µ¥©ó¬O {\ttfamily 1.0.0.127.IN-ADDR.ARPA}, ¤]´N¬O {\ttfamily 127.0.0.1})ªº¦WºÙ¬O localhost¡D

SOA ³o­Ó°O¿ý¬O{\itshape ©Ò¦³\/}°Ï°ìÀÉ®×ªº§Ç¤å¡A¦Ó¥B¦b¨C¤@­Ó°Ï°ìÀÉ®×¸Ì³£À³¸Ó¦³³o°ß¤@ªº¤@­Ó¡A³Ì¶}ÀYªº°O¿ý¡D
¥¦´y­z¸Ó°Ï°ì¡A¥¦±q¦ó¦Ó¨Ó(¤@¥xºÙ¬° {\ttfamily linux.bogus} ªº¾÷¾¹)¡A½Ö­t³d¨ä¤º®e({\ttfamily hostmaster@linux.bogus})¡A
³o­Ó°Ï°ìÀÉ®×¬O¤°»òª©¥»(serial: 1)¡A¥H¤Î¨ä¥¦¥²¶·°µªº¡A¦³Ãö¼È¦s»P¦¸­n¦WºÙ¦øªA¾¹ªº¨Æ¡D
³Ñ¤UªºÄæ¦ì¦p refresh, retry, expire ¥H¤Î minimum §A¥i¥H¨Ï¥Î³o¥÷¤å¥ó¸Ì©Ò¥Îªº¼Æ¦r¦Ó¥BÀ³¸Ó¤£·|¥X°ÝÃD¡D

²{¦b­«·s°_©l§Aªº {\ttfamily named}(¨Ï¥Î {\ttfamily ndc restart} «ü¥O)¨Ã¨Ï¥Î {\ttfamily nslookup} ¨ÓÀËÅç§Ú­Ì°µ¤F¤°»ò:
\begin{tscreen}
\begin{verbatim}
$ nslookup

Default Server:  localhost
Address:  127.0.0.1

> 127.0.0.1
Server:  localhost
Address:  127.0.0.1

Name:    localhost
Address:  127.0.0.1
\end{verbatim}
\end{tscreen}


©Ò¥H¥¦ºÞ²z±q {\ttfamily 127.0.0.1} ±o¨ì {\ttfamily localhost} ªº¹Lµ{¡A«Ü¦n¡D
²{¦b¶}©l§Ú­Ìªº¥D­n¥ô°È¡A{\ttfamily linux.bogus} ³o­Ó»â°ì¡A
¦b {\ttfamily named.boot} ¸Ì ´¡¤J·sªº¤@¦æ {\ttfamily primary} «ü¥O:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
primary               linux.bogus                     pz/linux.bogus
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ª`·N¡A¦b {\ttfamily named.boot} ÀÉ®×¸Ì»â°ì¦WºÙªºµ²§ÀÁÙ¬O¨S¦³ '{\ttfamily .}' ²Å¸¹¡D

¦b³o­Ó {\ttfamily linux.bogus} °Ï°ìÀÉ®×¸Ì§Ú­Ì±N·|©ñ¤J¤@¨Ç§¹¥þµêÀÀªº¸ê®Æ:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
;
; Zone file for linux.bogus
;
; Mandatory minimum for a working domain
;
@       IN      SOA     linux.bogus. hostmaster.linux.bogus. (
                        199511301       ; serial, todays date + todays serial #
                        28800           ; refresh, seconds
                        7200            ; retry, seconds
                        3600000         ; expire, seconds
                        86400 )         ; minimum, seconds
                NS      ns.linux.bogus.
                NS      ns.friend.bogus.
                MX      10 mail.linux.bogus   ; Primary Mail Exchanger
                MX      20 mail.friend.bogus. ; Secondary Mail Exchanger

localhost       A       127.0.0.1
ns              A       127.0.0.2
mail            A       127.0.0.4
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Ãö©ó SOA °O¿ý¦³¨â¥ó¨Æ»Ý­nª`·N¡D­º¥ý {\ttfamily ns.linux.bogus} {\itshape ¥²¶·\/} ¬O¤@¥x¨ã¦³ A °O¿ýªº¯u¥¿¾÷¾¹¡D
¦b SOA °O¿ý¤¤¥Î CNAME °O¿ý¬°¦WºÙªº¾÷¾¹¬O¤£¦Xªkªº¡D¥¦ªº¦W¦r¤£¤@©w­n¬O {\ttfamily ns}¡A¥¦¥i¥H¬O¥ô¦ó¦Xªkªº¥D¾÷¦WºÙ¡D
¦A¨Ó¡A{\ttfamily hostmaster.linux.bogus} À³¸Ó³Qµø¬° {\ttfamily hostmaster@linux.bogus}¡A³oÀ³¸Ó¬O¤@­Ó¶l¥ó¦ì§}©Î§O¦W¡A
¬OºûÅ@³o­Ó DNS ªº¤H¸g±`Åª«Hªº¦ì§}¡D¥ô¦óÃö©ó¦¹»â°ìªº«H¥ó·|³Q°e¨ì³o­Ó¦ì§}¡D
¥¦ªº¦W¦r¤£¤@©w­n¬O {\ttfamily hostmaster}¡A¥¦¥i¥H¬O¥ô¦ó¦Xªkªº¹q¤l¶l¥ó¦ì§}¡AµM¦Ó³o­Ó¦ì§} `{\ttfamily hostmaster}' {\itshape À³¸Ó\/}¯à¤u§@¥¿±`¡D

¦b³o­ÓÀÉ®×¸Ì¦³¤@ºØ·sªº¸ê·½°O¿ý«¬ºA¡A§Y MX «¬ºA¡A©Î¬O¶l¥ó¥æ´«ªÌ¸ê·½°O¿ý(Mail eXchanger RR)¡D
³oºØ¸ê·½°O¿ý«¬ºA§i¶D¶l»¼¨t²Î¦a§} {\ttfamily someone@linux.bogus} ªº¶l¥ó­n±H°e¨ì­þ¸Ì¡A
´«¥y¸Ü»¡¤]´N¬OÀ³¸Ó±H°e¨ì {\ttfamily mail.linux.bogus} ©Î¬O {\ttfamily mail.friend.bogus}¡D
¦b¨C­Ó¾÷¾¹¦WºÙ«e­±ªº¼Æ¦r¬O MX ¸ê·½°O¿ýªºÀu¥ýÅv¡A¼Æ¦r¤ñ¸û§C (10) ªº¸ê·½°O¿ý¬O¶l¥ó¥D­nÀ³¸Ó±H©¹ªº¾÷¾¹¡D
¦pªG¥¢±Ñ¥i¥H§â¥¦±H©¹¼Æ¦r¤ñ¸û°ªªº¾÷¾¹¡A¤@¥x¦¸­nªº¶l¥ó³B²zªÌ¡A¤]´N¬O¦b³o¸Ì¨ã¦³Àu¥ýÅv 20 ªº {\ttfamily mail.friend.bogus}¡D

¥Î {\ttfamily ndc restart} ­«·s°_©l {\ttfamily named}¡D¥H {\ttfamily nslookup} ÀËÅçµ²ªG:
\begin{tscreen}
\begin{verbatim}
$ nslookup
> set q=any
> linux.bogus
Server:  localhost
Address:  127.0.0.1

linux.bogus
        origin = linux.bogus
        mail addr = hostmaster.linux.bogus
        serial = 199511301
        refresh = 28800 (8 hours)
        retry   = 7200 (2 hours)
        expire  = 604800 (7 days)
        minimum ttl = 86400 (1 day)
linux.bogus     nameserver = ns.linux.bogus
linux.bogus     nameserver = ns.friend.bogus
linux.bogus     preference = 10, mail exchanger = mail.linux.bogus.linux.bogus
linux.bogus     preference = 20, mail exchanger = mail.friend.bogus
linux.bogus     nameserver = ns.linux.bogus
linux.bogus     nameserver = ns.friend.bogus
ns.linux.bogus  internet address = 127.0.0.2
mail.linux.bogus        internet address = 127.0.0.4
\end{verbatim}
\end{tscreen}


¤p¤ß¦aÀËÅç§A±N·|µo²{¤@­Ó¿ù»~¡D³o¤@¦æ
\begin{tscreen}
\begin{verbatim}
  linux.bogus     preference = 10, mail exchanger = mail.linux.bogus.linux.bogus
\end{verbatim}
\end{tscreen}

¥þ³£¿ù¤F¡D¥¦À³¸Ó¬O
\begin{tscreen}
\begin{verbatim}
  linux.bogus     preference = 10, mail exchanger = mail.linux.bogus
\end{verbatim}
\end{tscreen}


§Ú¬G·N¥Ç¤F­Ó¿ù»~©Ò¥H§A¥i¥HÂÇ¦¹¾Ç²ß:-) ¥J²Ó¬Ý¬Ý¸Ó°Ï°ìÀÉ®×§Ú­Ì·|µo²{³o¤@¦æ
\begin{tscreen}
\begin{verbatim}
@              MX      10 mail.linux.bogus     ; Primary Mail Exchanger
\end{verbatim}
\end{tscreen}

¿òº|¤F¤@­Ó¥yÂI¡D©Î¬O»¡¦h¤F­Ó `{\ttfamily linux.bogus}'¡D
¦b°Ï°ìÀÉ®×¸Ì¦pªG¤@­Ó¾÷¾¹¦WºÙ¤£¬O¥H¥yÂIµ²§À¨º»ò·|¦b¨äµ²§À¥[¤J°òÂI¡D©Ò¥H¤£½×¬O

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@              MX      10 mail.linux.bogus.    ; Primary Mail Exchanger
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


©Î¬O

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@              MX      10 mail                 ; Primary Mail Exchanger
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


³£¬O¥¿½Tªº¡D§Ú¤ñ¸û³ßÅw«á­±³oºØ§Î¦¡¡A¥¦»Ý­nªº¥´¦r¤ñ¸û¤Ö¡D
¦b¤@­Ó°Ï°ìÀÉ®×¸Ì»â°ì¦WºÙÀ³¸Ó­n¤£´N¬O¼g¥X¨Ó¨Ã¥H `{\ttfamily .}'  µ²§À©ÎªÌ´N¬O¤@ÂI³£¤£­n¥]§t¶i¥h¡A
¦Ó¦b³oºØ±¡ªp¤U¨ä»â°ì¹w³]¬°°òÂI¡D¨ä¥¦¤H¤]³\³ßÅw±Ä¥Î¥t¤@ºØ¤è¦¡¡D

§Ú¥²¶·±j½Õªº¬O¦b {\ttfamily named.boot} ÀÉ®×¸Ì»â°ì¦WºÙ«á­±{\itshape ¤£À³¸Ó\/}¦³ `{\ttfamily .}'  ªº¦s¦b¡D
§A¤£ª¾¹D¦³¦h¤Ö¦¸¦]¬°¦h¤F©Î¤Ö¤F¤@­Ó `{\ttfamily .}'  ¦Ó·d¯{¤F¨Ã¥B¹ï³\¦h¤H³y¦¨§xÂZ¡D

©Ò¥H¦b¥[¤J§Ú±j½Õªº­«ÂI«á±o¨ì¤@¥÷·sªº°Ï°ìÀÉ®×¡A¨ä¤¤ÁÙ¥]§t¤@¨ÇÃB¥~ªº¸ê°T:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
;
; Zone file for linux.bogus
;
; Mandatory minimum for a working domain
;
@       IN      SOA     linux.bogus.    hostmaster.linux.bogus. (
                        199511301       ; serial, todays date + todays serial #
                        28800           ; refresh, seconds
                        7200            ; retry, seconds
                        604800          ; expire, seconds
                        86400 )         ; minimum, seconds

                NS      ns              ; Inet Address of name server
                NS      ns.friend.bogus.
                MX      10 mail         ; Primary Mail Exchanger
                MX      20 mail.friend.bogus. ; Secondary Mail Exchanger

localhost       A       127.0.0.1
ns              A       127.0.0.2
mail            A       127.0.0.4
;
; Extras
;
@               TXT     "Linux.Bogus, your DNS consultants"

ns              MX      10 mail
                MX      20 mail.friend.bogus.
                HINFO   "Pentium" "Linux 1.2"
                TXT     "RMS"
richard         CNAME   ns
www             CNAME   ns

donald          A       127.0.0.3
                MX      10 mail
                MX      20 mail.friend.bogus.
                HINFO   "i486"  "Linux 1.2"
                TXT     "DEK"

mail            MX      10 mail
                MX      20 mail.friend.bogus.
                HINFO   "386sx" "Linux 1.0.9"

ftp             A       127.0.0.5
                MX      10 mail
                MX      20 mail.friend.bogus.
                HINFO   "P6" "Linux 1.3.59"
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


§A¤]³\·|·Q­n²¾°Ê«e­±¤T­Ó A  °O¿ý¥H«KÅý¥¦­Ì¾aªñ¨ä¥¦ªº¬ÛÃö°O¿ý¡A¦Ó¤£¬O¹³³o¼Ë©ñ¦b³Ì«eºÝ¡D

³o¸Ì¦³´X­Ó·sªº¸ê·½°O¿ý: ¥D¾÷¸ê°T(HINFO: Host INFOrmation) ¥]¬A¨â­Ó³¡¥÷¡A
¨Ï¥Î¤Þ¸¹²[¬A¨C­Ó³¡¥÷¬O­Ó¦n²ßºD¡D²Ä¤@­Ó³¡¥÷¬O¾÷¾¹¤WªºµwÅé©Î¬O¤¤¥¡³B²z³æ¤¸¡A
¦Ó²Ä¤G­Ó³¡¥÷¬O¾÷¾¹¤Wªº³nÅé©Î¬O§@·~¨t²Î¡D{\ttfamily ns} ¦³¤@Áû Pentium CPU ¨Ã¥B°õ¦æ Linux 1.2 ¨t²Î¡D
TXT °O¿ý¬O­ÓÀH·Nªº¤å¦r°O¿ý¡A§A¥i¥H¥Î¥¦¨Ó°O¿ý¥ô¦ó¨Æ±¡¡D
¥¿¦¡¦WºÙ(CNAME: Canonical NAME)¥i¥H¥Î¨Óµ¹¨C¥x¾÷¾¹¼Æ­Ó¦WºÙ¡D
©Ò¥H {\ttfamily richard} ¥H¤Î {\ttfamily www} ³£¬O {\ttfamily ns} ªº¤@­Ó§O¦W¡D
«Ü­«­nªº¤@ÂI¬O A, MX, CNAME, ¥H¤Î SOA °O¿ý{\itshape ¥Ã»·¤£¸Ó\/}°Ñ·Ó CNAME °O¿ý³]©wªº§O¦W¡A
¥¦­Ì¥uÀ³¸Ó°Ñ·Ó A °O¿ý©Ò³]©wªº¦WºÙ¡A©Ò¥H¹³³o¼Ëªº°O¿ý¬O¿ùªº

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
foobar  CNAME   richard                 ; NO!
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¤£¹L³o¼Ë¬O¹ïªº

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
foobar  CNAME   ns                      ; Yes!
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ÁÙ¦³¤@ÂI¤]«Ü­«­nªº¬Oª`·N¥¿¦¡¦WºÙ©Ò³]©wªº¹ï¹q¤l¶l»¼¦ì§}¦Ó¨¥¤£¬O¦Xªk¥D¾÷¦WºÙ: 
{\ttfamily webmaster@www.linux.bogus} ¥H¤W­±ªº³]©w¦Ó¨¥¬O¤@­Ó¤£¦Xªkªº¹q¤l¶l»¼¦ì§}¡D
§Y¨Ï¥¦¦b§Aªº¨t²Î¤W¥i¥H¹B§@¡A¥i¥H¹w®Æªº¬O«Ü¤Ö¦³¹q¤l¶l¥óºÞ²zªÌ·|¥h¹ê¦æ³o¶µ³W«h¡D
Á×§K³o­Ó°ÝÃDªº¤èªk¬O¨Ï¥Î A °O¿ý(©ÎªÌ¤]¥i¯à¬O¤@¨Ç¨ä¥¦ªº¡A¹³¬O MX °O¿ý)¨Ó¨ú¥N¤§:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
www     A       127.0.0.2
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Paul Vixie, ¥D­nªº {\ttfamily named} ±M®a¡A«ØÄ³{\itshape ¤£­n\/}¨Ï¥Î CNAME ³o­Ó³]©w¡D
©Ò¥HÀ³¸Ó¦Ò¼{¤£­n{\itshape «Ü\/}»{¯u¦a¥h¨Ï¥Î¥¦¡D

ÂÇ¥Ñ°õ¦æ {\ttfamily ndc reload} ¸ü¤J·sªº¸ê®Æ®w¡A³o·|¨Ï {\ttfamily named} ¦A¤@¦¸Åª¨ú¨äÀÉ®×¡D
\begin{tscreen}
\begin{verbatim}
$ nslookup
Default Server:  localhost
Address:  127.0.0.1

> ls -d linux.bogus
\end{verbatim}
\end{tscreen}


³o·N«üÀ³¸Ó¦C¥X©Ò¦³ªº°O¿ý
\begin{tscreen}
\begin{verbatim}
[localhost]
 linux.bogus.                   SOA   ns.linux.bogus hostmaster.linux.bogus. (199511301 28800 7200 604800 86400)
 linux.bogus.                   NS    ns.linux.bogus                
 linux.bogus.                   NS    ns.friend.bogus               
 linux.bogus.                   MX    10   mail.linux.bogus
 linux.bogus.                   MX    20   mail.friend.bogus
 linux.bogus.                   TXT   "Linux.Bogus, your DNS consultants"
 localhost                      A     127.0.0.1
 mail                           A     127.0.0.4
 mail                           MX    10   mail.linux.bogus
 mail                           MX    20   mail.friend.bogus
 mail                           HINFO 386sx       Linux 1.0.9
 donald                         A     127.0.0.3
 donald                         MX    10   mail.linux.bogus
 donald                         MX    20   mail.friend.bogus
 donald                         HINFO i486        Linux 1.2
 donald                         TXT   "DEK"
 www                            CNAME ns.linux.bogus
 richard                        CNAME ns.linux.bogus
 ftp                            A     127.0.0.5
 ftp                            MX    10   mail.linux.bogus
 ftp                            MX    20   mail.friend.bogus
 ftp                            HINFO P6          Linux 1.3.59
 ns                             A     127.0.0.2
 ns                             MX    10   mail.linux.bogus
 ns                             MX    20   mail.friend.bogus
 ns                             HINFO Pentium     Linux 1.2
 ns                             TXT   "RMS"
 linux.bogus.                   SOA   ns.linux.bogus hostmaster.linux.bogus. (199511301 28800 7200 604800 86400)
\end{verbatim}
\end{tscreen}


«Ü¦n¡DÅý§Ú­ÌÀË¬d¥¦¹ï©ó³æ¿Wªº {\ttfamily www} ·|»¡¤°»ò:
\begin{tscreen}
\begin{verbatim}
> set q=any
> www.linux.bogus.
Server:  localhost
Address:  127.0.0.1

www.linux.bogus canonical name = ns.linux.bogus
\end{verbatim}
\end{tscreen}


...´«¥y¸Ü»¡¡A{\ttfamily www.linux.bogus} ¯u¥¿ªº¦WºÙ¬O {\ttfamily ns.linux.bogus}¡D
\begin{tscreen}
\begin{verbatim}
linux.bogus     nameserver = ns.linux.bogus
linux.bogus     nameserver = ns.friend.bogus
ns.linux.bogus  internet address = 127.0.0.2
\end{verbatim}
\end{tscreen}


¦Ó {\ttfamily ns.linux.bogus} ¾Ö¦³ 127.0.0.2 ³o­Ó¦ì§}¡D¬Ý°_¨Ó¤]«Ü¦n¡D




\subsection{Ä~Äò²`¤J}

·íµM¡A³o­Ó»â°ì¬O°ª«×µêÀÀªº¡A¸Ì­±©Ò¦³ªº¦ì§}¤]³£¬O¡A¦Ó³o©Î³\·|Åý§A¦³¨Ç²V²c¡D
¯u¹ê»â°ìªº¤@­Ó¯u¹ê¨Ò¤l½Ð¨£¤U¤@¸`¡D




\section{¯u¹ê»â°ìªº¨Ò¤l\label{real-example}}

{\bfseries ³o¸Ì§Ú­Ì¦C¥X¤@¨Ç{\itshape ¯u¥¿\/}ªº°Ï°ìÀÉ®×}

¨Ï¥ÎªÌ«ØÄ³§Ú¥[¤W¤@­Ó¥i¥H¹B§@ªº¯u¹ê¨Ò¤l¡A¦]¬°§Ú¹ï¯u¥¿¥i¹B§@ªº»â°ì¤ÎµêÀÀ½d¨Ò¤§¶¡®t§O¸ÑÄÀªº¤£°÷²M·¡¡D

Ãö©ó³o­Ó¨Ò¤l¦³¥ó¨Æ¥²¶·Án©ú: {\itshape ¤d¸U¤£­n\/}§â¥¦©ñ¨ì§Aªº¦WºÙ¦øªA¾¹¤W!
§â¥¦·í§@°Ñ¦Ò¸ê®Æ¨Ó¾\Åª´N¦n¡D¦pªG§A·Q°µ¹êÅç¡A¥Î¤W­±µêÀÀªº¨Ò¤l¡D
§Ú¸g¹L LAND-5 ªº David Bullock ªº¦P·N¤~¨Ï¥Î³o­Ó¨Ò¤l¡D³o¨ÇÀÉ®×ªº¤é´Á¬O 1996 ¦~¤E¤ë¤G¤Q¤é¡A
¦]¦¹¦pªG§A²{¦b¬d¸ß LAND-5 ªº¦WºÙ¦øªA¾¹¥i¯à·|µo²{¦³©Ò¤£¦P¡D
ÁÙ¦³¡A½Ð°O¦í¡A§R¥h«e­±ªºªÅ¥Õ :-)




\subsection{/etc/named.boot (©Î /var/named/named.boot)}

§Ú­Ìµo²{»Ý­n¨â¦æ {\ttfamily primary} ªº¤Ï¦V°Ï°ì: ¤@­Ó¬O {\ttfamily 127.0.0}¡A¥t¤@­Ó¬O LAND-5 ªº¤lºô¸ô {\ttfamily 206.6.177}¡D
ÁÙ¦³¤@¦æµ¹ {\ttfamily land-5.com} ªº¥¿¦V°Ï°ì¡DÁÙ¦³¤@ÂI­nª`·Nªº¬O¤£¹³§Ú¦b³o½g¤å³¹¸Ì±NÀÉ®×©ñ¦b {\ttfamily pz} ¥Ø¿ý¸Ì¡A
¥L±N¥¦­Ì©ñ¨ì¥s°µ {\ttfamily zone} ªº¥Ø¿ý¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
;  Boot file for LAND-5 name server
;
directory /var/named
;
; type          domain                          source file or host
cache           .                               root.cache
primary         0.0.127.in-addr.arpa            zone/127.0.0
primary         177.6.206.in-addr.arpa          zone/206.6.177
primary         land-5.com                      zone/land-5.com
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}





\subsection{/var/named/root.cache}

°O¦í³o­ÓÀÉ®×¬O°ÊºAªº¡A³oÃä¦C¥X¨Óªº¬OÂÂªº¡D§A³Ì¦n¦Û¤v¥Î {\ttfamily dig} ²£¥Í¤@­Ó·sªº¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
; <<>> DiG 2.1 <<>> 
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6
;; flags: qr rd ra; Ques: 1, Ans: 9, Auth: 0, Addit: 9
;; QUESTIONS:
;;      ., type = NS, class = IN

;; ANSWERS:
 .       518357  NS      H.ROOT-SERVERS.NET.
 .       518357  NS      B.ROOT-SERVERS.NET.
 .       518357  NS      C.ROOT-SERVERS.NET.
 .       518357  NS      D.ROOT-SERVERS.NET.
 .       518357  NS      E.ROOT-SERVERS.NET.
 .       518357  NS      I.ROOT-SERVERS.NET.
 .       518357  NS      F.ROOT-SERVERS.NET.
 .       518357  NS      G.ROOT-SERVERS.NET.
 .       518357  NS      A.ROOT-SERVERS.NET.

;; ADDITIONAL RECORDS:
H.ROOT-SERVERS.NET.     165593  A       128.63.2.53
B.ROOT-SERVERS.NET.     165593  A       128.9.0.107
C.ROOT-SERVERS.NET.     222766  A       192.33.4.12
D.ROOT-SERVERS.NET.     165593  A       128.8.10.90
E.ROOT-SERVERS.NET.     165593  A       192.203.230.10
I.ROOT-SERVERS.NET.     165593  A       192.36.148.17
F.ROOT-SERVERS.NET.     299616  A       192.5.5.241
G.ROOT-SERVERS.NET.     165593  A       192.112.36.4
A.ROOT-SERVERS.NET.     165593  A       198.41.0.4

;; Total query time: 250 msec
;; FROM: land-5 to SERVER: default ---- 127.0.0.1
;; WHEN: Fri Sep 20 10:11:22 1996
;; MSG SIZE  sent: 17  rcvd: 312
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}





\subsection{/var/named/zone/127.0.0}

¤£¹L¬O°ò¥»ªº¡A¤£¯à¬Ù²¤ªº SOA °O¿ý¡A¥H¤Î±N {\ttfamily 127.0.0.1} «ü¦V {\ttfamily localhost} ªº°O¿ý¡D
¨âªÌ³£¬O¥²¶·ªº¡D¤£À³¦³¨ä¥¦ªºªF¦è¦b¦¹ÀÉ®×¤¤¡D³o­ÓÀÉ®×¥i¯à¥Ã»·¤£¥²§ó·s¡A°£«D§Aªº¦WºÙ¦øªA¾¹©ÎºÞ²z¤H¦a§}§ïÅÜ¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@               IN      SOA     land-5.com. root.land-5.com. (
                                199609203       ; Serial
                                28800   ; Refresh
                                7200    ; Retry
                                604800  ; Expire
                                86400)  ; Minimum TTL
                        NS      land-5.com.
        
1                       PTR     localhost.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}





\subsection{/var/named/zone/land-5.com}

¦b³o¸Ì§Ú­Ì¬Ý¨ì³o­Ó¥²¶·ªº SOA °O¿ý¡A¥²­nªº NS °O¿ý¡D
§Ú­Ì¥i¥H¬Ý¨ì¥¦¦³¤@­Ó¦¸­nªº¦WºÙ¦øªA¾¹©ó {\ttfamily ns2.psi.net}¡D
³o¤]À³¸Ó¬O¥²­nªº¡A{\itshape Á`¬O\/}«O¦³¤@­Ó¦¸­nªº¦øªA¾¹°µ¬°³Æ¥÷¡D
§Ú­ÌÁÙ¬Ý¨ì°µ¬° LAND-5 ­t³d©Ò¦³¤£¦PªA°Èªº¥D¾÷¡A¥¦¥H³\¦hªº CNAME °O¿ý°µ¨ì³oÂI
(¥t¤@­Ó°µªk¬O¥Î A °O¿ý)¡D

´N¹³§A±q SOA °O¿ý¬Ý¨ìªº¤@¼Ë¡A°Ï°ìÀÉ®×¥H {\ttfamily land-5.com} ¶}©l¡AºÞ²z¤H¬O {\ttfamily root@land-5.com}¡D
§Ç¸¹(serial)¥H yyyymmdd ªº®æ¦¡¥[¤W·í¤Ñªº¸¹½X; ¥¦¥i¯à¬O 1996 ¦~¤E¤ë¤G¤Q¸¹¨º¤Ñªº²Ä¤»­Óª©¥»ªº°Ï°ìÀÉ®×¡D
½Ð°O¦í§Ç¸¹{\itshape ¥²¶·\/}³æ½Õ¦a»¼¼W¡A³o¸Ì¥¦¥u¥Î{\itshape ¤@¦ì\/}¼Æ¦rªí¥Ü·í¤Ñªº¸¹½X¡A
¦]¦¹¦b½s¿è¤E¦¸¤§«á¥L¥²¶·µ¥¨ì©ú¤Ñ¤~¯à¦A½s¿è³o­ÓÀÉ®×¡D{[}{\ttfamily Ä¶µù}]
¦]¦¹À³¸Ó¦Ò¼{¥Î¨â¦ì¼Æ¦r¡D
\begin{tscreen}
\begin{description}
\item[{[}Ä¶µù{]}] \mbox{}

ÅªªÌ¥i¯à·|©_©Ç¬°¤°»ò¤£¯à¥Î 1996092010 ? ³o­Ó¼Æ¦r¤]¬O»¼¼Wªº¡A©Ò¥H·íµM¥i¥H¡D
¦ý¨ì¤F©ú¤Ñ²Ä¤@¦¸½sÀÉ®×®É¸Ó¥Î¤°»ò©O? ¦pªG¥Î 199609211¡A¨º»ò³o­Ó¼Æ¦r´N¤ñ 1996092010 ­n¤p¤F¡D
³o¼Ë·|¦³³Â·Ð¡D¦]¦¹§@ªÌ«ØÄ³À³¥Î¨â¦ì¼Æ¦r¡A¦p 1996092006¡D 

\end{description}
\end{tscreen}


\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@       IN      SOA     land-5.com. root.land-5.com. (
                        199609206       ; serial, todays date + todays serial #
                        10800           ; refresh, seconds
                        7200            ; retry, seconds
                        10800           ; expire, seconds
                        86400 )         ; minimum, seconds
                NS      land-5.com.
                NS      ns2.psi.net.
                MX      10 land-5.com.  ; Primary Mail Exchanger

localhost       A       127.0.0.1

router          A       206.6.177.1
        
land-5.com.     A       206.6.177.2
ns              CNAME   land-5.com.
ftp             CNAME   land-5.com.
www             CNAME   land-5.com.
mail            CNAME   land-5.com.
news            CNAME   land-5.com.

funn            A       206.6.177.3
illusions       CNAME   funn.land-5.com.
@               TXT     "LAND-5 Corporation"

;
;       Workstations
;
ws_177200       A       206.6.177.200
                MX      10 land-5.com.   ; Primary Mail Host
ws_177201       A       206.6.177.201
                MX      10 land-5.com.   ; Primary Mail Host
ws_177202       A       206.6.177.202
                MX      10 land-5.com.   ; Primary Mail Host
ws_177203       A       206.6.177.203
                MX      10 land-5.com.   ; Primary Mail Host
ws_177204       A       206.6.177.204
                MX      10 land-5.com.   ; Primary Mail Host
ws_177205       A       206.6.177.205
                MX      10 land-5.com.   ; Primary Mail Host
; {Many repetitive definitions deleted - SNIP}
ws_177250       A       206.6.177.250
                MX      10 land-5.com.   ; Primary Mail Host
ws_177251       A       206.6.177.251
                MX      10 land-5.com.   ; Primary Mail Host
ws_177252       A       206.6.177.252
                MX      10 land-5.com.   ; Primary Mail Host
ws_177253       A       206.6.177.253
                MX      10 land-5.com.   ; Primary Mail Host
ws_177254       A       206.6.177.254
                MX      10 land-5.com.   ; Primary Mail Host
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¥t¤@¥ó­È±oª`·Nªº¨Æ©Ò¦³ªº¤u§@¯¸³£¨S¦³­Ó§Oªº¦WºÙ¡A¦Ó¬O¥Î¤@¶}ÀY¥[¤W³Ì«á¨â¦ìªº IP ¼Æ¦r¡D
¥Î³o¼ËªººD¨Ò¥i¥H¤j¶q¦aÂ²¤ÆºûÅ@¤u§@¡A¦ý¥i¯à¦³ÂI¤£¤è«K¡A¦Ó¥B¡A¨Æ¹ê¤W¥i¯à¬O§Aªº«È¤á¤£º¡ªº¨Ó·½¡D




\subsection{/var/named/zone/206.6.177}

§Ú±N¦b«á­±»¡©ú³o­ÓÀÉ®×¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
@               IN      SOA     land-5.com. root.land-5.com. (
                                199609206       ; Serial
                                28800   ; Refresh
                                7200    ; Retry
                                604800  ; Expire
                                86400)  ; Minimum TTL
                        NS      land-5.com.
                        NS      ns2.psi.net.
;
;       Servers
;
1       PTR     router.land-5.com.
2       PTR     land-5.com.
3       PTR     funn.land-5.com.
;
;       Workstations
;
200     PTR     ws_177200.land-5.com.
201     PTR     ws_177201.land-5.com.
202     PTR     ws_177202.land-5.com.
203     PTR     ws_177203.land-5.com.
204     PTR     ws_177204.land-5.com.
205     PTR     ws_177205.land-5.com.
; {Many repetitive definitions deleted - SNIP}
250     PTR     ws_177250.land-5.com.
251     PTR     ws_177251.land-5.com.
252     PTR     ws_177252.land-5.com.
253     PTR     ws_177253.land-5.com.
254     PTR     ws_177254.land-5.com.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¤Ï¦V°Ï°ì¦ü¥G¬O¾ã­Ó³]©w¤¤³ÌÅý¤HÀYµhªº³¡¥÷¡D¥¦¬O¦b§A¦³¾÷¾¹ªº IP ¼Æ¦r®É¬d¸ß¾÷¾¹¦WºÙ¥Îªº¡D
¨Ò¦p: §A¦³¤@³¡ irc ¦øªA¾¹±µ¨ü irc «È¤áºÝªº³s½u¡D
¦ý§A¬O®¿«Âªº¦øªA¾¹¦]¦¹§A¥u§Æ±æ±µ¨ü¨Ó¦Û®¿«Â¤Î¨ä¥¦´µ³ô¦a¨ººû¨È°ê®aªº³s½u¡D
·í§A±µ¨ì¨Ó¦Û«È¤áºÝªº³s½u®É C µ{¦¡®w¯à°÷§i¶D§A³s½u¾÷¾¹ªº IP ¦ì§}¡A¦]¬°«È¤áºÝªº IP ¼Æ¦r¬O¥]§t¦b¶Ç¤Jªººô¸ô«Ê¥]¤¤ªº¡D
µM«á§A¥i¥H©I¥s¤@¨ç¦¡ {\ttfamily gethostbyaddr} ¥Hµ¹©wªº IP ¬d¸ß¾÷¾¹¦WºÙ¡D
{\ttfamily gethostbyaddr} ¨ç¦¡·|¦V DNS ¸ß°Ý¡ADNS ´N·|¥X¥h¬d¸ß³o¥x¾÷¾¹¦WºÙ¡D
°²³]«È¤áºÝ¨Ó¦Û {\ttfamily ws\_177200.land-5.com}¡AC µ{¦¡®w´£¨Ñµ¹ irc ¦øªA¾¹ªº IP ¬O {\ttfamily 206.6.177.200}¡D
¬°§ä¥X¾÷¾¹ªº¦WºÙ§Ú­Ì­n¬d¸ß {\ttfamily 200.177.6.206.in-addr.arpa}¡DDNS ¦øªA¾¹­º¥ý§ä¨ì­t³d {\ttfamily arpa.} ªº¦øªA¾¹¡D
µM«á§ä¨ì {\ttfamily in-addr.arpa.} ªº¦øªA¾¹¡A¦A¨Ó¬O¤Ï¹L¨Óªº {\ttfamily 206}¡AµM«á¬O {\ttfamily 6}¡A
³Ì«á§ä¨ì¦b LAND-5 ­t³d {\ttfamily 177.6.206.in-addr.arpa} °Ï°ìªº¦øªA¾¹¡D
¥Ñ¦¹§Ú­Ì±o¨ì {\ttfamily 200.177.6.206.in-addr.arpa} ªºµª®×¬O '{\ttfamily PTR ws\_177200.land-5.com}' °O¿ý¡A
·N«ü¾Ö¦³ IP {\ttfamily 206.6.177.200} ªº¦WºÙ¬O {\ttfamily ws\_177200.land-5.com}¡D
¤£¹L´N¹³¦b¸ÑÄÀ {\ttfamily prep.ai.mit.edu} ¦p¦ó¬d¸ß®É©Ò»¡¡A³o¹Lµ{µy·L¦³ÂI¤£¹ï¡D

¦^¨ì irc ¦øªA¾¹ªº¨Ò¤l¡Dirc ¦øªA¾¹¥u±µ¦A¨Ó¦Û´µ³ô¦a¨ººû¨È°ê®aªº³s½u¡A¤]´N¬O¡A
*.no, *.se, *.dk¡D{\ttfamily ws\_177200.land-5.com} ³o­Ó¦W¦rÅãµM¨Ã¤£²Å¦X¥ô¦ó³o¨Ç¡D
¦]¦¹¦øªA¾¹·|©Úµ´³s½u¡D¦pªG{\itshape ¨S¦³\/}¸g¥Ñ {\ttfamily in-addr.arpa} °Ï°ì¨ì {\ttfamily 206.2.177.200} ªº¤Ï¦V¹ïÀ³¡A
¦øªA¾¹±NµLªk¬d¨ì¾÷¾¹¦WºÙ¦Ó±N·|®³ {\ttfamily 206.2.177.200} ¨Ó©M *.no, *.se ¤Î *.dk ¤ñ¸û¡A·íµM§ä¤£¨ì²Å¦Xªº¡D

¦³¨Ç¤H·|§i¶D§A¤Ï¦V¹ïÀ³¬d¸ß¥u¹ï¦øªA¾¹­«­n¡A©Î¬O¤@ÂI¤]¤£­«­n¡D
·íµM¤£¬O: ³\¦h ftp, news, irc ¬Æ¦Ü http ¦øªA¾¹±N{\itshape ¤£\/}±µ¨üµLªk¬d¨ì¦WºÙªº¾÷¾¹³s½u¡D
¦]¦¹¨Æ¹ê¤W¾÷¾¹ªº¤Ï¦V¦WºÙ¹ïÀ³¬O{\itshape ¥²¶·\/}ªº¡D




\section{ºûÅ@¤u§@\label{maint}}

{\bfseries ºû«ù¥¦ªº¹B§@¡D}

ºû«ù¥¦­ÌªºÄ~Äò°õ¦æ¤§¥~¡A¹ï©ó {\ttfamily named} §AÁÙ¦³­ÓºûÅ@ªº¥ô°È±o­n°µ¡D
¨º´N¬Oºû«ù {\ttfamily root.cache} ÀÉ®×ªº§ó·s¡D³ÌÂ²³æªº¤èªk¬O¨Ï¥Î {\ttfamily dig} µ{¦¡¡A
­º¥ý¤£¥[¥ô¦ó°Ñ¼Æ°õ¦æ {\ttfamily dig} µ{¦¡¡A§A±N·|¨ú±o±q§A¦Û¤v¦øªA¾¹±o¨ìªº {\ttfamily root.cache}¡D
µM«á¥H {\ttfamily dig @rootserver . ns} ¬d°Ý©Ò¦C¥Xªº®Ú¦øªA¾¹¨ä¤¤¤§¤@¡D
§A±N·|ª`·N¨ì³o¥÷¿é¥X¬Ý°_¨Ó«D±`¦a¹³¤@­Ó {\ttfamily root.cache} ÀÉ®×¡A°£¤F¤@°ïÃB¥~ªº¼Æ¦r¥H¥~¡D³o¨Ç¼Æ¦r¤£·|¦³¤°»ò§«Ãª¡D
§â¥¦¦s©ñ¨ìÀÉ®×¸Ì({\ttfamily dig @e.root-servers.net . ns $>$root.cache.new})¨Ã¥B¥Î¥¦¨Ó¨ú¥N­ì¥»ÂÂªº {\ttfamily root.cache} ÀÉ®×¡D

¨ú¥N¤F­ì¥ýªºÀÉ®×¤§«á­n°O±o­«·s±Ò°Ê {\ttfamily named} µ{¦¡¡D

Al Longyear ±Hµ¹§Ú³o­Ó«ü¥O½Z¡A¥¦¥i¥H¦Û°Ê°õ¦æ¨Ó§ó·s {\ttfamily named.cache}¡A¬°¥¦¦w¸Ë­Ó crontab ¶µ¥ØµM«á§Ñ¤F¥¦¡D
³o­Ó«ü¥O½Z°²³]§Aªº¹q¤l¶l¥ó¥i¥H¹B§@¦Ó¥B `hostmaster' ³o­Ó¶l¥ó§O¦W¦³©w¸q¡D§AÀ³¸Ó­×­q¥¦¥H«K²Å¦X§Aªº³]©w¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
#
# Update the nameserver cache information file once per month.
# This is run automatically by a cron entry.
#
(
 echo "To: hostmaster <hostmaster>"
 echo "From: system <root>"
 echo "Subject: Automatic update of the named.boot file"
 echo

 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:
 cd /var/named

 dig @rs.internic.net . ns >root.cache.new

 echo "The named.boot file has been updated to contain the following information:"
 echo
 cat root.cache.new

 chown root.root root.cache.new
 chmod 444 root.cache.new
 rm -f root.cache.old
 mv root.cache root.cache.old
 mv root.cache.new root.cache
 ndc restart
 echo
 echo "The nameserver has been restarted to ensure that the update is complete."
 echo "The previous root.cache file is now called /var/named/root.cache.old."
) 2>&1 | /usr/lib/sendmail -t
exit 0
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¦³¨Ç¤H¥i¯à¥Î ftp ±q Internic ±o¨ì {\ttfamily root.cache} ÀÉ®×¡D
½Ð{\itshape ¤£­n\/}¥Î ftp ¨Ó§ó·s {\ttfamily root.cache}¡A¤W­±´£¨ìªº¤èªk§ó¬°«K§Q¡D




\section{Bind version 8\label{bind8}}

Bind version 8 ¬O³Ì·sªº bind §Þ³N¡D§ÚÁÙ¨S¦³¹Á¸Õ¨Ï¥Î¡A¦ý David E. Smith $<$\onlynameurl{dave@bureau42.ml.org}$>$ ¦³¡D¥L¼g¤F³o¤p¸`ªº¨ä¾l³¡¥÷¡D

¨S¦³¤Ó¦hªº¤£¦P¡D°£¤F¨Ï¥Î {\ttfamily named.conf} ¦Ó¤£¬O {\ttfamily named.boot}, ¨ä¾l³£¬Û¦P¡D
¦Ó¥B bind 8 ¥]§t¤F¤@­Ó perl «ü¥O½Z¨Ó±NÂÂ®æ¦¡ªºÀÉ®×Âà´«¦¨·sªº¡D
¨Ò¦p¤@¥÷¼È¦s±M¥Î¦WºÙ¦øªA¾¹ªº {\ttfamily named.boot} (ÂÂ®æ¦¡):

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
directory /var/named
cache   .                                       root.hint
primary 0.0.127.IN-ADDR.ARPA                    127.0.0.zone
primary localhost                               localhost.zone
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¦b«ü¥O¦C¤U¡A©ó {\ttfamily bind8/src/bin/named} ¥Ø¿ý¤¤Áä¤J:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
named-bootconf.pl < named.boot > named.conf
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


³o·|²£¥Í {\ttfamily named.conf}:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
// generated by named-bootconf.pl

options {
        directory "/var/named";
};

zone "." {
        type hint;
        file "root.hint";
};

zone "0.0.127.IN-ADDR.ARPA" {
        type master;
        file "127.0.0.zone";
};

zone "localhost" {
        type master;
        file "localhost.zone";
};
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}




¥¦±N {\ttfamily named.boot} ¤¤ªº¨C¼ËªF¦è³£Âà´«¹L¨Ó¡AµM¦Ó¥¦¨Ã¥¼¥[¤J©Ò¦³ bind 8 ©Ò¤¹³\ªº·s±j¤Æ¤Î°t¸m¿ï¶µ¡D
³o¸Ì¦³¥÷¸û§¹¾ãªº {\ttfamily named.conf} °µ¦P¼Ëªº¨Æ¡A¦ý¬O®Ä²v§ó¦n¤@ÂI¡D

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
// This is a configuration file for named (from BIND 8.1 or later).
// It would normally be installed as /etc/named.conf.
// The only change made from the `stock' named.conf (aside from this
// comment :) is that the directory line was uncommented, since I
// already had the zone files in /var/named.

options {
        directory "/var/named";
        check-names master warn;                /* default. */
        datasize 20M;
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        check-names fail;
        allow-update { none; };
        allow-transfer { any; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "127.0.0.zone";
        check-names fail;
        allow-update { none; };
        allow-transfer { any; };
};

zone "." IN {
        type hint;
        file "root.hint";
};
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}




{\ttfamily bind8/src/bin/named/test} ¸Ì¦³³o­Ó½d¨Ò¡A¥H¤Î»â°ìÀÉ®×ªº«þ¨©¡A³\¦h¤H¥i¥Hª½±µ®³¨Ó­×§ï¨Ï¥Î¡D

»â°ìÀÉ®×¤Î {\ttfamily root.hint} ({\ttfamily root.cache}) §¹¥þ¬Û¦P¡A§ó·s¥¦­Ìªº«ü¥O¤]¬O¡D




\section{¼·±µ³s½uªº¦Û°Ê³]©w\label{auto}}

³o¤@¸`¸ÑÄÀ§Ú¦p¦ó³]©w¥H«KÅý¨C­Ó¹Lµ{¦Û°Ê¤Æ¡D
§Úªº¤èªk¥i¯à¤@ÂI³£¤£¾A¦X§A¡A¦ý¬O§A¥i¯à±q§Ú©Ò§@ªº¤@¨Ç¨Æ±¡¸Ì±o¨ì¤@¨ÇÂI¤l¡D
¦P®É¡A§Ú¨Ï¥Î PPP ¼·±µ¡AµM¦Ó¦³³\¦h¤H¨Ï¥Î slip ©Î¬O cslip ³s½u¤è¦¡¡A
©Ò¥H§Aªº³]©w¸Ì´X¥G¨C­Ó¦a¤è³£¥i¯à¸ò§Úªº¤£¦P¡D
¦ý¬O slip ¨Ï¥Îªº {\ttfamily dip} µ{¦¡À³¸Ó¯à°÷§¹¦¨§Ú©Ò§@ªº³\¦h¨Æ±¡¡D

¤@¯ë¨Ó»¡¡A·í§Ú¨S¦³³s¤Wºô¸ô®É§Úªº {\ttfamily resolv.conf} ÀÉ®×³æ¯Â¦a¥]§t³o¤@¦æ
\begin{tscreen}
\begin{verbatim}
domain uio.no
\end{verbatim}
\end{tscreen}


³o½T«O§Ú¤£¥²µ¥«Ý¥D¾÷¦WºÙ¸ÑªR¨ç¦¡®w¥h¹Á¸ÕÁpÃ´¬Y¥x¤£¥i¯àÀ°§U§Úªº¦WºÙ¦øªA¾¹¡D
¦ý¬O·í§Ú³s¤W½uªº®É­Ô§Ú·Q­n°_©l§Úªº {\ttfamily named} ¨Ã¥B¾Ö¦³¤@­Ó¬Ý°_¨Ó¹³«e­±©Ò´y­zªº {\ttfamily resolv.conf} ÀÉ®×¡D
§ÚÂÇ¥Ñ«O«ù¨â¥÷ {\ttfamily resolv.conf} ªº¡¥¼ËªO¡¦ÀÉ®×¡A{\ttfamily resolv.conf.local} ¥H¤Î {\ttfamily resolv.conf.connected} ¨Ó¸Ñ¨M°ÝÃD¡D
«á­±³o¤@­Ó¬Ý°_¨Ó¹³«e­±©Ò´y­z¹Lªº {\ttfamily resolv.conf} ÀÉ®×¡D

­n¦Û°Ê¤Æ³s½u¨ìºô¸ôªº¹Lµ{§Ú°õ¦æ¤@­ÓºÙ¬° `ppp-on' ªº«ü¥O½Z:
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
echo calling...
pppd
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


pppd ¦³­ÓºÙ¬° {\ttfamily options} ªºÀÉ®×¡A¥¦§i¶D pppd ¦p¦ó¨ú±o³s½uªº¤@¨Ç¯S®í¨Æ¶µ¡D
¤@¥¹§Úªº ppp ³s½u§¹¦¨«á pppd °_©l¤@­ÓºÙ¬° {\ttfamily ip-up} ªº«ü¥O(³o¦b pppd ªº½u¤W¨Ï¥Î¤â¥U¸Ì¦³´y­z)¡D
³o¸Ì¬O¸Ó«ü¥O½Z¸Ì­±ªº¤@³¡¥÷:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
interface="$1"
device="$2"
speed="$3"
myip="$4"
upip="$5"
 ...
cp -v /etc/resolv.conf.connected /etc/resolv.conf
 ...
/usr/sbin/named
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


´«¥y¸Ü»¡¡A§Ú¦b³o¸Ì°_©l§Úªº {\ttfamily named} µ{¦¡¡D·í ppp Â÷½u®É pppd °õ¦æ¤@­ÓºÙ¬° {\ttfamily ip-down} ªº«ü¥O½Z:

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
#!/bin/sh
cp /etc/resolv.conf.local /etc/resolv.conf
read namedpid < /var/run/named.pid
kill $namedpid
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


©Ò¥H³o¦b³s½u®É°t¸m¨Ã³]©w¬ÛÃö¨Æ©y¨Ã¥B¦bÂ÷½u®É¸Ñ°£¸Ó°t¸m¨Ãµ²§ô¬ÛÃöµ{¦¡¡D

¬Y¨Çµ{¦¡¡A¨Ò¦p§Ú·Q°_ irc »P talk¡A°µ¤F¹L¦hªº°²©w¡A¬°¤FÅý¨ä¤u§@¥¿±`§A¥²¶·­×§ï§Aªº {\ttfamily hosts} ÀÉ®×¡D
§Ú¦b {\ttfamily ip-up} ¤W¥[¤J

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
cp /etc/hosts.ppp /etc/hosts
echo $myip      roke >>/etc/hosts
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\ttfamily hosts.ppp} ¬OÂ²³æ¦a¥]§t¤F

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
127.0.0.1       localhost
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¦Ó {\ttfamily echo} «ü¥O´¡¤J¤F§Ú¦¬¨ìªº IP ¸¹½X°µ¬°§Ú¾÷¾¹ªº¦WºÙ(roke)¡D
§AÀ³¸Ó§ï¥Î§A¦Û¤v¾÷¾¹ªº¦WºÙ¡A¥i¥H¥Î {\ttfamily hostname} «ü¥O¬d¥X¡D

·í§A¨S¦³³s½u¨ìºô¸ô¤W®É°õ¦æ {\ttfamily named} ¥i¯à¨Ã¤£Áo©ú¡A
³o¬O¦]¬° {\ttfamily named} ±N·|¹Á¸Õ°e¥X¬d¸ß¨ìºô¸ô¤W¦Ó¥B¨ä²×¤î®É­­(timeout)«Üªø¡A
¦Ó¨C¦¸¦³¬Y¨Ç­Óµ{¦¡¹Á¸Õ¸ÑªR¤@­Ó¦WºÙªº®É­Ô§A´N±oµ¥«Ý¨ì³o­Ó²×¤î®É­­¡D
¦pªG§A¨Ï¥Î¼·±µªº¸Ü§AÀ³¸Ó¦b³s¤Wºô®É°_©l {\ttfamily named} ¨Ã¥B¦bÂ÷½u®É±þ±¼¥¦¡D
¤£¹L½Ð°Ñ¦Ò \ref{qanda} {(FAQ)} ¤@¸`ªº´£¥Ü¡D

¬Y¨Ç¤H³ßÅw¦bºC³tªº³s½u¤W¨Ï¥Î {\ttfamily forwarders} «ü¥O¡D
¦pªG§Aªººô»Úºô¸ô´£¨ÑªÌ¦b {\ttfamily 1.2.3.4}  ¥H¤Î {\ttfamily 1.2.3.5}  ³]¦³ DNS ¦øªA¾¹¨º»ò§A¥i¥H´¡¤J³o»ò¤@¦æ

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
forwarders 1.2.3.4 1.2.3.5
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¨ì {\ttfamily named.boot} ÀÉ®×¸Ì¥h¡D
³o±N·|´î§C·½¦Û§A¥D¾÷ªº IP ¬y¶q¡A¥i¯àµy·L´£ª@³t«×¡D¦pªG§A¬O¨Ì½u¸ôªº¸ê®Æ¶q¥I¶Oªº¸Ü³oÂI¯S§O­«­n¡D
³oÁÙ¦³­Óªþ¥[»ù­È¡AÅý§A²æÂ÷§@¬°¤@­Ó¼È¦sªº {\ttfamily named} ºûÅ@ªÌ©ÒÀ³­t°_ªº³d¥ô: 
§A¤£»Ý­n¥h§ó·s¤@­ÓªÅªº {\ttfamily root.cache} ÀÉ®×¡D




\section{±`¨£°ÝÃD¸Ñµª\label{qanda}}

¥»¸`¤¤§Ú±N¦C¥X¤@¨ÇÃö©ó DNS ¥H¤Î¥»¤å¥ó³Ì±`³Q´£¥Xªº°ÝÃD¡DÁÙ¦³¸Ñµª :-)
¦b¼g«Hµ¹§Ú«e½Ð¥ý¾\Åª¹L¥»¸`¡D

\begin{enumerate}
\item ¦p¦ó¦b¨¾¤õÀð¤§¤º¨Ï¥Î DNS ? 

¤@¨Ç´£¥Ü: `{\ttfamily forwarders}', `{\ttfamily slave}', 
¥H¤Î°Ñ¦Ò¥»¤å¥ó³Ì«á­±ªº¤åÄm¦Cªí¡D



\item ¦p¦ó§Q¥Î DNS ´£¨Ñªº¥i¥Î¦ì§}©ó¬Y¤@ªA°È¡A¦p {\ttfamily www.busy.site}¡A
¥HÀò±o­t²ü¥­¿Å©ÎÃþ¦üªº®ÄªG?

¬° {\ttfamily www.busy.site} ¥[¤W³\¦h {\bfseries A} °O¿ý¡A¦Ó¥B¨Ï¥Î {\ttfamily bind 4.9.3} ©Î¥H«áªºª©¥»¡D
³o¼Ë {\ttfamily bind} ·|¨Ï¥Î round-robin ºtºâªk§ä´Mµª®×¡D³o{\itshape ¤£¯à\/}¦b§ó¦­ª©¥»ªº {\ttfamily bind} ¤W¤u§@¡D



\item §Ú·Q¦b¤@«Ê³¬ªº Intranet ¤W¬[³] DNS¡D§Ú¸Ó«ç»ò°µ?

§â¼È¦sÀÉ®×¥á±¼¥u¯d°Ï°ìÀÉ®×¡D³o¤]ªí¥Ü§A±N¤£»Ý­n§ó·s¼È¦sÀÉ®×¡D



\item §Úªº¨t²Î¨S¦³ {\ttfamily ndc} µ{¦¡¡D§Ú¸Ó«ç»ò¿ì?

§Aªº¨t²Î¦w¸Ë¹L¤@ÂÂªº¡A¥i¯à¹L´Áªº {\ttfamily bind} µ{¦¡¡D
¦pªG¦w¥þ©Ê¹ï§A«Ü­«­n: ¥ß¨è±N {\ttfamily bind} ¤É¯Å¡D¦pªG¤£¬O¡A§A¤]¥i¥H¥Î³oÂÂªº¡D
§A¥iª½±µ°õ¦æ {\ttfamily named} ¦Ó¤£¬O {\ttfamily ndc start}¡D
{\ttfamily ndc reload} ÅÜ¦¨ {\ttfamily named.reload} ¦Ó {\ttfamily ndc restart} ÅÜ¦¨ {\ttfamily named.restart}¡D
©Ò¦³³o¨Çµ{¦¡¥i¯à³£¦b {\ttfamily /usr/sbin} ¸Ì¡D



\item ¦p¦ó«Ø¥ß¦¸­n¦WºÙ¦øªA¾¹?

¦pªG¥D­n¦WºÙ¦øªA¾¹ªº¦a§}¬O {\ttfamily 127.0.0.1}¡A
¦b§Aªº¦¸­n¦WºÙ¦øªA¾¹ªº {\ttfamily named.boot} ÀÉ®×¤¤©ñ¤@¦æ:
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
  secondary     linux.bogus             127.0.0.1       sz/linux.bogus
  
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}




\item §Ú§Æ±æÂ÷½u®É {\ttfamily bind} ¤´Ä~Äò°õ¦æ¡D

§Ú¦¬¨ì¨Ó¦Û Ian Clark $<$\onlynameurl{ic@deakin.edu.au}$>$ 
ªº«H¥ó¸ÑÄÀ¥L¦p¦ó¿ì¨ì³oÂI¡D
\begin{tscreen}
\begin{verbatim}
I run named on my 'Masquerading' machine here. I have 
two root.cache files, one called root.cache.real which contains 
the real root server names and the other called root.cache.fake 
which contains...

--------------
; root.cache.fake
; this file contains no information
--------------

When I go off line I copy the root.cache.fake file to root.cache and
restart named.

When I go online I copy root.cache.real to root.cache and restart
named.

This is done from ip-down & ip-up respectively.

The first time I do a query off line on a domain name named doesn't
have details for it puts an entry like this in messages..

Jan 28 20:10:11 hazchem named[10147]: No root nameserver for class IN

which I can live with.
         
It certainly seems to work for me. I can use the nameserver for
local machines while off the 'net without the timeout delay for
external domain names and I while on the 'net queries for external
domains work normally
\end{verbatim}
\end{tscreen}




\item ¦WºÙ¦øªA¾¹±N¼È¦s¸ê®Æ«O¦s¦b¨º¨à? ¦³¥ô¦ó¤èªk¥i¥H±±¨î¥¦ªº¤j¤p¶Ü?

©Ò¦³ªº¼È¦s¸ê®Æ³£«O¦s¦b°O¾ÐÅé¤¤¡A¥ô¦ó®É¨è¥¦³£¤£·|³Q¼g¤JºÏºÐ¤¤¡D
¨C¦¸§A±þ±¼ {\ttfamily named} ®É³o¨Ç¼È¦s¸ê®Æ´N¨S¦³¤F¡D{\itshape ¨S¦³\/}¥ô¦ó¤èªk¥i¥H±±¨î¼È¦s¸ê®Æ¡D
{\ttfamily named} ¥Î¤@¨ÇÂ²³æªºªk«h¨ÓºÞ²z¥¦¡D§A¤£¯à¥Î¥ô¦ó²z¥Ñ¥ô¦ó¤èªk±±¨î¼È¦s¸ê®Æ©Î¨ä¤j¤p¡D
¦pªG§A§Æ±æ¦p¦¹§A¥i¥H¦Û¤v¥h§ï {\ttfamily named} ªºµ{¦¡¡D¤£¹L³Ì¦n§O³o»ò°µ¡D



\item ¦p¦ó¦b­«·s°_©l {\ttfamily named} ¤§¶¡«O¦s¼È¦s¸ê®Æ? §Ú¥i¥H§â¥¦¦s¤U¨Ó¶Ü?

¤£! {\ttfamily named} ³Q±þ±¼®É{\itshape ¤£·|\/}«O¯d¼È¦s¸ê®Æ¡D
³o´N¬O»¡¼È¦s¸ê®Æ¥²¶·¦b¨C¦¸§A±þ±¼¨Ã­«·s°_©l {\ttfamily named} «á­«·s«Ø¥ß¡D
{\itshape ¨S¦³\/}¿ìªkÅý {\ttfamily named} ±N¼È¦s¸ê®Æ¦s¨ìÀÉ®×¸Ì¡D
¦pªG§A§Æ±æ¦p¦¹§A¥i¥H¦Û¤v¥h§ï {\ttfamily named} ªºµ{¦¡¡D¤£¹L³Ì¦n§O³o»ò°µ¡D



\end{enumerate}





\section{¦p¦ó¦¨¬°¤@­Ó¤j«¬ªº DNS  ºÞ²zªÌ\label{bigger}}

{\bfseries ¤å¥ó¥H¤Î¤u¨ã}

¦s¦b¯u¥¿ªº¤å¥ó¡D¦b½u¤Wªº©Î¬O¦L¦nªº¡D­n¸ó¥X¥Ñ¤p«¬ DNS ¨ì¤j«¬ DNS ºÞ²zªÌªº¤@¨B¾\Åª´X¥÷³o¨Ç¤å¥ó¬O¥²­nªº¡D
¦L¦nªº¼Ð·Ç°Ñ¦Ò®Ñ¬O
{\itshape DNS and BIND\/} by C. Liu and P. Albitz from O'Reilly \& Associates, Sebastopol, CA, ISBN 0-937175-82-X¡D
§ÚÅª¹L¡A¥¦«Ü´Î¡D¦b¥t¤@¥» {\itshape TCP/IP Network Administration\/}, by Craig Hunt from O'Reilly..., ISBN 0-937175-82-X
¦³¤@¸`¬OÃö©ó DNS ªº¡D¥t¤@¥»¹ïºÞ²z DNS  «Ü¦nªº(©ÎªÌ¬O¹ï¥ô¦ó³o¤@Ãþ¤u§@³£«Ü¦n)®Ñ«h¬O
{\itshape Zen and the Art of Motorcycle Maintenance\/}, §@ªÌ Robert M. Prisig ®Ñ¸¹ ISBN 0688052304¡D

½u¤Wªº¸ê®Æ§A¥i¥H¦b³o¸Ì§ä¨ì \nameurl{http://www.dns.net/dnsrd/}{}, \nameurl{http://www.isc.org/bind.html}{};
±`¨£°ÝÃD¶°¡A°Ñ¦Ò¤â¥U(BOG; Bind Operations Guide)¬O¨ó©wªº©w¸q¥H¤Î DNS ¬ã¨sªº¤åÄm¡D
³o¨Ç¤å¥ó§Ú¤j³¡¤À¨S¦³¾\Åª¹L¡A¦ý¬O¦]¦¹§Ú¤£¬O­Ó¤j«¬ DNS  ºÞ²zªÌ¡D
¥t¤@¤è­± Arnt Gulbrandsen ¤w¸gÅª¹L BOG ¦Ó¥B¹ï¦¹«Ü¼ô¸Z :-)¡D
ºô¸ô·s»D°Q½×¸s \onlynameurl{comp.protocols.tcp-ip.domains} ¬O¦³Ãö DNS ªº°Q½×¸s¡D
¦¹¥~ÁÙ¦³¦n´X¥÷Ãö©ó DNS ªº RFCs¡A³Ì­«­nªº¥i¯à¬O³o¨Ç:
\begin{description}


\item[RFC 2052] \mbox{}

A. Gulbrandsen, P. Vixie, {\itshape A DNS RR for specifying
the location of services (DNS SRV)\/}, October 1996



\item[RFC 1918] \mbox{}

Y. Rekhter, R. Moskowitz, D. Karrenberg, G. de Groot,
E. Lear, {\itshape Address Allocation for Private Internets\/}, 02/29/1996.



\item[RFC 1912] \mbox{}

D. Barr, {\itshape Common DNS Operational and Configuration
Errors\/}, 02/28/1996.



\item[RFC 1713] \mbox{}

A. Romao, {\itshape Tools for DNS debugging\/}, 11/03/1994.



\item[RFC 1712] \mbox{}

C. Farrell, M. Schulze, S. Pleitner, D. Baldoni,
{\itshape DNS Encoding of Geographical Location\/}, 11/01/1994.



\item[RFC 1183] \mbox{}

R. Ullmann, P. Mockapetris, L. Mamakos, C. Everhart,
{\itshape New DNS RR Definitions\/}, 10/08/1990.



\item[RFC 1035] \mbox{}

P. Mockapetris, {\itshape Domain names - implementation and
specification\/}, 11/01/1987.



\item[RFC 1034] \mbox{}

P. Mockapetris, {\itshape Domain names - concepts and
facilities\/}, 11/01/1987.



\item[RFC 1033] \mbox{}

M. Lottor, {\itshape Domain administrators operations
guide\/}, 11/01/1987.



\item[RFC 1032] \mbox{}

M. Stahl, {\itshape Domain administrators guide\/},
11/01/1987.



\item[RFC 974] \mbox{}

C. Partridge, {\itshape Mail routing and the domain system\/},
01/01/1986.



\end{description}


\end{document}
