home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Unix / HOWTOs / DNS-HOWT < prev    next >
Text File  |  1999-11-04  |  70KB  |  2,311 lines

  1.   DNS HOWTO
  2.   Nicolai Langfeldt janl@math.uio.no
  3.   v2.0.8, 25 August 1998
  4.  
  5.   HOWTO become a totally small time DNS admin.
  6.   ______________________________________________________________________
  7.  
  8.   Table of Contents
  9.  
  10.  
  11.   1. Preamble
  12.  
  13.      1.1 Legal stuff
  14.      1.2 Credits and request for help.
  15.      1.3 Dedication
  16.  
  17.   2. Introduction.
  18.  
  19.   3. A caching only name server.
  20.  
  21.      3.1 Starting named
  22.  
  23.   4. A
  24.  
  25.      4.1 But first some dry theory
  26.      4.2 Our own domain
  27.      4.3 The reverse zone
  28.  
  29.   5. A real domain example
  30.  
  31.      5.1 /etc/named.conf (or /var/named/named.conf)
  32.      5.2 /var/named/root.hints
  33.      5.3 /var/named/zone/127.0.0
  34.      5.4 /var/named/zone/land-5.com
  35.      5.5 /var/named/zone/206.6.177
  36.  
  37.   6. Maintenance
  38.  
  39.   7. Converting from version 4 to version 8
  40.  
  41.   8. Questions and Answers
  42.  
  43.   9. How to become a bigger time DNS admin.
  44.  
  45.  
  46.  
  47.   ______________________________________________________________________
  48.  
  49.   1.  Preamble
  50.  
  51.   Keywords: DNS, bind, bind-4, bind-8, named, dialup, ppp, slip, isdn,
  52.   Internet, domain, name, hosts, resolving
  53.  
  54.  
  55.   1.1.  Legal stuff
  56.  
  57.   (C)opyright 1995 Nicolai Langfeldt.  Do not modify without amending
  58.   copyright, distribute freely but retain copyright message.
  59.  
  60.  
  61.   1.2.  Credits and request for help.
  62.  
  63.   I want to thank Arnt Gulbrandsen who read the drafts to this work
  64.   countless times and provided many useful suggestions.  I also want to
  65.   thank the people that have e-mailed suggestions and notes.
  66.  
  67.   This will never be a finished document, please send me mail about your
  68.   problems and successes, it can make this a better HOWTO.  So please
  69.   send money, comments and/or questions to janl@math.uio.no.  If you
  70.   send e-mail and want an answer please show the simple courtesy of
  71.   making sure that the return address is correct and working.  Also,
  72.   please read the ``QnA'' section before mailing me.
  73.  
  74.  
  75.   If you want to translate this HOWTO please notify me so I can keep
  76.   track of what languages I have been published in, and also I can
  77.   notify you when the HOWTO has been updated.
  78.  
  79.  
  80.   1.3.  Dedication
  81.  
  82.   This HOWTO is dedicated to Anne Line Norheim Langfeldt.  Though she
  83.   will probably never read it since she's not that kind of girl.
  84.  
  85.  
  86.   2.  Introduction.
  87.  
  88.   What this is and isn't.
  89.  
  90.  
  91.   For starters, DNS is is the Domain Name System.  DNS converts machine
  92.   names to the IP numbers that are all the machines addresses, it maps
  93.   from name to address and from address to name.  This HOWTO documents
  94.   how to define such mappings using a Linux system.  A mapping i simply
  95.   a association between two things, in this case a machine name, like
  96.   ftp.linux.org, and the machines IP number, 199.249.150.4.
  97.  
  98.  
  99.   DNS is, to the uninitiated (you ;-), one of the more opaque areas of
  100.   network administration.  This HOWTO will try to make a few things
  101.   clearer.  It describes how to set up a simple DNS name server.
  102.   Starting with a caching only server and going on to setting up a
  103.   primary DNS server for a domain.  For more complex setups you can
  104.   check the ``QnA'' section of this document.  If it's not described
  105.   there you will need to read the Real Documentation.  I'll get back to
  106.   what this Real Documentation consists of in ``the last chapter''.
  107.  
  108.  
  109.   Before you start on this you should configure your machine so that you
  110.   can telnet in and out of it, and make successfully make all kinds of
  111.   connections to the net, and you should especially be able to do telnet
  112.   127.0.0.1 and get your own machine (test it now!).  You also need a
  113.   good /etc/nsswitch.conf (or /etc/host.conf), /etc/resolv.conf and
  114.   /etc/hosts files as a starting point, since I will not explain their
  115.   function here.  If you don't already have all this set up and working
  116.   the NET-3 and or the PPP-HOWTO explains how to set it up.  Read it.
  117.  
  118.  
  119.   When I say `your machine' I mean the machine you are trying to set up
  120.   DNS on.  Not any other machine you might have that's involved in your
  121.   networking effort.
  122.  
  123.  
  124.   I assume you're not behind any kind of firewall that blocks name
  125.   queries.  If you are you will need a special configuration, see the
  126.   section on ``QnA''.
  127.  
  128.  
  129.   Name serving on Unix is done by a program called named.  This is a
  130.   part of the bind package which is coordinated by Paul Vixie for The
  131.   Internet Software Consortium.  Named is included in most Linux
  132.   distributions and is usually installed as /usr/sbin/named.  If you
  133.   have a named you can probably use it; if you don't have one you can
  134.   get a binary off a Linux ftp site, or get the latest and greatest
  135.   source from ftp.isc.org:/isc/bind/src/cur/bind-8/.  This HOWTO is
  136.   about bind version 8.  The old version of the HOWTO, about bind 4 is
  137.   still available at http://www.math.uio.no/~janl/DNS/ in case you use
  138.   bind 4.  If the named man page talks about named.conf you have bind 8,
  139.   if it talks about named.boot you have bind 4.  If you have 4 and are
  140.   security conscious you really ought to upgrade to a recent 8.
  141.  
  142.  
  143.   DNS is a net-wide database.  Take care about what you put into it.  If
  144.   you put junk into it, you, and others will get junk out of it.  Keep
  145.   your DNS tidy and consistent and you will get good service from it.
  146.   Learn to use it, admin it, debug it and you will be another good admin
  147.   keeping the net from falling to it's knees overloaded by
  148.   mismanagement.
  149.  
  150.  
  151.   In this document I state flatly a couple of things that are not
  152.   completely true (they are at least half truths though).  All in the
  153.   interest of simplification.  Things will (probably ;-) work if you
  154.   believe what I say.
  155.  
  156.  
  157.   Tip: Make backup copies of all the files I instruct you to change if
  158.   you already have them, so if after going through this nothing works
  159.   you can get it back to your old, working state.
  160.  
  161.  
  162.   3.  A caching only name server.
  163.  
  164.   A first stab at DNS config, very useful for dialup users.
  165.  
  166.  
  167.   A caching only name server will find the answer to name queries and
  168.   remember the answer the next time you need it.  This will shorten the
  169.   waiting time the next time significantly, esp. if you're on a slow
  170.   connection.
  171.  
  172.  
  173.   First you need a file called /etc/named.conf.  This is read when named
  174.   starts.  For now it should simply contain:
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.   ______________________________________________________________________
  200.   // Config file for caching only name server
  201.  
  202.   options {
  203.           directory "/var/named";
  204.  
  205.           // Uncommenting this might help if you have to go through a
  206.           // firewall and things are not working out:
  207.  
  208.           // query-source address * port 53;
  209.   };
  210.  
  211.   zone "." {
  212.           type hint;
  213.           file "root.hints";
  214.   };
  215.  
  216.   zone "0.0.127.in-addr.arpa" {
  217.           type master;
  218.           file "pz/127.0.0";
  219.   };
  220.   ______________________________________________________________________
  221.  
  222.  
  223.  
  224.  
  225.   The `directory' line tells named where to look for files.  All files
  226.   named subsequently will be relative to this.  Thus pz is a directory
  227.   under /var/named, i.e., /var/named/pz.  /var/named is the right
  228.   directory according to the Linux File system Standard.
  229.  
  230.  
  231.   The file named /var/named/root.hints is named in this.
  232.   /var/named/root.hints should contain this:
  233.  
  234.  
  235.   ______________________________________________________________________
  236.   .                     6D IN NS        G.ROOT-SERVERS.NET.
  237.   .                     6D IN NS        J.ROOT-SERVERS.NET.
  238.   .                     6D IN NS        K.ROOT-SERVERS.NET.
  239.   .                     6D IN NS        L.ROOT-SERVERS.NET.
  240.   .                     6D IN NS        M.ROOT-SERVERS.NET.
  241.   .                     6D IN NS        A.ROOT-SERVERS.NET.
  242.   .                     6D IN NS        H.ROOT-SERVERS.NET.
  243.   .                     6D IN NS        B.ROOT-SERVERS.NET.
  244.   .                     6D IN NS        C.ROOT-SERVERS.NET.
  245.   .                     6D IN NS        D.ROOT-SERVERS.NET.
  246.   .                     6D IN NS        E.ROOT-SERVERS.NET.
  247.   .                     6D IN NS        I.ROOT-SERVERS.NET.
  248.   .                     6D IN NS        F.ROOT-SERVERS.NET.
  249.  
  250.   G.ROOT-SERVERS.NET.     5w6d16h IN A    192.112.36.4
  251.   J.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.10
  252.   K.ROOT-SERVERS.NET.     5w6d16h IN A    193.0.14.129
  253.   L.ROOT-SERVERS.NET.     5w6d16h IN A    198.32.64.12
  254.   M.ROOT-SERVERS.NET.     5w6d16h IN A    202.12.27.33
  255.   A.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.4
  256.   H.ROOT-SERVERS.NET.     5w6d16h IN A    128.63.2.53
  257.   B.ROOT-SERVERS.NET.     5w6d16h IN A    128.9.0.107
  258.   C.ROOT-SERVERS.NET.     5w6d16h IN A    192.33.4.12
  259.   D.ROOT-SERVERS.NET.     5w6d16h IN A    128.8.10.90
  260.   E.ROOT-SERVERS.NET.     5w6d16h IN A    192.203.230.10
  261.   I.ROOT-SERVERS.NET.     5w6d16h IN A    192.36.148.17
  262.   F.ROOT-SERVERS.NET.     5w6d16h IN A    192.5.5.241
  263.   ______________________________________________________________________
  264.  
  265.   The file describes the root name servers in the world.  This changes
  266.   over time and must be maintained.  See the ``maintenance section'' for
  267.   how to keep it up to date.
  268.  
  269.   The next section in named.conf is the last zone. I will explain its
  270.   use in a later chapter, for now just make this a file named 127.0.0 in
  271.   the subdirectory pz:
  272.  
  273.  
  274.   ______________________________________________________________________
  275.   @               IN      SOA     ns.linux.bogus. hostmaster.linux.bogus. (
  276.                                   1       ; Serial
  277.                                   8H      ; Refresh
  278.                                   2H      ; Retry
  279.                                   1W      ; Expire
  280.                                   1D)     ; Minimum TTL
  281.                           NS      ns.linux.bogus.
  282.   1                       PTR     localhost.
  283.   ______________________________________________________________________
  284.  
  285.  
  286.  
  287.  
  288.   Next, you need a /etc/resolv.conf looking something like this:
  289.  
  290.  
  291.   ______________________________________________________________________
  292.   search subdomain.your-domain.edu your-domain.edu
  293.   nameserver 127.0.0.1
  294.   ______________________________________________________________________
  295.  
  296.  
  297.  
  298.  
  299.   The `search' line specifies what domains should be searched for any
  300.   host names you want to connect to.  The `nameserver' line specifies
  301.   the address of your nameserver at, in this case your own machine since
  302.   that is where your named runs (127.0.0.1 is right, no matter if your
  303.   machine has an other address too).  If you want to list several name
  304.   servers put in one `nameserver' line for each. (Note: Named never
  305.   reads this file, the resolver that uses named does.)
  306.  
  307.  
  308.   To illustrate what this file does: If a client tries to look up foo,
  309.   then foo.subdomain.your-domain.edu is tried first, then foo.your-
  310.   fomain.edu, finally foo.  If a client tries to look up
  311.   sunsite.unc.edu, sunsite.unc.edu.subdomain.your-domain.edu is tried
  312.   first (yes, it's silly, but that's the way it works) , then
  313.   sunsite.unc.edu.your-domain.edu, and finally sunsite.unc.edu.  You may
  314.   not want to put in too many domains in the search line, it takes time
  315.   to search them all.
  316.  
  317.  
  318.   The example assumes you belong in the domain subdomain.your-
  319.   domain.edu, your machine then, is probably called your-
  320.   machine.subdomain.your-domain.edu.  The search line should not contain
  321.   your TLD (Top Level Domain, `edu' in this case).  If you frequently
  322.   need to connect to hosts in another domain you can add that domain to
  323.   the search line like this:
  324.  
  325.  
  326.   ______________________________________________________________________
  327.   search subdomain.your-domain.edu your-domain.edu other-domain.com
  328.   ______________________________________________________________________
  329.  
  330.  
  331.   and so on. Obviously you need to put real domain names in instead.
  332.   Please note the lack of periods at the end of the domain names.
  333.  
  334.  
  335.   Next, depending on your libc version you either need to fix
  336.   /etc/nsswitch.conf or /etc/host.conf.  If you already have
  337.   nsswitch.conf that's what we'll fix, if not, we'll fix host.conf.
  338.  
  339.  
  340.   /etc/nsswitch.conf
  341.  
  342.  
  343.   This is a long file specifying where to get different kinds of data
  344.   types, from what file or database.  It usually contains helpful
  345.   comments at the top, which you should consider reading, now.  After
  346.   that find the line starting with `hosts:', it should read
  347.  
  348.  
  349.   ______________________________________________________________________
  350.   hosts:      files dns
  351.   ______________________________________________________________________
  352.  
  353.  
  354.  
  355.   If there is no line starting with `hosts:' then put in the one above.
  356.   It says that programs should first look in the /etc/hosts file, then
  357.   check DNS according to resolv.conf.
  358.  
  359.  
  360.   /etc/host.conf
  361.  
  362.  
  363.   It probably contains several lines, one should starting with order and
  364.   it should look like this:
  365.  
  366.  
  367.   ______________________________________________________________________
  368.   order hosts,bind
  369.   ______________________________________________________________________
  370.  
  371.  
  372.  
  373.  
  374.   If there is no `order' line you should stick one in.  It tells the
  375.   host name resolving routines to first look in /etc/hosts, then ask the
  376.   name server (which you in resolv.conf said is at 127.0.0.1) These two
  377.   latest files are documented in the resolv(8) man page (do `man 8
  378.   resolv') in most Linux distributions.  That man page is IMHO readable,
  379.   and everyone, especially DNS admins, should read it.  Do it now, if
  380.   you say to yourself "I'll do it later" you'll never get around to it.
  381.  
  382.  
  383.   3.1.  Starting named
  384.  
  385.   After all this it's time to start named.  If you're using a dialup
  386.   connection connect first.  Type `ndc start', and press return, no
  387.   options.  If that back-fires try `/usr/sbin/ndc start' instead.  If
  388.   that back-fires see the ``QnA'' section.  Now you can test your setup.
  389.   If you view your syslog message file (usually called
  390.   /var/adm/messages, but another directory to look in is /var/log and
  391.   another file to look in is syslog) while starting named (do tail -f
  392.   /var/log/messages) you should see something like:
  393.  
  394.  
  395.   (the lines ending in \ continues on the next line)
  396.  
  397.        Feb 15 01:26:17 roke named[6091]: starting.  named 8.1.1 Sat Feb 14 \
  398.          00:18:20 MET 1998 ^Ijanl@roke.uio.no:/var/tmp/bind-8.1.1/src/bin/named
  399.        Feb 15 01:26:17 roke named[6091]: cache zone "" (IN) loaded (serial 0)
  400.        Feb 15 01:26:17 roke named[6091]: master zone "0.0.127.in-addr.arpa" \
  401.          (IN) loaded (serial 1)
  402.        Feb 15 01:26:17 roke named[6091]: listening [127.0.0.1].53 (lo)
  403.        Feb 15 01:26:17 roke named[6091]: listening [129.240.230.92].53 (ippp0)
  404.        Feb 15 01:26:17 roke named[6091]: Forwarding source address is [0.0.0.0].1040
  405.        Feb 15 01:26:17 roke named[6092]: Ready to answer queries.
  406.  
  407.  
  408.  
  409.  
  410.  
  411.   If there are any messages about errors then there is a mistake.  Named
  412.   will name the file it is in (one of named.conf and root.hints I hope
  413.   :-) Kill named and go back and check the file.
  414.  
  415.  
  416.   Now it's time to start nslookup to examine your handy-work.
  417.  
  418.  
  419.  
  420.        $ nslookup
  421.        Default Server:  localhost
  422.        Address:  127.0.0.1
  423.  
  424.        >
  425.  
  426.  
  427.  
  428.  
  429.  
  430.   If that's what you get it's working.  We hope.  Anything else, go back
  431.   and check everything.  Each time you change the named.conf file you
  432.   need to restart named using the ndc restart command.
  433.  
  434.  
  435.   Now you can enter a query.  Try looking up some machine close to you.
  436.   pat.uio.no is close to me, at the University of Oslo:
  437.  
  438.  
  439.  
  440.        > pat.uio.no
  441.        Server:  localhost
  442.        Address:  127.0.0.1
  443.  
  444.        Name:    pat.uio.no
  445.        Address:  129.240.130.16
  446.  
  447.  
  448.  
  449.  
  450.  
  451.   nslookup now asked your named to look for the machine pat.uio.no.  It
  452.   then contacted one of the name server machines named in your
  453.   root.hints file, and asked its way from there.  It might take tiny
  454.   while before you get the result as it searches all the domains you
  455.   named in /etc/resolv.conf.
  456.  
  457.  
  458.   If you ask the same again you get this:
  459.  
  460.  
  461.  
  462.  
  463.   > pat.uio.no
  464.   Server:  localhost
  465.   Address:  127.0.0.1
  466.  
  467.   Non-authoritative answer:
  468.   Name:    pat.uio.no
  469.   Address:  129.240.2.50
  470.  
  471.  
  472.  
  473.  
  474.  
  475.   Note the `Non-authoritative answer:' line we got this time around.
  476.   That means that named did not go out on the network to ask this time,
  477.   it instead looked in it's cache and found it there.  But the cached
  478.   information might be out of date (stale).  So you are informed of this
  479.   (very slight) danger by it saying `Non-authorative answer:'.  When
  480.   nslookup says this the second time you ask for a host it's a sure sign
  481.   that named caches the information and that it's working.  You exit
  482.   nslookup by giving the command `exit'.
  483.  
  484.  
  485.   Now you know how to set up a caching named.  Take a beer, milk, or
  486.   whatever you prefer to celebrate it.
  487.  
  488.  
  489.   4.  A simple  domain.
  490.  
  491.   How to set up your own domain.
  492.  
  493.  
  494.   4.1.  But first some dry theory
  495.  
  496.   Before we really start this section I'm going to serve you some theory
  497.   on how DNS works.  And you're going to read it because it's good for
  498.   you.  If you don't `wanna' you should at least skim it very quickly.
  499.   Stop skimming when you get to what should go in your named.conf file.
  500.  
  501.  
  502.   DNS is a hierarchical system.  The top is written `.' and pronounced
  503.   `root'.  Under . there are a number of Top Level Domains (TLDs), the
  504.   best known ones are ORG, COM, EDU and NET, but there are many more.
  505.  
  506.  
  507.   When looking for a machine the query proceeds recursively into the
  508.   hierarchy starting at the top.  If you want to find out the address of
  509.   prep.ai.mit.edu your name server has to find a name server that serves
  510.   edu.  It asks a . server (it already knows the .  servers, that's what
  511.   the root.hints file is for), the .  server gives a list of edu
  512.   servers:
  513.  
  514.  
  515.  
  516.        $ nslookup
  517.        Default Server:  localhost
  518.        Address:  127.0.0.1
  519.  
  520.  
  521.  
  522.  
  523.   Start asking a root server:
  524.  
  525.  
  526.  
  527.  
  528.  
  529.   > server c.root-servers.net.
  530.   Default Server:  c.root-servers.net
  531.   Address:  192.33.4.12
  532.  
  533.  
  534.  
  535.  
  536.   Set the Query type to NS (name server records):
  537.  
  538.  
  539.  
  540.        > set q=ns
  541.  
  542.  
  543.  
  544.  
  545.   Ask about edu:
  546.  
  547.  
  548.  
  549.        > edu.
  550.  
  551.  
  552.  
  553.  
  554.   The trailing . here is significant, it tells the server we're asking
  555.   that edu is right under . (this narrows the search somewhat).
  556.  
  557.  
  558.  
  559.        edu     nameserver = A.ROOT-SERVERS.NET
  560.        edu     nameserver = H.ROOT-SERVERS.NET
  561.        edu     nameserver = B.ROOT-SERVERS.NET
  562.        edu     nameserver = C.ROOT-SERVERS.NET
  563.        edu     nameserver = D.ROOT-SERVERS.NET
  564.        edu     nameserver = E.ROOT-SERVERS.NET
  565.        edu     nameserver = I.ROOT-SERVERS.NET
  566.        edu     nameserver = F.ROOT-SERVERS.NET
  567.        edu     nameserver = G.ROOT-SERVERS.NET
  568.        A.ROOT-SERVERS.NET      internet address = 198.41.0.4
  569.        H.ROOT-SERVERS.NET      internet address = 128.63.2.53
  570.        B.ROOT-SERVERS.NET      internet address = 128.9.0.107
  571.        C.ROOT-SERVERS.NET      internet address = 192.33.4.12
  572.        D.ROOT-SERVERS.NET      internet address = 128.8.10.90
  573.        E.ROOT-SERVERS.NET      internet address = 192.203.230.10
  574.        I.ROOT-SERVERS.NET      internet address = 192.36.148.17
  575.        F.ROOT-SERVERS.NET      internet address = 192.5.5.241
  576.        G.ROOT-SERVERS.NET      internet address = 192.112.36.4
  577.  
  578.  
  579.  
  580.  
  581.  
  582.   This tells us that *.root-servers.net serves edu., so we can go on
  583.   asking c.  Now we want to know who serves the next level of the domain
  584.   name: mit.edu.:
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.   > mit.edu.
  596.   Server:  c.root-servers.net
  597.   Address:  192.33.4.12
  598.  
  599.   Non-authoritative answer:
  600.   mit.edu nameserver = W20NS.mit.edu
  601.   mit.edu nameserver = BITSY.mit.edu
  602.   mit.edu nameserver = STRAWB.mit.edu
  603.  
  604.   Authoritative answers can be found from:
  605.   W20NS.mit.edu   internet address = 18.70.0.160
  606.   BITSY.mit.edu   internet address = 18.72.0.3
  607.   STRAWB.mit.edu  internet address = 18.71.0.151
  608.  
  609.  
  610.  
  611.  
  612.   steawb, w20ns and bitsy serves mit, select one and inquire about
  613.   ai.mit.edu:
  614.  
  615.  
  616.  
  617.        > server W20NS.mit.edu.
  618.  
  619.  
  620.  
  621.  
  622.   Host names are not case sensitive, but I use my mouse to cut and paste
  623.   so it gets copied as-is from the screen.
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.   Server:  W20NS.mit.edu
  662.   Address:  18.70.0.160
  663.  
  664.   > ai.mit.edu.
  665.   Server:  W20NS.mit.edu
  666.   Address:  18.70.0.160
  667.  
  668.   Non-authoritative answer:
  669.   ai.mit.edu      nameserver = ALPHA-BITS.AI.MIT.EDU
  670.   ai.mit.edu      nameserver = GRAPE-NUTS.AI.MIT.EDU
  671.   ai.mit.edu      nameserver = TRIX.AI.MIT.EDU
  672.   ai.mit.edu      nameserver = MUESLI.AI.MIT.EDU
  673.   ai.mit.edu      nameserver = LIFE.AI.MIT.EDU
  674.   ai.mit.edu      nameserver = BEET-CHEX.AI.MIT.EDU
  675.   ai.mit.edu      nameserver = MINI-WHEATS.AI.MIT.EDU
  676.   ai.mit.edu      nameserver = COUNT-CHOCULA.AI.MIT.EDU
  677.   ai.mit.edu      nameserver = MINTAKA.LCS.MIT.EDU
  678.  
  679.   Authoritative answers can be found from:
  680.   AI.MIT.EDU      nameserver = ALPHA-BITS.AI.MIT.EDU
  681.   AI.MIT.EDU      nameserver = GRAPE-NUTS.AI.MIT.EDU
  682.   AI.MIT.EDU      nameserver = TRIX.AI.MIT.EDU
  683.   AI.MIT.EDU      nameserver = MUESLI.AI.MIT.EDU
  684.   AI.MIT.EDU      nameserver = LIFE.AI.MIT.EDU
  685.   AI.MIT.EDU      nameserver = BEET-CHEX.AI.MIT.EDU
  686.   AI.MIT.EDU      nameserver = MINI-WHEATS.AI.MIT.EDU
  687.   AI.MIT.EDU      nameserver = COUNT-CHOCULA.AI.MIT.EDU
  688.   AI.MIT.EDU      nameserver = MINTAKA.LCS.MIT.EDU
  689.   ALPHA-BITS.AI.MIT.EDU   internet address = 128.52.32.5
  690.   GRAPE-NUTS.AI.MIT.EDU   internet address = 128.52.36.4
  691.   TRIX.AI.MIT.EDU internet address = 128.52.37.6
  692.   MUESLI.AI.MIT.EDU       internet address = 128.52.39.7
  693.   LIFE.AI.MIT.EDU internet address = 128.52.32.80
  694.   BEET-CHEX.AI.MIT.EDU    internet address = 128.52.32.22
  695.   MINI-WHEATS.AI.MIT.EDU  internet address = 128.52.54.11
  696.   COUNT-CHOCULA.AI.MIT.EDU        internet address = 128.52.38.22
  697.   MINTAKA.LCS.MIT.EDU     internet address = 18.26.0.36
  698.  
  699.  
  700.  
  701.  
  702.  
  703.   So museli.ai.mit.edu is a nameserver for ai.mit.edu:
  704.  
  705.  
  706.  
  707.        > server MUESLI.AI.MIT.EDU
  708.        Default Server:  MUESLI.AI.MIT.EDU
  709.        Address:  128.52.39.7
  710.  
  711.  
  712.  
  713.  
  714.  
  715.   Now I change query type, we've found the name server so now we're
  716.   going to ask about everything wheaties knows about prep.ai.mit.edu.
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.   > set q=any
  728.   > prep.ai.mit.edu.
  729.   Server:  MUESLI.AI.MIT.EDU
  730.   Address:  128.52.39.7
  731.  
  732.   prep.ai.mit.edu CPU = dec/decstation-5000.25    OS = unix
  733.   prep.ai.mit.edu
  734.           inet address = 18.159.0.42, protocol = tcp
  735.             ftp  telnet  smtp  finger
  736.   prep.ai.mit.edu preference = 1, mail exchanger = gnu-life.ai.mit.edu
  737.   prep.ai.mit.edu internet address = 18.159.0.42
  738.   ai.mit.edu      nameserver = beet-chex.ai.mit.edu
  739.   ai.mit.edu      nameserver = alpha-bits.ai.mit.edu
  740.   ai.mit.edu      nameserver = mini-wheats.ai.mit.edu
  741.   ai.mit.edu      nameserver = trix.ai.mit.edu
  742.   ai.mit.edu      nameserver = muesli.ai.mit.edu
  743.   ai.mit.edu      nameserver = count-chocula.ai.mit.edu
  744.   ai.mit.edu      nameserver = mintaka.lcs.mit.edu
  745.   ai.mit.edu      nameserver = life.ai.mit.edu
  746.   gnu-life.ai.mit.edu     internet address = 128.52.32.60
  747.   beet-chex.ai.mit.edu    internet address = 128.52.32.22
  748.   alpha-bits.ai.mit.edu   internet address = 128.52.32.5
  749.   mini-wheats.ai.mit.edu  internet address = 128.52.54.11
  750.   trix.ai.mit.edu internet address = 128.52.37.6
  751.   muesli.ai.mit.edu       internet address = 128.52.39.7
  752.   count-chocula.ai.mit.edu        internet address = 128.52.38.22
  753.   mintaka.lcs.mit.edu     internet address = 18.26.0.36
  754.   life.ai.mit.edu internet address = 128.52.32.80
  755.  
  756.  
  757.  
  758.  
  759.  
  760.   So starting at . we found the successive name servers for the next
  761.   level in the domain name.  If you had used your own DNS server instead
  762.   of using all those other servers, your named would of-course cache all
  763.   the information it found while digging this out for you, and it would
  764.   not have to ask again for a while.
  765.  
  766.  
  767.   A much less talked about, but just as important domain is in-
  768.   addr.arpa.  It too is nested like the `normal' domains.  in-addr.arpa
  769.   allows us to get the hosts name when we have it's address.  A
  770.   important thing here is to note that ip#s are written in reverse order
  771.   in the in-addr.arpa domain.  If you have the address of a machine:
  772.   192.128.52.43 named proceeds just like for the prep.ai.mit.edu
  773.   example: find arpa. servers.  Find in-addr.arpa. servers, find 192.in-
  774.   addr.arpa. servers, find 128.192.in-addr.arpa. servers, find
  775.   52.128.192.in-addr.arpa.  servers.  Find needed records for
  776.   43.52.128.192.in-addr.arpa.  Clever huh? (Say `yes'.)  The reversion
  777.   of the numbers can be confusing the first 2 years though.
  778.  
  779.  
  780.   I have just told a lie.  DNS does not work literally the way I just
  781.   told you.  But it's close enough.
  782.  
  783.  
  784.   4.2.  Our own domain
  785.  
  786.   Now to define our own domain.  We're going to make the domain
  787.   linux.bogus and define machines in it.  I use a totally bogus domain
  788.   name to make sure we disturb no-one Out There.
  789.  
  790.  
  791.   One more thing before we start: Not all characters are allowed in
  792.   host-names.  We're restricted to the characters of the English
  793.   alphabet: a-z, and numbers: 0-9 and the character '-' (dash).  Keep to
  794.   those characters.  Upper and lower-case characters are the same for
  795.   DNS, so pat.uio.no is identical to Pat.UiO.No.
  796.  
  797.  
  798.   We've already started this part with this line in named.conf:
  799.  
  800.  
  801.   ______________________________________________________________________
  802.   zone "0.0.127.in-addr.arpa" {
  803.           type master;
  804.           file "pz/127.0.0";
  805.   };
  806.   ______________________________________________________________________
  807.  
  808.  
  809.  
  810.  
  811.   Please note the lack of `.' at the end of the domain names in this
  812.   file.  This says that now we will define the zone 0.0.127.in-
  813.   addr.arpa, that we're the master server for it and that it is stored
  814.   in a file called pz/127.0.0.  We've already set up this file, it
  815.   reads:
  816.  
  817.  
  818.   ______________________________________________________________________
  819.   @               IN      SOA     ns.linux.bogus. hostmaster.linux.bogus. (
  820.                                   1       ; Serial
  821.                                   8H      ; Refresh
  822.                                   2H      ; Retry
  823.                                   1W      ; Expire
  824.                                   1D)     ; Minimum TTL
  825.                           NS      ns.linux.bogus.
  826.   1                       PTR     localhost.
  827.   ______________________________________________________________________
  828.  
  829.  
  830.  
  831.  
  832.   Please note the `.' at the end of all the full domain names in this
  833.   file, in contrast to the named.conf file above. Some people like to
  834.   start each zone file with a $ORIGIN directive, but this is
  835.   superfluous. The origin (where in the DNS hierarchy it belongs) of a
  836.   zone file is specified on the zone section of the named.conf file, in
  837.   this case it's 0.0.127.in-addr.arpa.
  838.  
  839.  
  840.   This `zone file' contains 3 `resource records' (RRs): A SOA RR.  A NS
  841.   RR and a PTR RR.  SOA is short for Start Of Authority.  The `@' is a
  842.   special notation meaning the origin, and since the `domain' column for
  843.   this file says 0.0.127.in-addr.arpa the first line really means
  844.  
  845.  
  846.  
  847.        0.0.127.in-addr.arpa.   IN      SOA ...
  848.  
  849.  
  850.  
  851.  
  852.  
  853.   NS is the Name Server RR.  There is no '@' at the start of this line,
  854.   it is implicit since the last line started with a '@'.  Saves some
  855.   typing that.  So the NS line really reads
  856.  
  857.  
  858.  
  859.   0.0.127.in-addr.arpa.   IN      NS      ns.linux.bogus
  860.  
  861.  
  862.  
  863.  
  864.  
  865.   It tells DNS what machine is the name server of the domain 0.0.127.in-
  866.   addr.arpa, it is ns.linux.bogus.  'ns' is a customary name for name-
  867.   servers, but as with web servers who are customarily named
  868.   www.something the name may be anything.
  869.  
  870.   And finally the PTR record says that the host at address 1 in the
  871.   subnet 0.0.127.in-addr.arpa, i.e., 127.0.0,1 is named localhost.
  872.  
  873.  
  874.   The SOA record is the preamble to all zone files, and there should be
  875.   exactly one in each zone file, the very first record.  It describes
  876.   the zone, where it comes from (a machine called ns.linux.bogus), who
  877.   is responsible for its contents (hostmaster@linux.bogus), what version
  878.   of the zone file this is (serial: 1), and other things having to do
  879.   with caching and secondary DNS servers.  For the rest of the fields,
  880.   refresh, retry, expire and minimum use the numbers used in this HOWTO
  881.   and you should be safe.
  882.  
  883.  
  884.   Now restart your named (the command is ndc restart) and use nslookup
  885.   to examine what you've done:
  886.  
  887.  
  888.  
  889.        $ nslookup
  890.  
  891.        Default Server:  localhost
  892.        Address:  127.0.0.1
  893.  
  894.        > 127.0.0.1
  895.        Server:  localhost
  896.        Address:  127.0.0.1
  897.  
  898.        Name:    localhost
  899.        Address:  127.0.0.1
  900.  
  901.  
  902.  
  903.  
  904.   so it manages to get localhost from 127.0.0.1, good.  Now for our main
  905.   task, the linux.bogus domain, insert a new 'zone' section in
  906.   named.conf:
  907.  
  908.  
  909.   ______________________________________________________________________
  910.   zone "linux.bogus" {
  911.           notify no;
  912.           type master;
  913.           file "pz/linux.bogus";
  914.   };
  915.   ______________________________________________________________________
  916.  
  917.  
  918.  
  919.  
  920.   Note the continued lack of ending `.' on the domain name in the
  921.   named.conf file.
  922.  
  923.  
  924.  
  925.   In the linux.bogus zone file we'll put some totally bogus data:
  926.  
  927.   ______________________________________________________________________
  928.   ;
  929.   ; Zone file for linux.bogus
  930.   ;
  931.   ; The full zone file
  932.   ;
  933.   @       IN      SOA     ns.linux.bogus. hostmaster.linux.bogus. (
  934.                           199802151       ; serial, todays date + todays serial #
  935.                           8H              ; refresh, seconds
  936.                           2H              ; retry, seconds
  937.                           1W              ; expire, seconds
  938.                           1D )            ; minimum, seconds
  939.   ;
  940.                   NS      ns              ; Inet Address of name server
  941.                   MX      10 mail.linux.bogus     ; Primary Mail Exchanger
  942.                   MX      20 mail.friend.bogus.   ; Secondary Mail Exchanger
  943.   ;
  944.   localhost       A       127.0.0.1
  945.   ns              A       192.168.196.2
  946.   mail            A       192.168.196.4
  947.   ______________________________________________________________________
  948.  
  949.  
  950.  
  951.  
  952.   Two things must be noted about the SOA record.  ns.linux.bogus must be
  953.   a actual machine with a A record.  It is not legal to have a CNAME
  954.   record for he machine mentioned in the SOA record.  It's name need not
  955.   be `ns', it could be any legal host name.  Next,
  956.   hostmaster.linux.bogus should be read as hostmaster@linux.bogus, this
  957.   should be a mail alias, or a mailbox, where the person(s) maintaining
  958.   DNS should read mail frequently.  Any mail regarding the domain will
  959.   be sent to the address listed here.  The name need not be
  960.   `hostmaster', it can be any legal e-mail address, but the e-mail
  961.   address `hostmaster' is expected to work as well.
  962.  
  963.  
  964.   There is one new RR type in this file, the MX, or Mail eXchanger RR.
  965.   It tells mail systems where to send mail that is addressed to
  966.   someone@linux.bogus, namely too mail.linux.bogus or mail.friend.bogus.
  967.   The number before each machine name is that MX RRs priority.  The RR
  968.   with the lowest number (10) is the one mail should be sent to
  969.   primarily.  If that fails it can be sent to one with a higher number,
  970.   a secondary mail handler, i.e., mail.friend.bogus which has priority
  971.   20 here.
  972.  
  973.  
  974.   Restart named by running ndc restart.  Examine the results with
  975.   nslookup:
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.   $ nslookup
  992.   > set q=any
  993.   > linux.bogus
  994.   Server:  localhost
  995.   Address:  127.0.0.1
  996.  
  997.   linux.bogus
  998.           origin = ns.linux.bogus
  999.           mail addr = hostmaster.linux.bogus
  1000.           serial = 199802151
  1001.           refresh = 28800 (8 hours)
  1002.           retry   = 7200 (2 hours)
  1003.           expire  = 604800 (7 days)
  1004.           minimum ttl = 86400 (1 day)
  1005.   linux.bogus     nameserver = ns.linux.bogus
  1006.   linux.bogus     preference = 10, mail exchanger = mail.linux.bogus.linux.bogus
  1007.   linux.bogus     preference = 20, mail exchanger = mail.friend.bogus
  1008.   linux.bogus     nameserver = ns.linux.bogus
  1009.   ns.linux.bogus  internet address = 192.168.196.2
  1010.   mail.linux.bogus        internet address = 192.168.196.4
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.   Upon careful examination you will discover a bug.  The line
  1017.  
  1018.  
  1019.  
  1020.        linux.bogus     preference = 10, mail exchanger = mail.linux.bogus.linux.bogus
  1021.  
  1022.  
  1023.  
  1024.  
  1025.   is all wrong.  It should be
  1026.  
  1027.  
  1028.  
  1029.        linux.bogus     preference = 10, mail exchanger = mail.linux.bogus
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.   I deliberately made a mistake so you could learn from it :-) Looking
  1036.   in the zone file we find that the line
  1037.  
  1038.  
  1039.  
  1040.                        MX      10 mail.linux.bogus     ; Primary Mail Exchanger
  1041.  
  1042.  
  1043.  
  1044.  
  1045.   is missing a period.  Or has a 'linux.bogus' too many.  If a machine
  1046.   name does not end in a period in a zone file the origin is added to
  1047.   its end causing the double linux.bogus.linux.bogus.  So either
  1048.  
  1049.  
  1050.   ______________________________________________________________________
  1051.                   MX      10 mail.linux.bogus.    ; Primary Mail Exchanger
  1052.   ______________________________________________________________________
  1053.  
  1054.  
  1055.  
  1056.  
  1057.   or
  1058.  
  1059.  
  1060.   ______________________________________________________________________
  1061.                   MX      10 mail                 ; Primary Mail Exchanger
  1062.   ______________________________________________________________________
  1063.  
  1064.  
  1065.  
  1066.   is correct.  I prefer the latter form, it's less to type.  There are
  1067.   some, knowledgable, bind users that disagree, and some that agree with
  1068.   this.  In a zone file the domain should either be written out and
  1069.   ended with a `.' or it should not be included at all, in which case it
  1070.   defaults to the origin.
  1071.  
  1072.  
  1073.   I must stress that in the named.conf file there should not be `.'s
  1074.   after the domain names.  You have no idea how many times a `.' too
  1075.   many or few have fouled up things and confused the h*ll out of people.
  1076.  
  1077.  
  1078.   So having made my point here is the new zone file, with some extra
  1079.   information in it as well:
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.   ______________________________________________________________________
  1124.   ;
  1125.   ; Zone file for linux.bogus
  1126.   ;
  1127.   ; The full zone file
  1128.   ;
  1129.   @       IN      SOA     ns.linux.bogus. hostmaster.linux.bogus. (
  1130.                           199802151       ; serial, todays date + todays serial #
  1131.                           8H              ; refresh, seconds
  1132.                           2H              ; retry, seconds
  1133.                           1W              ; expire, seconds
  1134.                           1D )            ; minimum, seconds
  1135.   ;
  1136.                   TXT     "Linux.Bogus, your DNS consultants"
  1137.                   NS      ns              ; Inet Address of name server
  1138.                   NS      ns.friend.bogus.
  1139.                   MX      10 mail         ; Primary Mail Exchanger
  1140.                   MX      20 mail.friend.bogus. ; Secondary Mail Exchanger
  1141.  
  1142.   localhost       A       127.0.0.1
  1143.  
  1144.   gw              A       192.168.196.1
  1145.                   HINFO   "Cisco" "IOS"
  1146.                   TXT     "The router"
  1147.  
  1148.   ns              A       192.168.196.2
  1149.                   MX      10 mail
  1150.                   MX      20 mail.friend.bogus.
  1151.                   HINFO   "Pentium" "Linux 2.0"
  1152.   www             CNAME   ns
  1153.  
  1154.   donald          A       192.168.196.3
  1155.                   MX      10 mail
  1156.                   MX      20 mail.friend.bogus.
  1157.                   HINFO   "i486"      "Linux 2.0"
  1158.                   TXT     "DEK"
  1159.  
  1160.   mail            A       192.168.196.4
  1161.                   MX      10 mail
  1162.                   MX      20 mail.friend.bogus.
  1163.                   HINFO   "386sx" "Linux 1.2"
  1164.  
  1165.   ftp             A       192.168.196.5
  1166.                   MX      10 mail
  1167.                   MX      20 mail.friend.bogus.
  1168.                   HINFO   "P6" "Linux 2.1.86"
  1169.   ______________________________________________________________________
  1170.  
  1171.  
  1172.  
  1173.  
  1174.   There are a number of new RRs here: HINFO (Host INFOrmation) has two
  1175.   parts, it's a good habit to quote each.  The first part is the
  1176.   hardware or CPU on the machine, and the second part the software or OS
  1177.   on the machine.  The machine called 'ns' has a Pentium CPU and runs
  1178.   Linux 2.0.  CNAME (Canonical NAME) is a way to give each machine
  1179.   several names.  So www is an alias for ns.
  1180.  
  1181.  
  1182.   CNAME record usage is a bit controversial.  But it's safe to follow
  1183.   the rule that a MX, CNAME or SOA record should never refer to a CNAME
  1184.   record, they should only refer to something with a A record, so it
  1185.   would wrong to have
  1186.  
  1187.  
  1188.  
  1189.   ______________________________________________________________________
  1190.   foobar          CNAME   www                     ; NO!
  1191.   ______________________________________________________________________
  1192.  
  1193.  
  1194.  
  1195.   but correct to have
  1196.  
  1197.  
  1198.   ______________________________________________________________________
  1199.   foobar          CNAME   ns                      ; Yes!
  1200.   ______________________________________________________________________
  1201.  
  1202.  
  1203.  
  1204.  
  1205.   It's also safe to assume that a CNAME is not a legal host name for a
  1206.   e-mail address: webmaster@www.linux.bogus is an ilegal e-mail address
  1207.   given the setup above.  You can expect quite a few mail admins Out
  1208.   There to enforce this rule even if it works for you.  The way to avoid
  1209.   this is to use A records (and perhaps some others too, like a MX
  1210.   record) instead:
  1211.  
  1212.  
  1213.   ______________________________________________________________________
  1214.   www             A       192.168.196.2
  1215.   ______________________________________________________________________
  1216.  
  1217.  
  1218.  
  1219.  
  1220.   A number of the arch-bind-wizards, recommends not using CNAME.  So
  1221.   consider not using it very seriously.
  1222.  
  1223.  
  1224.   But as you see, this HOWTO and many sites does not follow this rule.
  1225.  
  1226.  
  1227.   Load the new database by running ndc reload, this causes named to read
  1228.   its files again.
  1229.  
  1230.  
  1231.  
  1232.        $ nslookup
  1233.        Default Server:  localhost
  1234.        Address:  127.0.0.1
  1235.  
  1236.        > ls -d linux.bogus
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.   This means that all records should be listed.  It results in this:
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.   [localhost]
  1256.   $ORIGIN linux.bogus.
  1257.   @                       1D IN SOA       ns hostmaster (
  1258.                                           199802151       ; serial
  1259.                                           8H              ; refresh
  1260.                                           2H              ; retry
  1261.                                           1W              ; expiry
  1262.                                           1D )            ; minimum
  1263.  
  1264.                           1D IN NS        ns
  1265.                           1D IN NS        ns.friend.bogus.
  1266.                           1D IN TXT       "Linux.Bogus, your DNS consultants"
  1267.                           1D IN MX        10 mail
  1268.                           1D IN MX        20 mail.friend.bogus.
  1269.   gw                      1D IN A         192.168.196.1
  1270.                           1D IN HINFO     "Cisco" "IOS"
  1271.                           1D IN TXT       "The router"
  1272.   mail                    1D IN A         192.168.196.4
  1273.                           1D IN MX        10 mail
  1274.                           1D IN MX        20 mail.friend.bogus.
  1275.                           1D IN HINFO     "386sx" "Linux 1.0.9"
  1276.   localhost               1D IN A         127.0.0.1
  1277.   www                     1D IN CNAME     ns
  1278.   donald                  1D IN A         192.168.196.3
  1279.                           1D IN MX        10 mail
  1280.                           1D IN MX        20 mail.friend.bogus.
  1281.                           1D IN HINFO     "i486" "Linux 1.2"
  1282.                           1D IN TXT       "DEK"
  1283.   ftp                     1D IN A         192.168.196.5
  1284.                           1D IN MX        10 mail
  1285.                           1D IN MX        20 mail.friend.bogus.
  1286.                           1D IN HINFO     "P6" "Linux 1.3.59"
  1287.   ns                      1D IN A         192.168.196.2
  1288.                           1D IN MX        10 mail
  1289.                           1D IN MX        20 mail.friend.bogus.
  1290.                           1D IN HINFO     "Pentium" "Linux 1.2"
  1291.   @                       1D IN SOA       ns hostmaster (
  1292.                                           199802151       ; serial
  1293.                                           8H              ; refresh
  1294.                                           2H              ; retry
  1295.                                           1W              ; expiry
  1296.                                           1D )            ; minimum
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.   That's good.  As you see it looks a lot like the zone file itself.
  1303.   Let's check what it says for www alone:
  1304.  
  1305.  
  1306.  
  1307.        > set q=any
  1308.        > www.linux.bogus.
  1309.        Server:  localhost
  1310.        Address:  127.0.0.1
  1311.  
  1312.        www.linux.bogus canonical name = ns.linux.bogus
  1313.        linux.bogus     nameserver = ns.linux.bogus
  1314.        linux.bogus     nameserver = ns.friend.bogus
  1315.        ns.linux.bogus  internet address = 192.168.196.2
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.   In other words, the real name of www.linux.bogus is ns.linux.bogus,
  1322.   and it gives you some of the information it has about ns as well,
  1323.   enough to connect to it if you were a program.
  1324.  
  1325.  
  1326.   Now we're halfway.
  1327.  
  1328.  
  1329.   4.3.  The reverse zone
  1330.  
  1331.   Now programs can convert the names in linux.bogus to addresses which
  1332.   they can connect to.  But also required is a reverse zone, one making
  1333.   DNS able to convert from an address to a name.  This name is used buy
  1334.   a lot of servers of different kinds (FTP, IRC, WWW and others) to
  1335.   decide if they want to talk to you or not, and if so, maybe even how
  1336.   much priority you should be given.  For full access to all services on
  1337.   the Internet a reverse zone is required.
  1338.  
  1339.  
  1340.   Put this in named.conf:
  1341.  
  1342.  
  1343.   ______________________________________________________________________
  1344.   zone "196.168.192.in-addr.arpa" {
  1345.           notify no;
  1346.           type master;
  1347.           file "pz/192.168.196";
  1348.   };
  1349.   ______________________________________________________________________
  1350.  
  1351.  
  1352.  
  1353.  
  1354.   This is exactly as with the 0.0.127.in-addr.arpa, and the contents are
  1355.   similar:
  1356.  
  1357.  
  1358.   ______________________________________________________________________
  1359.   @       IN      SOA     ns.linux.bogus. hostmaster.linux.bogus. (
  1360.                           199802151 ; Serial, todays date + todays serial
  1361.                           8H      ; Refresh
  1362.                           2H      ; Retry
  1363.                           1W      ; Expire
  1364.                           1D)     ; Minimum TTL
  1365.                   NS      ns.linux.bogus.
  1366.  
  1367.   1               PTR     gw.linux.bogus.
  1368.   2               PTR     ns.linux.bogus.
  1369.   3               PTR     donald.linux.bogus.
  1370.   4               PTR     mail.linux.bogus.
  1371.   5               PTR     ftp.linux.bogus.
  1372.   ______________________________________________________________________
  1373.  
  1374.  
  1375.  
  1376.  
  1377.   Now you restart your named (ndc restart) and examine your work with
  1378.   nslookup again:
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.   ______________________________________________________________________
  1388.   > 192.168.196.4
  1389.   Server:  localhost
  1390.   Address:  127.0.0.1
  1391.  
  1392.   Name:    mail.linux.bogus
  1393.   Address:  192.168.196.4
  1394.   ______________________________________________________________________
  1395.  
  1396.  
  1397.  
  1398.  
  1399.   so, it looks OK, dump the whole thing to examine that too:
  1400.  
  1401.  
  1402.   ______________________________________________________________________
  1403.   > ls -d 196.168.192.in-addr.arpa
  1404.   [localhost]
  1405.   $ORIGIN 196.168.192.in-addr.arpa.
  1406.   @                       1D IN SOA       ns.linux.bogus. hostmaster.linux.bogus. (
  1407.                                           199802151       ; serial
  1408.                                           8H              ; refresh
  1409.                                           2H              ; retry
  1410.                                           1W              ; expiry
  1411.                                           1D )            ; minimum
  1412.  
  1413.                           1D IN NS        ns.linux.bogus.
  1414.   1                       1D IN PTR       gw.linux.bogus.
  1415.   2                       1D IN PTR       ns.linux.bogus.
  1416.   3                       1D IN PTR       donald.linux.bogus.
  1417.   4                       1D IN PTR       mail.linux.bogus.
  1418.   5                       1D IN PTR       ftp.linux.bogus.
  1419.   @                       1D IN SOA       ns.linux.bogus. hostmaster.linux.bogus. (
  1420.                                           199802151       ; serial
  1421.                                           8H              ; refresh
  1422.                                           2H              ; retry
  1423.                                           1W              ; expiry
  1424.                                           1D )            ; minimum
  1425.   ______________________________________________________________________
  1426.  
  1427.  
  1428.  
  1429.  
  1430.   Looks good!
  1431.  
  1432.  
  1433.   There are some things I should add here.  The IP numbers used in the
  1434.   examples above are taken from one of the blocks of 'private nets',
  1435.   i.e., they are not allowed to be used publicly on the internet.  So
  1436.   they are safe to use in an example in a HOWTO.  The second thing is
  1437.   the notify no; line.  It tells named not to notify its secondary
  1438.   (slave) servers when it has gotten a update to one of its zone files.
  1439.   In bind-8 the named can notify the other servers listed in NS records
  1440.   in the zone file when a zone is updated.  This is handy for ordinary
  1441.   use, but for private experiments with zones this feature should be
  1442.   off, we don't want the experiment to pollute the internet do we?
  1443.  
  1444.  
  1445.   And, of course, this domain is highly bogus, and so are all the
  1446.   addresses in it.  For a real example of a real-life domain see the
  1447.   next section.
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.   5.  A real domain example
  1454.  
  1455.   Where we list some real zone files
  1456.  
  1457.  
  1458.   Users have suggested that I include a real example of a working domain
  1459.   as well as the tutorial example.
  1460.  
  1461.  
  1462.   I use this example with permission from David Bullock of LAND-5.
  1463.   These files were current 24th of September 1996, and were then edited
  1464.   to fit bind-8 restrictions and use extensions by me.  So, what you see
  1465.   here differs a bit from what you find if you query LAND-5's name
  1466.   servers now.
  1467.  
  1468.  
  1469.   5.1.  /etc/named.conf (or /var/named/named.conf)
  1470.  
  1471.   Here we find master zone sections for the two reverse zones needed:
  1472.   the 127.0.0 net, as well as LAND-5's 206.6.177 subnet. And a primary
  1473.   line for land-5's forward zone land-5.com. Also note that instead of
  1474.   stuffing the files in a directory called pz, as I do in this HOWTO, he
  1475.   puts them in a directory called zone.
  1476.  
  1477.  
  1478.   ______________________________________________________________________
  1479.   // Boot file for LAND-5 name server
  1480.  
  1481.   options {
  1482.           directory "/var/named";
  1483.   };
  1484.  
  1485.   zone "." {
  1486.           type hint;
  1487.           file "root.hints";
  1488.   };
  1489.  
  1490.   zone "0.0.127.in-addr.arpa" {
  1491.           type master;
  1492.           file "zone/127.0.0";
  1493.   };
  1494.  
  1495.   zone "land-5.com" {
  1496.           type master;
  1497.           file "zone/land-5.com";
  1498.   };
  1499.  
  1500.   zone "177.6.206.in-addr.arpa" {
  1501.           type master;
  1502.           file "zone/206.6.177";
  1503.   };
  1504.   ______________________________________________________________________
  1505.  
  1506.  
  1507.  
  1508.  
  1509.   If you put this in your named.conf file to play with PLEASE put notify
  1510.   no; in the zone sections for the two land-5 zones so as to avoid
  1511.   accidents.
  1512.  
  1513.  
  1514.   5.2.  /var/named/root.hints
  1515.  
  1516.   Keep in mind that this file is dynamic, and the one listed here is
  1517.   old. You're better off using one produced now, with dig, as explained
  1518.   earlier.
  1519.   ______________________________________________________________________
  1520.   ; <<>> DiG 8.1 <<>> @A.ROOT-SERVERS.NET.
  1521.   ; (1 server found)
  1522.   ;; res options: init recurs defnam dnsrch
  1523.   ;; got answer:
  1524.   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10
  1525.   ;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
  1526.   ;; QUERY SECTION:
  1527.   ;;      ., type = NS, class = IN
  1528.  
  1529.   ;; ANSWER SECTION:
  1530.   .                     6D IN NS        G.ROOT-SERVERS.NET.
  1531.   .                     6D IN NS        J.ROOT-SERVERS.NET.
  1532.   .                     6D IN NS        K.ROOT-SERVERS.NET.
  1533.   .                     6D IN NS        L.ROOT-SERVERS.NET.
  1534.   .                     6D IN NS        M.ROOT-SERVERS.NET.
  1535.   .                     6D IN NS        A.ROOT-SERVERS.NET.
  1536.   .                     6D IN NS        H.ROOT-SERVERS.NET.
  1537.   .                     6D IN NS        B.ROOT-SERVERS.NET.
  1538.   .                     6D IN NS        C.ROOT-SERVERS.NET.
  1539.   .                     6D IN NS        D.ROOT-SERVERS.NET.
  1540.   .                     6D IN NS        E.ROOT-SERVERS.NET.
  1541.   .                     6D IN NS        I.ROOT-SERVERS.NET.
  1542.   .                     6D IN NS        F.ROOT-SERVERS.NET.
  1543.  
  1544.   ;; ADDITIONAL SECTION:
  1545.   G.ROOT-SERVERS.NET.     5w6d16h IN A    192.112.36.4
  1546.   J.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.10
  1547.   K.ROOT-SERVERS.NET.     5w6d16h IN A    193.0.14.129
  1548.   L.ROOT-SERVERS.NET.     5w6d16h IN A    198.32.64.12
  1549.   M.ROOT-SERVERS.NET.     5w6d16h IN A    202.12.27.33
  1550.   A.ROOT-SERVERS.NET.     5w6d16h IN A    198.41.0.4
  1551.   H.ROOT-SERVERS.NET.     5w6d16h IN A    128.63.2.53
  1552.   B.ROOT-SERVERS.NET.     5w6d16h IN A    128.9.0.107
  1553.   C.ROOT-SERVERS.NET.     5w6d16h IN A    192.33.4.12
  1554.   D.ROOT-SERVERS.NET.     5w6d16h IN A    128.8.10.90
  1555.   E.ROOT-SERVERS.NET.     5w6d16h IN A    192.203.230.10
  1556.   I.ROOT-SERVERS.NET.     5w6d16h IN A    192.36.148.17
  1557.   F.ROOT-SERVERS.NET.     5w6d16h IN A    192.5.5.241
  1558.  
  1559.   ;; Total query time: 215 msec
  1560.   ;; FROM: roke.uio.no to SERVER: A.ROOT-SERVERS.NET.  198.41.0.4
  1561.   ;; WHEN: Sun Feb 15 01:22:51 1998
  1562.   ;; MSG SIZE  sent: 17  rcvd: 436
  1563.   ______________________________________________________________________
  1564.  
  1565.  
  1566.  
  1567.  
  1568.   5.3.  /var/named/zone/127.0.0
  1569.  
  1570.   Just the basics, the obligatory SOA record, and a record that maps
  1571.   127.0.0.1 to localhost.  Both are required.  No more should be in this
  1572.   file.  It will probably never need to be updated, unless your
  1573.   nameserver or hostmaster address changes.
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.   ______________________________________________________________________
  1586.   @               IN      SOA     land-5.com. root.land-5.com. (
  1587.                                   199609203       ; Serial
  1588.                                   28800   ; Refresh
  1589.                                   7200    ; Retry
  1590.                                   604800  ; Expire
  1591.                                   86400)  ; Minimum TTL
  1592.                           NS      land-5.com.
  1593.  
  1594.   1                       PTR     localhost.
  1595.   ______________________________________________________________________
  1596.  
  1597.  
  1598.  
  1599.  
  1600.   5.4.  /var/named/zone/land-5.com
  1601.  
  1602.   Here we see the mandatory SOA record, the needed NS records.  We can
  1603.   see that he has a secondary name server at ns2.psi.net.  This is as it
  1604.   should be, always have a off site secondary server as backup.  We can
  1605.   also see that he has a master host called land-5 which takes care of
  1606.   many of the different Internet services, and that he's done it with
  1607.   CNAMEs (a alternative is using A records).
  1608.  
  1609.  
  1610.   As you see from the SOA record, the zone file originates at
  1611.   land-5.com, the contact person is root@land-5.com. hostmaster is
  1612.   another oft used address for the contact person.  The serial number is
  1613.   in the customary yyyymmdd format with todays serial number appended;
  1614.   this is probably the sixth version of zone file on the 20th of
  1615.   September 1996.  Remember that the serial number must increase
  1616.   monotonically, here there is only one digit for todays serial#, so
  1617.   after 9 edits he has to wait until tomorrow before he can edit the
  1618.   file again.  Consider using two digits.
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.   ______________________________________________________________________
  1652.   @       IN      SOA     land-5.com. root.land-5.com. (
  1653.                           199609206       ; serial, todays date + todays serial #
  1654.                           8H              ; refresh, seconds
  1655.                           2H              ; retry, seconds
  1656.                           1W              ; expire, seconds
  1657.                           1D )            ; minimum, seconds
  1658.                   NS      land-5.com.
  1659.                   NS      ns2.psi.net.
  1660.                   MX      10 land-5.com.  ; Primary Mail Exchanger
  1661.  
  1662.   localhost       A       127.0.0.1
  1663.  
  1664.   router          A       206.6.177.1
  1665.  
  1666.   land-5.com.     A       206.6.177.2
  1667.   ns              A       206.6.177.3
  1668.   www             A       207.159.141.192
  1669.  
  1670.   ftp             CNAME   land-5.com.
  1671.   mail            CNAME   land-5.com.
  1672.   news            CNAME   land-5.com.
  1673.  
  1674.   funn            A       206.6.177.2
  1675.   @               TXT     "LAND-5 Corporation"
  1676.  
  1677.   ;
  1678.   ;       Workstations
  1679.   ;
  1680.   ws-177200       A       206.6.177.200
  1681.                   MX      10 land-5.com.   ; Primary Mail Host
  1682.   ws-177201       A       206.6.177.201
  1683.                   MX      10 land-5.com.   ; Primary Mail Host
  1684.   ws-177202       A       206.6.177.202
  1685.                   MX      10 land-5.com.   ; Primary Mail Host
  1686.   ws-177203       A       206.6.177.203
  1687.                   MX      10 land-5.com.   ; Primary Mail Host
  1688.   ws-177204       A       206.6.177.204
  1689.                   MX      10 land-5.com.   ; Primary Mail Host
  1690.   ws-177205       A       206.6.177.205
  1691.                   MX      10 land-5.com.   ; Primary Mail Host
  1692.   ; {Many repetitive definitions deleted - SNIP}
  1693.   ws-177250       A       206.6.177.250
  1694.                   MX      10 land-5.com.   ; Primary Mail Host
  1695.   ws-177251       A       206.6.177.251
  1696.                   MX      10 land-5.com.   ; Primary Mail Host
  1697.   ws-177252       A       206.6.177.252
  1698.                   MX      10 land-5.com.   ; Primary Mail Host
  1699.   ws-177253       A       206.6.177.253
  1700.                   MX      10 land-5.com.   ; Primary Mail Host
  1701.   ws-177254       A       206.6.177.254
  1702.                   MX      10 land-5.com.   ; Primary Mail Host
  1703.   ______________________________________________________________________
  1704.  
  1705.  
  1706.  
  1707.  
  1708.   If you examine land-5s nameserver you will find that the host names
  1709.   are of the form ws_number.  As of late bind 4 versions named started
  1710.   enforcing the restrictions on what characters may be used in host
  1711.   names.  So that does not work with bind-8 at all, and I substituted
  1712.   '-' (dash) for '_' (underline).
  1713.  
  1714.  
  1715.   Another thing to note is that the workstations don't have individual
  1716.   names, but rather a prefix followed by the two last parts of the IP
  1717.   numbers.  Using such a convention can simplify maintenance
  1718.   significantly, but can be a bit impersonal, and, in fact, be a source
  1719.   of disgruntlement among your customers.
  1720.  
  1721.  
  1722.   We also see that funn.land-5.com is an alias for land-5.com, but using
  1723.   an A record, not a CNAME record.
  1724.  
  1725.  
  1726.   5.5.  /var/named/zone/206.6.177
  1727.  
  1728.   I'll comment on this file after it.
  1729.  
  1730.  
  1731.   ______________________________________________________________________
  1732.   @               IN      SOA     land-5.com. root.land-5.com. (
  1733.                                   199609206       ; Serial
  1734.                                   28800   ; Refresh
  1735.                                   7200    ; Retry
  1736.                                   604800  ; Expire
  1737.                                   86400)  ; Minimum TTL
  1738.                           NS      land-5.com.
  1739.                           NS      ns2.psi.net.
  1740.   ;
  1741.   ;       Servers
  1742.   ;
  1743.   1       PTR     router.land-5.com.
  1744.   2       PTR     land-5.com.
  1745.   2       PTR     funn.land-5.com.
  1746.   ;
  1747.   ;       Workstations
  1748.   ;
  1749.   200     PTR     ws-177200.land-5.com.
  1750.   201     PTR     ws-177201.land-5.com.
  1751.   202     PTR     ws-177202.land-5.com.
  1752.   203     PTR     ws-177203.land-5.com.
  1753.   204     PTR     ws-177204.land-5.com.
  1754.   205     PTR     ws-177205.land-5.com.
  1755.   ; {Many repetitive definitions deleted - SNIP}
  1756.   250     PTR     ws-177250.land-5.com.
  1757.   251     PTR     ws-177251.land-5.com.
  1758.   252     PTR     ws-177252.land-5.com.
  1759.   253     PTR     ws-177253.land-5.com.
  1760.   254     PTR     ws-177254.land-5.com.
  1761.   ______________________________________________________________________
  1762.  
  1763.  
  1764.  
  1765.  
  1766.   The reverse zone is the bit of the setup that seems to cause the most
  1767.   grief.  It is used to find the host name if you have the IP number of
  1768.   a machine.  Example: you are an IRC server and accept connections from
  1769.   IRC clients.  However you are a Norwegian IRC server and so you only
  1770.   want to accept connections from clients in Norway and other
  1771.   Scandinavian countries.  When you get a connection from a client the C
  1772.   library is able to tell you the IP number of the connecting machine
  1773.   because the IP number of the client is contained in all the packets
  1774.   that are passed over the network.  Now you can call a function called
  1775.   gethostbyaddr that looks up the name of a host given the IP number.
  1776.   Gethostbyaddr will ask a DNS server, which will then traverse the DNS
  1777.   looking for the machine.  Supposing the client connection is from
  1778.   ws-177200.land-5.com.  The IP number the C library provides to the IRC
  1779.   server is 206.6.177.200.  To find out the name of that machine we need
  1780.   to find 200.177.6.206.in-addr.arpa.  The DNS server will first find
  1781.   the arpa. servers, then find in-addr.arpa. servers, following the
  1782.   reverse trail through 206, then 6 and at last finding the server for
  1783.   the 177.6.206.in-addr.arpa zone at land-5.  From which it will finally
  1784.   get the answer that for 200.177.6.206.in-addr.arpa we have a 'PTR
  1785.   ws-177200.land-5.com' record, meaning that the name that goes with
  1786.   206.6.177.200 is ws-177200.land-5.com.  As with the explanation of how
  1787.   prep.ai.mit.edu is looked up, this is slightly fictitious.
  1788.  
  1789.  
  1790.   Getting back to the IRC server example.  The IRC server only accepts
  1791.   connections from the Scandinavian countries, i.e., *.no, *.se, *.dk,
  1792.   the name ws-177200.land-5.com clearly does not match any of those, and
  1793.   the server will deny the connection.  If there was no reverse mapping
  1794.   of 206.2.177.200 through the in-addr.arpa zone the server would have
  1795.   been unable to find the name at all and would have to settle to
  1796.   comparing 206.2.177.200 with *.no, *.se and *.dk, none of which will
  1797.   match.
  1798.  
  1799.  
  1800.   Some people will tell you that reverse lookup mappings are only
  1801.   important for servers, or not important at all.  Not so: Many ftp,
  1802.   news, IRC and even some http (WWW) servers will not accept connections
  1803.   from machines that they are not able to find the name of.  So reverse
  1804.   mappings for machines are in fact mandatory.
  1805.  
  1806.  
  1807.   6.  Maintenance
  1808.  
  1809.   Keeping it working.
  1810.  
  1811.  
  1812.   There is one maintenance task you have to do on nameds, other than
  1813.   keeping them running.  That's keeping the root.hints file updated.
  1814.   The easiest way is using dig, first run dig with no arguments, you
  1815.   will get the root.hints according to your own server.  Then ask one of
  1816.   the listed root servers with dig @rootserver.  You will note that the
  1817.   output looks terribly like a root.hints file.  Save it to a file (dig
  1818.   @e.root-servers.net . ns >root.hints.new) and replace the old
  1819.   root.hints with it.
  1820.  
  1821.  
  1822.   Remember to restart named after replacing the cache file.
  1823.  
  1824.  
  1825.   Al Longyear sent me this script that can be run automatically to
  1826.   update root.hints, install a crontab entry to run it once a month and
  1827.   forget it.  The script assumes you have mail working and that the
  1828.   mail-alias `hostmaster' is defined.  You must hack it to suit your
  1829.   setup.
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.   ______________________________________________________________________
  1850.   #!/bin/sh
  1851.   #
  1852.   # Update the nameserver cache information file once per month.
  1853.   # This is run automatically by a cron entry.
  1854.   #
  1855.   (
  1856.    echo "To: hostmaster <hostmaster>"
  1857.    echo "From: system <root>"
  1858.    echo "Subject: Automatic update of the named.conf file"
  1859.    echo
  1860.  
  1861.    export PATH=/sbin:/usr/sbin:/bin:/usr/bin:
  1862.    cd /var/named
  1863.  
  1864.    dig @rs.internic.net . ns >root.hints.new
  1865.  
  1866.    echo "The named.conf file has been updated to contain the following
  1867.   information:"
  1868.    echo
  1869.    cat root.hints.new
  1870.  
  1871.    chown root.root root.hints.new
  1872.    chmod 444 root.hints.new
  1873.    rm -f root.hints.old
  1874.    mv root.hints root.hints.old
  1875.    mv root.hints.new root.hints
  1876.    ndc restart
  1877.    echo
  1878.    echo "The nameserver has been restarted to ensure that the update is complete."
  1879.    echo "The previous root.hints file is now called
  1880.   /var/named/root.hints.old."
  1881.   ) 2>&1 | /usr/lib/sendmail -t
  1882.   exit 0
  1883.   ______________________________________________________________________
  1884.  
  1885.  
  1886.  
  1887.  
  1888.   Some of you might have picked up that the root.hints file is also
  1889.   available by ftp from Internic.  Please don't use ftp to update
  1890.   root.hints, the above method is much more friendly to the net.
  1891.  
  1892.  
  1893.   7.  Converting from version 4 to version 8
  1894.  
  1895.   This was originally a section on using bind 8 written by David E.
  1896.   Smith (dave@bureau42.ml.org).  I have edited it some to fit the new
  1897.   section name.
  1898.  
  1899.  
  1900.   There's not much to it. Except for using named.conf instead of
  1901.   named.boot, everything is identical. And bind8 comes with a perl
  1902.   script that converts old-style files to new. Example named.boot (old
  1903.   style) for a cache-only name server:σ
  1904.  
  1905.  
  1906.   ______________________________________________________________________
  1907.   directory /var/named
  1908.   cache   .                                     root.hints
  1909.   primary 0.0.127.IN-ADDR.ARPA                    127.0.0.zone
  1910.   primary localhost                               localhost.zone
  1911.   ______________________________________________________________________
  1912.  
  1913.  
  1914.  
  1915.   On the command line, in the bind8/src/bin/named directory (this
  1916.   assumes you got a source distribution. If you got a binary package the
  1917.   script is probably around, I'm not sure where it would be though.
  1918.   -ed.), type:
  1919.  
  1920.  
  1921.   ______________________________________________________________________
  1922.   ./named-bootconf.pl < named.boot > named.conf
  1923.   ______________________________________________________________________
  1924.  
  1925.  
  1926.  
  1927.   Which creates named.conf:
  1928.  
  1929.  
  1930.   ______________________________________________________________________
  1931.   // generated by named-bootconf.pl
  1932.  
  1933.   options {
  1934.           directory "/var/named";
  1935.   };
  1936.  
  1937.   zone "." {
  1938.           type hint;
  1939.           file "root.hints";
  1940.   };
  1941.  
  1942.   zone "0.0.127.IN-ADDR.ARPA" {
  1943.           type master;
  1944.           file "127.0.0.zone";
  1945.   };
  1946.  
  1947.   zone "localhost" {
  1948.           type master;
  1949.           file "localhost.zone";
  1950.   };
  1951.   ______________________________________________________________________
  1952.  
  1953.  
  1954.  
  1955.  
  1956.   It works for everything that can go into a named.boot file, although
  1957.   it doesn't add all of the new enhancements and configuration options
  1958.   that bind8 allows. Here's a more complete named.conf that does the
  1959.   same things, but a little more efficiently.
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.   ______________________________________________________________________
  1982.   // This is a configuration file for named (from BIND 8.1 or later).
  1983.   // It would normally be installed as /etc/named.conf.
  1984.   // The only change made from the `stock' named.conf (aside from this
  1985.   // comment :) is that the directory line was uncommented, since I
  1986.   // already had the zone files in /var/named.
  1987.  
  1988.   options {
  1989.           directory "/var/named";
  1990.           check-names master warn;                /* default. */
  1991.           datasize 20M;
  1992.   };
  1993.  
  1994.   zone "localhost" IN {
  1995.           type master;
  1996.           file "localhost.zone";
  1997.           check-names fail;
  1998.           allow-update { none; };
  1999.           allow-transfer { any; };
  2000.   };
  2001.  
  2002.   zone "0.0.127.in-addr.arpa" IN {
  2003.           type master;
  2004.           file "127.0.0.zone";
  2005.           check-names fail;
  2006.           allow-update { none; };
  2007.           allow-transfer { any; };
  2008.   };
  2009.  
  2010.   zone "." IN {
  2011.           type hint;
  2012.           file "root.hints";
  2013.   };
  2014.   ______________________________________________________________________
  2015.  
  2016.  
  2017.  
  2018.  
  2019.   bind8/src/bin/named/test has this, and copies of the zone files, that
  2020.   many people can just drop in and use instantly.
  2021.  
  2022.  
  2023.   The formats for zone files and root.hints files are identical, as are
  2024.   the commands for updating them.
  2025.  
  2026.  
  2027.   8.  Questions and Answers
  2028.  
  2029.   Please read this section before mailing me.
  2030.  
  2031.  
  2032.   1. My named wants a named.boot file
  2033.  
  2034.  
  2035.      You are reading the wrong HOWTO.  Please see the old version of
  2036.      this HOWTO, which convers bind 4, at
  2037.      http://www.math.uio.no/~janl/DNS/
  2038.  
  2039.  
  2040.   2. How do use DNS from inside a firewall?
  2041.  
  2042.  
  2043.      A couple of hints: `forwarders', `slave', and have a look in the
  2044.      literature list at the end of this HOWTO.
  2045.  
  2046.  
  2047.   3. How do I make DNS rotate through the available addresses for a
  2048.      service, say www.busy.site to obtain a load balancing effect, or
  2049.      similar?
  2050.  
  2051.  
  2052.      Make several A records for www.busy.site and use bind 4.9.3 or
  2053.      later.  Then bind will round-robin the answers.  It will not work
  2054.      with earlier versions of bind.
  2055.  
  2056.  
  2057.   4. I want to set up DNS on a (closed) intranet.  What do I do?
  2058.  
  2059.  
  2060.      You drop the root.hints file and just do zone files.  That also
  2061.      means you don't have to get new hint files all the time.
  2062.  
  2063.  
  2064.   5. How do I set up a secondary (slave) name server?
  2065.  
  2066.  
  2067.      If the primary/master server has address 127.0.0.1 you put a line
  2068.      like this in the named.conf file of your secondary:
  2069.  
  2070.  
  2071.      ___________________________________________________________________
  2072.        zone "linux.bogus" {
  2073.              type slave;
  2074.              file "sz/linux.bogus";
  2075.              masters { 127.0.0.1; };
  2076.        };
  2077.  
  2078.      ___________________________________________________________________
  2079.  
  2080.  
  2081.  
  2082.   You may list several alternate master servers the zone can be copied
  2083.   from inside the masters list, separated by ';' (semicolon).
  2084.  
  2085.  
  2086.   6. I want bind running when I'm disconnected from the net.
  2087.  
  2088.  
  2089.      There are two items regarding this:
  2090.  
  2091.  
  2092.   ╖  I have received this mail from Ian Clark <ic@deakin.edu.au> where
  2093.      he explains his way of doing this:
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.   I run named on my 'Masquerading' machine here. I have
  2114.   two root.hints files, one called root.hints.real which contains
  2115.   the real root server names and the other called root.hints.fake
  2116.   which contains...
  2117.  
  2118.   ----
  2119.   ; root.hints.fake
  2120.   ; this file contains no information
  2121.   ----
  2122.  
  2123.   When I go off line I copy the root.hints.fake file to root.hints and
  2124.   restart named.
  2125.  
  2126.   When I go online I copy root.hints.real to root.hints and restart
  2127.   named.
  2128.  
  2129.   This is done from ip-down & ip-up respectively.
  2130.  
  2131.   The first time I do a query off line on a domain name named doesn't
  2132.   have details for it puts an entry like this in messages..
  2133.  
  2134.   Jan 28 20:10:11 hazchem named[10147]: No root nameserver for class IN
  2135.  
  2136.   which I can live with.
  2137.  
  2138.   It certainly seems to work for me. I can use the nameserver for
  2139.   local machines while off the 'net without the timeout delay for
  2140.   external domain names and I while on the 'net queries for external
  2141.   domains work normally
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.   ╖  I have also received information about how bind interacts with NFS
  2148.      and the portmapper on a mostly offline machine from Karl-Max
  2149.      Wanger:
  2150.  
  2151.  
  2152.  
  2153.  
  2154.        I use to run my own named on all my machines which are only
  2155.        occasionally connected to the Internet by modem. The nameserver only
  2156.        acts as a cache, it has no area of authority and asks back for
  2157.        everything at the nameservers in the root.cache file. As is usual with
  2158.        Slackware, it is started before nfsd and mountd.
  2159.  
  2160.        With one of my machines (a Libretto 30 notebook) I had the problem
  2161.        that sometimes I could mount it from another system connected to my
  2162.        local LAN, but most of the time it didn't work.  I had the same effect
  2163.        regardless of using PLIP, a PCMCIA ethernet card or PPP over a serial
  2164.        interface.
  2165.  
  2166.        After some time of guessing and experimenting I found out that
  2167.        apparently named messed with the process of registration nfsd and
  2168.        mountd have to carry out with the portmapper upon startup (I start
  2169.        these daemons at boot time as usual). Starting named after nfsd and
  2170.        mountd eliminated this problem completely.
  2171.  
  2172.        As there are no disadvantages to expect from such a modified boot
  2173.        sequence I'd advise everybody to do it that way to prevent potential
  2174.        trouble.
  2175.  
  2176.  
  2177.  
  2178.  
  2179.   7. Where does the caching name server store its cache? Is there any
  2180.      way I can control the size of the cache?
  2181.  
  2182.  
  2183.      The cache is completely stored in memory, it is not written to disk
  2184.      at any time.  Every time you kill named the cache is lost.  The
  2185.      cache is not controllable in any way.  named manages it according
  2186.      to some simple rules and that is it.  You cannot control the cache
  2187.      or the cache size in any way for any reason. If you want to you can
  2188.      ``fix'' this by hacking named.  This is however not recommended.
  2189.  
  2190.  
  2191.   8. Does named save the cache between restarts?  Can I make it save it?
  2192.  
  2193.  
  2194.      No, named does not save the cache when it dies.  That means that
  2195.      the cache must be built anew each time you kill and restart named.
  2196.      There is no way to make named save the cache in a file.  If you
  2197.      want you can ``fix'' this by hacking named.  This is however not
  2198.      recommended.
  2199.  
  2200.  
  2201.  
  2202.  
  2203.   9.  How to become a bigger time DNS admin.
  2204.  
  2205.   Documentation and tools.
  2206.  
  2207.  
  2208.   Real Documentation exists.  Online and in print.  The reading of
  2209.   several of these is required to make the step from small time DNS
  2210.   admin to a big time one.  In print the standard book is DNS and BIND
  2211.   by C. Liu and P. Albitz from O'Reilly & Associates, Sebastopol, CA,
  2212.   ISBN 0-937175-82-X.  I read this, it's excellent.  There is also a
  2213.   section in on DNS in TCP/IP Network Administration, by Craig Hunt from
  2214.   O'Reilly..., ISBN 0-937175-82-X.  Another must for Good DNS
  2215.   administration (or good anything for that matter) is Zen and the Art
  2216.   of Motorcycle Maintenance by Robert M. Prisig :-) Available as ISBN
  2217.   0688052304 and others.
  2218.  
  2219.  
  2220.   Online you will find stuff on  <http://www.dns.net/dnsrd/>,
  2221.   <http://www.isc.org/bind.html>; A FAQ, a reference manual (BOG; Bind
  2222.   Operations Guide) as well as papers and protocol definitions and DNS
  2223.   hacks (these, and most, if not all, of the rfcs mentioned below, are
  2224.   also contained in the bind distribution).  I have not read most of
  2225.   these, but then I'm not a big-time DNS admin either.  Arnt Gulbrandsen
  2226.   on the other hand has read BOG and he's ecstatic about it :-).  The
  2227.   newsgroup comp.protocols.tcp-ip.domains is about DNS.  In addition
  2228.   there are a number of RFCs about DNS, the most important are probably
  2229.   these:
  2230.  
  2231.  
  2232.  
  2233.      RFC 2052
  2234.         A. Gulbrandsen, P. Vixie, A DNS RR for specifying the location
  2235.         of services (DNS SRV), October 1996
  2236.  
  2237.  
  2238.      RFC 1918
  2239.         Y. Rekhter, R. Moskowitz, D. Karrenberg, G. de Groot, E. Lear,
  2240.         Address Allocation for Private Internets, 02/29/1996.
  2241.  
  2242.  
  2243.      RFC 1912
  2244.         D. Barr, Common DNS Operational and Configuration Errors,
  2245.         02/28/1996.
  2246.  
  2247.  
  2248.      RFC 1912 Errors
  2249.         B. Barr Errors in RFC 1912, this is available at
  2250.         <http://www.cis.ohio-state.edu/~barr/rfc1912-errors.html>
  2251.  
  2252.  
  2253.      RFC 1713
  2254.         A. Romao, Tools for DNS debugging, 11/03/1994.
  2255.  
  2256.  
  2257.      RFC 1712
  2258.         C. Farrell, M. Schulze, S. Pleitner, D. Baldoni, DNS Encoding of
  2259.         Geographical Location, 11/01/1994.
  2260.  
  2261.  
  2262.      RFC 1183
  2263.         R. Ullmann, P. Mockapetris, L. Mamakos, C. Everhart, New DNS RR
  2264.         Definitions, 10/08/1990.
  2265.  
  2266.  
  2267.      RFC 1035
  2268.         P. Mockapetris, Domain names - implementation and specification,
  2269.         11/01/1987.
  2270.  
  2271.  
  2272.      RFC 1034
  2273.         P. Mockapetris, Domain names - concepts and facilities,
  2274.         11/01/1987.
  2275.  
  2276.  
  2277.      RFC 1033
  2278.         M. Lottor, Domain administrators operations guide, 11/01/1987.
  2279.  
  2280.  
  2281.      RFC 1032
  2282.         M. Stahl, Domain administrators guide, 11/01/1987.
  2283.  
  2284.  
  2285.      RFC 974
  2286.         C. Partridge, Mail routing and the domain system, 01/01/1986.
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.