📄 linux-nameserver.html
字号:
under that domain (like, for the penguincomputing.com domain, thenameservers would have the information for what IP addresspasta.penguincomputing.com gets and the one thatantarctica.penguincomputing.com gets). Here's an example of a domain'srecords:</P><PRE>@ IN SOA penguincomputing.com. root.penguincomputing.com.( 1998082403 ; serial 4H ; refresh, seconds 2H ; retry, seconds 1W ; expire, seconds 1D ) ; minimum, seconds NS pasta.penguincomputing.com. NS rice.penguincomputing.com. MX 10 penguincomputing.com. ; Primary Mail Exchangerlocalhost A 127.0.0.1router A 140.174.204.2penguincomputing.com. A 209.81.10.250ns A 209.81.10.250www A 209.81.10.250ftp CNAME penguincomputing.com.mail CNAME penguincomputing.com.news CNAME penguincomputing.com.pasta CNAME penguincomputing.com.slashdot CNAME penguincomputing.com.rice CNAME antarctica.penguincomputing.com.antarctica A 209.81.10.252antarctic CNAME antarctica.penguincomputing.com.www.antarctic CNAME antarctica.penguincomputing.com.www.antarctica CNAME antarctica.penguincomputing.com.zork A 209.81.10.253tux A 209.81.10.146xfce A 209.81.10.252@ TXT "Penguin Computing"@ HINFO Linux 2.0.34</PRE><P>There's a pretty weird syntax to be used for these zone files. I neverwould have figured it out on my own had I not read the Linux DNS HOWTOdocument. Basically, it specifies information about all the machines inthe domain, and it contains information about the domain itself, such asthe type of machine the server is running on.</P><P>I'll start explaining what all the stuff does. In the first line, it'ssaying that this file specifies the zones for the penguincomputing.comdomain, and to send anything about the domain to<I>root@penguincomputing.com</I>. Since the "@" character hasspecial significance in these <B>zone files</B>, the username (root) andmachine name (penguincomputing.com) have to be separated by a dot. I guessBIND just knows how to split it up. That's how you fill in stuff for yourdomain as well.</P><P>The line with the comment "serial" shows the serial number ofthat domain. The syntax is YYYYMMDDRR; that is, a four digit year, twodigit month in numerical form, two digit day format, and a two digitrevision number. In this example (1998082403), it shows that the zone filewas last modified on August 24, 1998. It's the third revision for thatday. When you're changing anything in the file, make sure to increase therevision number by one if the previous change was on the same day. If Iwere to change the IP of one of the hosts, I would make the last twonumbers, currently 03, to 04.</P><P>The next few lines show times for certain functions such as refreshing,retrying, and expiring the information. I'm not <I>absolutely</I> sure,but my best guess is that H stands for hour, D stands for day, and Wstands for week.</P><P>The "NS" line indicates all the nameservers for thatparticular domain, including the one this information is on. Thisinformation has to match what has been registered with InterNIC. For thehostnames of the nameservers, remember to add a dot at the end. If youdon't, it will add the hostname to the current domain. For example, if youforgot the dot at the end of pasta.penguincomputing.com, you would end upwith the nameserver being pasta.penguincomputing.com.penguincomputing.com,which is obviously not what it's supposed to be. Watch out for this.</P><P>The MX file is the <I>M</I>ail e<I>X</I>change record, so that mail canget through to the domain. There should also be an entry in/etc/sendmail.cw to allow messages coming in from that domain (assumingyou're using Sendmail, the default on many Linux systems, for mailtransfer).</P><P>The next couple of lines point to the local loopback (127.0.0.1), whichall Linux systems should have even if they aren't connected to a network.The "router" line points to the IP address of where themachine's Internet connection is. I'm not sure if it's really necessarybut I was playing it safe back then and trying to copy the example fromthe DNS HOWTO as closely as possible.</P><P>The rest of the entries use either A (address) or CNAME (CanonicalName) to point hostnames to IP addresses. Note that hostnames can bemapped to other hostnames, or they can be mapped to IP addresses. Use A tomap a name to an IP address, and CNAME to map a hostname to anotherhostname (which must be mapped to another IP address).</P><A NAME="localhost"></A><H4><A NAME="8">Localhost</A></H4><P>The file for mapping localhost is pretty simple. Not much explanationneeded. Of course, if you want to copy and paste, be sure you make the proper changes.</P><PRE>@ IN SOA penguincomputing.com root.penguincomputing.com ( 1998072401 ; Serial number 3H ; Refresh 1H ; Retry 604800 ; Expire 86400) ; Minimum TTL NS pasta.penguincomputing.com. NS rice.penguincomputing.com.1 PTR localhost.</PRE><A NAME="reverse"></A><H4><A NAME="9">Reverse Mapping</A></H4><P>This file looks similar to the zone file for the domains, but itprovides the opposite function. It points IP addresses to hostnames (asopposed to vice versa), because many servers on the Internet do this thingcalled reverse lookup on the IP address of your hostname to make sure thatyou're not doing anything sneaky.</P><P>This is for the zone "209.81.10" specified in the sampleconfiguration file. Note that my example is not complete, nor does it workin reality, because Penguin Computing doesn't own the whole block of"209.81.10.*". But this is how you'd fill in a file to resolveyour IP addresses to hostnames <I>if</I> you owned the entire block of IPaddresses.</P><PRE>@ IN SOA penguincomputing.com. root.penguincomputing.com. ( 1998072002 ; Serial 4H ; Refresh 2H ; Retry 604800 ; Expire 86400) ; Minimum TTL NS pasta.penguincomputing.com. NS rice.penguincomputing.com.;; Servers;250 PTR pasta.penguincomputing.com.250 PTR penguincomputing.com.250 PTR ftp.penguincomputing.com.250 PTR www.penguincomputing.com.250 PTR mail.penguincomputing.com.251 PTR rice.penguincomputing.com.;; Workstations;252 PTR antarctica.penguincomputing.com.252 PTR antarctic.penguincomputing.com.</PRE><P>If you were to fill in an actual zone file like this, it's necessary tofill in <I>all</I> the entries in your block of IP addresses, from 1 to255. For something like that you may want to assign the task to anyone wholooks bored.</P><P>So what should you do if you only own a domain but not the block of IPaddresses that it's part of? Ask the people who are in charge of thatblock of IP addresses to map your IP addresses to their respectivehostnames for you.</P><A NAME="resources"></A><H3><A NAME="10">Resources</A></H3><P>The following is a list of resources I referred to in order to help meset up a nameserver for myself and write this document.</P><OL><LI><A HREF="http://www.linuxdoc.org/HOWTO/DNS-HOWTO.html" TARGET="_top">Linux DNS HOWTO</A></LI><LI><A HREF="http://www.isc.org/bind8/config.html" TARGET="_top">BIND Configuration File Syntax</A></LI></OL><HR><P>Comments, questions, suggestions? Send them to <AHREF="mailto:jgo@local.net">jgo@local.net</A>.</P><HR><P><B><FONT SIZE="-1">Copyright © 1997-1998 <AHREF="mailto:jgo@local.net">Joshua Go (jgo@local.net)</A>. Allrights reserved. Permission to use, distribute, and copy this document ishereby granted. You may modify this document as long as credit to me isgiven.</FONT></B></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -