📄 faq
字号:
Path: vixie!decwrl!sdd.hp.com!network.ucsd.edu!munnari.oz.au!uniwa!craigFrom: craig@ecel.uwa.edu.au (Craig Richmond - division)Newsgroups: comp.protocols.tcp-ip.domainsSubject: FAQ: Setting up a basic DNS server for a domainDate: 3 Aug 1993 10:53:51 GMTOrganization: The University of Western AustraliaLines: 1088Distribution: inetMessage-ID: <23lg3v$1go@uniwa.uwa.edu.au>NNTP-Posting-Host: decel.ecel.uwa.edu.auSummary: Step by Step implementation of a DNS serverKeywords: FAQ DNS setup Setting up a basic DNS server for a domain Revision 1.1.1 Craig Richmond craig@ecel.uwa.edu.au 3rd August 1993About this documentI have written this file because it seems that the same questions seem topop up time and time again and when I had to install DNS from scratch thefirst time, we found very little to help us.This document covers setting up a Domain Name Server with authority overyour domain and using a few of the more useful but less well known(hopefully this document will take care of that) features of nslookup toget information about the DNS and to work out why yours isn't working.If you are using a Sun Workstation and you want to make NIS interact withthe DNS, then this is not the FAQ for you (but it may well be when you tryto set up the DNS). Mark J. McIntosh <Mark.McIntosh@engr.UVic.CA> pointsout that it is included in the comp.sys.sun.admin FAQ and for the benefitof those of you who can't get that (it is posted in comp.sys.sun.admin,comp.sys.sun.misc, comp.unix.solaris, comp.answers and news.answers) I haveincluded the relevant parts at the bottom in appendix C.Contents: Contents An Overview of the DNS Installing the DNS *The Boot File *The Cache File *The Forward Mapping File *The Reverse Mapping File Delegating authority for domains within your domain Troubleshooting your named *Named doesn't work! What is wrong? *I changed my named database and my local machine has noticed, but nobody else has the new information? *My local machine knows about all the name server information, but no other sites know about me? *My forward domain names work, but the backward names do not? How to get useful information from nslookup *Getting number to name mappings. *Finding where mail goes when a machine has no IP number. *Getting a list of machines in a domain from nslookup. Appendicies *Appendix A sample root.cache file *Appendix B Excerpt from RFC 1340 - Assigned Numbers - July 1992 *Appendix C Installing DNS on a Sun when running NISAn Overview of the DNS:The Domain Name System is the software that lets you have name to numbermappings on your computers. The name decel.ecel.uwa.edu.au is the number130.95.4.2 and vice versa. This is achieved through the DNS. The DNS is aheirarchy. There are a small number of root domain name servers that areresponsible for tracking the top level domains and who is under them. Theroot domain servers between them know about all the people who have nameservers that are authoritive for domains under the root.Being authoritive means that if a server is asked about something in thatdomain, it can say with no ambiguity whether or not a given piece ofinformation is true. For example. We have domains x.z and y.z. There areby definition authoritive name servers for both of these domains and weshall assume that the name server in both of these cases is a machinecalled nic.x.z and nic.y.z but that really makes no difference.If someone asks nic.x.z whether there is a machine called a.x.z, thennic.x.z can authoritively say, yes or no because it is the authoritive nameserver for that domain. If someone asks nic.x.z whether there is a machinecalled a.y.z then nic.x.z asks nic.y.z whether such a machine exists (andcaches this for future requests). It asks nic.y.z because nic.y.z is theauthoritive name server for the domain y.z. The information aboutauthoritive name servers is stored in the DNS itself and as long as youhave a pointer to a name server who is more knowledgable than yourself thenyou are set.When a change is made, it propogates slowly out through the internet toeventually reach all machines. The following was supplied by Mark AndrewsMark.Andrews@syd.dms.csiro.au. If both the primary and all secondaries are up and talking when a zone update occurs and for the refresh period after the update the old data will live for max(refresh + mininum) average (refresh/2 +mininum) for the zone. New information will be available from all servers after refresh.So with a refresh of 3 hours and a minimum of a day, you can expecteverything to be working a day after it is changed. If you have a longerminimum, it may take a couple of days before things return to normal.There is also a difference between a zone and a domain. The domain is theentire set of machines that are contained within an organisational domainname. For example, the domain uwa.edu.au contains all the machines at theUniversity of Western Australia. A Zone is the area of the DNS for which aserver is responsible. The University of Western Australia is a largeorganisation and trying to track all changes to machines at a centrallocation would be difficult. The authoritive name server for the zoneuwa.edu.au delegates the authority for the zone ecel.uwa.edu.au todecel.ecel.uwa.edu.au. Machine foo.ecel.uwa.edu.au is in the zone thatdecel is authoritive for. Machine bar.uwa.edu.au is in the zone thatuniwa.uwa.edu.au is authoritive for.Installing the DNS:First I'll assume you already have a copy of the Domain Name Serversoftware. It is probably called named or in.named depending on yourflavour of unix. I never had to get a copy, but if anyone thinks thatinformation should be here then by all means tell me and I'll put it in.If you intend on using the package called Bind, then you should be surethat you get version 4.9, which is the most recent version at this point intime.The Boot File:First step is to create the file named.boot. This describes to named(we'll dispense with the in.named. Take them to be the same) where theinformation that it requires can be found. This file is normally found in/etc/named.boot and I personally tend to leave it there because then I knowwhere to find it. If you don't want to leave it there but place it in adirectory with the rest of your named files, then there is usually anoption on named to specify the location of the boot file.Your typical boot file will look like this if you are an unimportant leafnode and there are other name servers at your site.directory /etc/namedfilescache . root.cacheprimary ecel.uwa.edu.au ecel.uwa.domainprimary 0.0.127.in-addr.arpa 0.0.127.domainprimary 4.95.130.in-addr.arpa 4.95.130.domainforwarders 130.95.128.1Here is an alternative layout used by Christophe Wolfhugel<Christophe.Wolfhugel@grasp.insa-lyon.fr> He finds this easier because ofthe large number of domains he has. The structure is essentially the same,but the file names use the domain name rather than the IP subnet todescribe the contents.directory /usr/local/etc/bindcache . p/rootforwarders 134.214.100.1 192.93.2.4;; Primary servers;primary fr.net p/fr.netprimary frmug.fr.net p/frmug.fr.netprimary 127.in-addr.arpa p/127;; Secondary servers;secondary ensta.fr 147.250.1.1 s/ensta.frsecondary gatelink.fr.net 134.214.100.1 s/gatelink.fr.netsecondary insa-lyon.fr 134.214.100.1 s/insa-lyon.frsecondary loesje.org 145.18.226.21 s/loesje.orgsecondary nl.loesje.org 145.18.226.21 s/nl.loesje.orgsecondary pcl.ac.uk 161.74.160.5 s/pcl.ac.uksecondary univ-lyon1.fr 134.214.100.1 s/univ-lyon1.frsecondary wmin.ac.uk 161.74.160.5 s/wmin.ac.uksecondary westminster.ac.uk 161.74.160.5 s/westminster.ac.uk;;; Secondary for addresses;secondary 74.161.in-addr.arpa 161.74.160.5 s/161.74secondary 214.134.in-addr.arpa 134.214.100.1 s/134.214secondary 250.147.in-addr.arpa 147.250.1.1 s/147.250;; Classes C;secondary 56.44.192.in-addr.arpa 147.250.1.1 s/192.44.56secondary 57.44.192.in-addr.arpa 147.250.1.1 s/192.44.57The lines in the named.boot file have the following meanings.directoryThis is the path that named will place in front of all file namesreferenced from here on. If no directory is specified, it looks for filesrelative to /etc.cacheThis is the information that named uses to get started. Named must knowthe IP number of some other name servers at least to get started.Information in the cache is treated differently depending on your versionof named. Some versions of named use the information included in the cachepermenantly and others retain but ignore the cache information once up andrunning.primaryThis is one of the domains for which this machine is authorative for. Youput the entire domain name in. You need forwards and reverse lookups. Thefirst value is the domain to append to every name included in that file.(There are some exceptions, but they will be explained later) The name atthe end of the line is the name of the file (relative to /etc of thedirectory if you specified one). The filename can have slashes in it torefer to subdirectories so if you have a lot of domains you may want tosplit it up.BE VERY CAREFUL TO PUT THE NUMBERS BACK TO FRONT FOR THE REVERSE LOOK UPFILE. The example given above is for the subnet ecel.uwa.edu.au whose IPaddress is 130.95.4.*. The reverse name must be 4.95.130.in-addr.arpa.It must be backwards and it must end with .in-addr.arpa. If your reversename lookups don't work, check this. If they still don't work, check thisagain.forwardersThis is a list of IP numbers for forward requests for sites about which weare unsure. A good choice here is the name server which is authoritive forthe zone above you.secondary (This line is not in the example, but is worth mentioning.)A secondary line indicates that you wish to be a secondary name server forthis domain. You do not need to do this usually. All it does is help makethe DNS more robust. You should have at least one secondary server foryour site, but you do not need to be a secondary server for anyone else.You can by all means, but you don't need to be. If you want to be asecondary server for another domain, then place the linesecondary gu.uwa.edu.au 130.95.100.3 130.95.128.1in your named.boot. This will make your named try the servers on both ofthe machines specified to see if it can obtain the information about thosedomains. You can specify a number of IP addresses for the machines toquery that probably depends on your machine. Your copy of named will uponstartup go and query all the information it can get about the domain inquestion and remember it and act as though it were authoritive for thatdomain.Next you will want to start creating the data files that contain the namedefinitions.The cache file:You can get a copy of the cache file from FTP.RS.INTERNIC.NET. The currentcopy can be found in Appendix A.The Forward Mapping file:The file ecel.uwa.edu.au. will be used for the example with a couple ofmachines left in for the purpose of the exercise. Here is a copy of whatthe file looks like with explanations following.; Authoritative data for ecel.uwa.edu.au;@ IN SOA decel.ecel.uwa.edu.au. postmaster.ecel.uwa.edu.au. ( 93071200 ; Serial (yymmddxx) 10800 ; Refresh 3 hours 3600 ; Retry 1 hour 3600000 ; Expire 1000 hours 86400 ) ; Minimum 24 hours IN A 130.95.4.2 IN MX 100 decel IN MX 150 uniwa.uwa.edu.au. IN MX 200 relay1.uu.net. IN MX 200 relay2.uu.net.localhost IN A 127.0.0.1decel IN A 130.95.4.2 IN HINFO SUN4/110 UNIX IN MX 100 decel IN MX 150 uniwa.uwa.edu.au. IN MX 200 relay1.uu.net IN MX 200 relay2.uu.netgopher IN CNAME decel.ecel.uwa.edu.au.accfin IN A 130.95.4.3 IN HINFO SUN4/110 UNIX IN MX 100 decel IN MX 150 uniwa.uwa.edu.au. IN MX 200 relay1.uu.net IN MX 200 relay2.uu.netchris-mac IN A 130.95.4.5 IN HINFO MAC-II MACOSThe comment character is ';' so the first two lines are just commentsindicating the contents of the file.All values from here on have IN in them. This indicates that the value isan InterNet record. There are a couple of other types, but all you needconcern yourself with is internet ones.The SOA record is the Start Of Authority record. It contains theinformation that other nameservers will learn about this domain and how totreat the information they are given about it. The '@' as the firstcharacter in the line indicates that you wish to define things about thedomain for which this file is responsible. The domain name is found in thenamed.boot file in the corresponding line to this filename. Allinformation listed refers to the most recent machine/domain name so allrecords from the '@' until 'localhost' refer to the '@'. The SOA recordhas 5 magic numbers. First magic number is the serial number. If youchange the file, change the serial number. If you don't, no other nameservers will update their information. The old information will sit aroundfor a very long time.Refresh is the time between refreshing information about the SOA (correctme if I am wrong). Retry is the frequency of retrying if an authorativeserver cannot be contacted. Expire is how long a secondary name serverwill keep information about a zone without successfully updating it orconfirming that the data is up to date. This is to help the informationwithstand fairly lengthy downtimes of machines or connections in thenetwork without having to recollect all the information. Minimum is thedefault time to live value handed out by a nameserver for all records ina zone without an explicit TTL value. This is how long the data will liveafter being handed out. The two pieces of information before the 5 magicnumbers are the machine that is considered the origin of all of thisinformation. Generally the machine that is running your named is a goodone for here. The second is an email address for someone who can fix anyproblems that may occur with the DNS. Good ones here are postmaster,hostmaster or root. NOTE: You use dots and not '@' for the email address.eg root.decel.ecel.uwa.edu.au is correct and root@decel.ecel.uwa.edu.au is incorrect.We now have an address to map ecel.uwa.edu.au to. The address is130.95.4.2 which happens to be decel, our main machine. If you try to findan IP number for the domain ecel.uwa.edu.au it will get you the machinedecel.ecel.uwa.edu.au's IP number. This is a nicety which means thatpeople who have non-MX record mailers can still mail fred@ecel.uwa.edu.auand don't have to find the name of a machine name under the domain to mail.Now we have a couple of MX records for the domain itself. The MX recordsspecify where to send mail destined for the machine/domain that the MXrecord is for. In this case we would prefer if all mail forfred@ecel.uwa.edu.au is sent to decel.ecel.uwa.edu.au. If that does notwork, we would like it to go to uniwa.uwa.edu.au because there are a numberof machines that might have no idea how to get to us, but may be able to getto uniwa. And failing that, try the site relay1.uu.net. A small numberindicates that this site should be tried first. The larget the number thefurther down the list of sites to try the site is. NOTE: Not all machineshave mailers that pay attention to MX records. Some only pay attention toIP numbers, which is really stupid. All machines are required to haveMX-capable Mail Transfer Agents (MTA) as there are many addresses that canonly be reached via this means.There is an entry for localhost now. Note that this is somewhat of akludge and should probably be handled far more elegantly. By placinglocalhost here, a machine comes into existance calledlocalhost.ecel.uwa.edu.au. If you finger it, or telnet to it, you get yourown machine, because the name lookup returns 127.0.0.1 which is the specialcase for your own machine. I have used a couple of different DNS packages.The old BSD one let you put things into the cache which would always work,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -