📄 513-515.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Configuring Domain Name Service</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789717468//-->
<!--TITLE=Special Edition Using Linux, Fourth Edition//-->
<!--AUTHOR=Jack Tackett//-->
<!--AUTHOR=Jr.//-->
<!--AUTHOR=Steve Burnett//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=25//-->
<!--PAGES=513-515//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="510-513.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch26/517-519.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">The named.rev File</FONT></H4>
<P>The named.rev file is very similar to the named.hosts file, except that it essentially works in reverse—it maps addresses to host names. Listing 25.2 shows a sample named.rev file for tristar.com.
</P>
<P><B>Listing 25.2</B> An Example named.rev File</P>
<!-- CODE //-->
<PRE>
; named.rev file for tristar.com
;
@ IN SOA ns.tristar.com. dave.tristar.com. (
6 ; serial number
86400 ;refresh 24 hrs
300 ; retry 5 minutes
2592000 ; expire 30 days
86400 ; minimum 24 hrs
)
IN NS ns.tristar.com.
;
; reverse map your IP addresses
;
1 IN PTR ns.tristar.com.
2 IN PTR mailhost.tristar.com.
3 IN PTR opus.tristar.com.
4 IN PTR skippy.tristar.com.
</PRE>
<!-- END CODE //-->
<P>In this example, you have the same SOA record that you saw in the named.hosts file. This just sets up the authority information for the domain. In this case, @, the value of the origin, is set to 197.198.199.in-addr.arpa from the <TT>primary</TT> line in the named.boot file. Recall that the in-addr.arpa domain refers to reverse mapping of addresses to names.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>The addresses listed as part of your in-addr.arpa line is your network address backward. Your example network for this chapter has the address 199.198.197.0. When you list it in the reverse mapping data files, you list it as<DL>
<DD>197.198.199.in-addr.arpa
</DL>
<HR></FONT>
</BLOCKQUOTE>
<P>You have the <TT>NS</TT> record that lists the name server for your domain. Following that are the records that make up the reverse address resolution records. These are <TT>PTR</TT> records and give the host number (the part of the IP address not listed in the in-addr.arpa value) and the canonical host name that matches it. You must use the canonical host name here instead of a relative host name. For example, the line</P>
<!-- CODE SNIP //-->
<PRE>
2 IN PTR mailhost.tristar.com.
</PRE>
<!-- END CODE SNIP //-->
<P>tells <TT>named</TT> to map the host address 199.198.197.2 to the host name mailhost.tristar.com.</P>
<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">The named.ca File</FONT></H4>
<P>As stated earlier in this chapter, the caching operation of <TT>named</TT> is very important. Fortunately, the named.ca file that sets up caching is also usually the simplest of the <TT>named</TT> configuration files. It just lists the root name servers for the various domains with their IP addresses. It contains a couple of special field indicators that tell <TT>named</TT> that these are root servers.</P>
<P>You can probably just copy the format of the sample named.ca file in Listing 25.3. To get a complete current list of the root name servers, use the <TT>nslookup</TT> utility.</P>
<P><B>Listing 25.3</B> An Example named.ca File</P>
<!-- CODE //-->
<PRE>
; named.ca file
;
. 99999999 IN NS NS.NIC.DDN.MIL.
99999999 IN NS NS.NASA.GOV.
99999999 IN NS KAVA.NISC.SRI.COM.
99999999 IN NS TERP.UMD.EDU.
99999999 IN NS C.NYSER.NET.
99999999 IN NS NS.INTERNIC.NET.
;
NS.NIC.DDN.MIL. 99999999 IN A 192.112.36.4
NS.NASA.GOV. 99999999 IN A 128.102.16.10
KAVA.NISC.SRI.COM. 99999999 IN A 192.33.33.24
TERP.UMD.EDU. 99999999 IN A 128.8.10.90
C.NYSER.NET. 99999999 IN A 192.33.4.12
NS.INTERNIC.NET. 99999999 IN A 198.41.0.4
</PRE>
<!-- END CODE //-->
<P>As you can see, the named.ca file simply maps NS name server records to the appropriate addresses for them.
</P>
<H3><A NAME="Heading12"></A><FONT COLOR="#000077">Troubleshooting</FONT></H3>
<P>DNS is a very complex system. You can do many things wrong that will cause your system to not behave properly. Many of the problems that occur with a DNS setup will appear to be identical but come from different causes. However, most of the problems result from syntax errors in your configuration files.
</P>
<P>Make sure that you specify the host names correctly in your DNS configuration files. If it’s an absolute host name, be sure to end it with a dot.</P>
<P>Be especially careful with the names used in <TT>SOA</TT> and <TT>CNAME</TT> records. If you make errors here, these resource records can redirect host name queries to computers that don’t exist.</P>
<P>Be sure to increment the serial number in your configuration files when making changes. If you forget, DNS will not reread the file.</P>
<P>Be sure to enter the correct IP address for <TT>A</TT> records, and check to see that it matches your /etc/hosts file (if you have one). Also, make sure that the DNS name and IP address match the corresponding reverse resolution information in named.rev.</P>
<P>Your best tool for figuring out errors is the <TT>nslookup</TT> command. Use <TT>nslookup</TT> to test your DNS server thoroughly. Do regular and reverse resolution for every address in your DNS database to make sure that all the names and addresses are correct.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>An interesting project is Paul Vixie’s (he wrote BIND) S/WAN project, which provides opportunistic encryption at the Ethernet packet level. For more information, go to <A HREF="http://www.cygnus.com/~gnu/swan.html">http://www.cygnus.com/~gnu/swan.html</A>.<HR></FONT>
</BLOCKQUOTE>
<H3><A NAME="Heading13"></A><FONT COLOR="#000077">From Here…</FONT></H3>
<P>This chapter shows the various components of the DNS system and explores the various configuration files necessary to get a DNS name server running on your Linux system. Because the syntax for the resource records is fairly arcane, you need to pay close attention to your configuration files as you write them.
</P>
<P>You can find more information about networking in the following chapters:</P>
<DL>
<DD><B>•</B> Chapter 24, “Configuring a TCP/IP Network,” shows how to set up and configure TCP/IP networking.
<DD><B>•</B> Chapter 29, “Using SLIP and PPP,” shows how to configure SLIP and PPP for dial-up Internet access.
<DD><B>•</B> Chapter 31, “Surfing the Internet with the World Wide Web,” gives an overview of the Internet.
</DL>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="510-513.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch26/517-519.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -