Creating DNS (Nameserver) Reverse files
=======================================

The domain name system tries to do inverse name lookups (given the IP number,
find the name of the host). This is done by creating a "reverse" domain called
IN-ADDR.ARPA and each host belonging to this reverse domain by reversing the
hosts IP address. What this means is that:

	NISC.JVNC.NET	is 128.121.50.7
  implies that
	7.50.121.128.in-addr.arpa is NISC.JVNC.NET

Thus, each domain administrator also has to maintain  a reverse domain
file and the set of programs Makefile.rev &  create_inaddr can be used
to facilitate  creating these 'reverse'  files  (because creating them
can be a pain).

create_inaddr
-------------
The idea used  in  'create_inaddr' is that  the nameserver for a given
domain is queried for all the hosts  in the domain  by using  the "ls"
command in nslookup.   This list of hosts is  then sorted and arranged
by the  IP addresses and  the inverse files  are  created for  all the
hosts. The addresses are automatically  sorted on their class (class A
, B, C, D). This program leaves a large number of reverse files in the
current directory with names of the networks.

Thus,   one only needs  to  maintain   the forward mapping files (easy
enough), and then run this progam  to automatically create the reverse
files. One caveat of this method is that you will need to restart your
nameserver  twice - the first time  after you have updated the forward
mapping files  (so that the  nameserver has up-  to date information),
and then after running create_inaddr  and updating your reverse files.
Doesn't seem to be too cumbersome...

The program needs grep, awk, sed besides the other standard Unix stuff
(as if these aren't !!).

The  domain  name (e.g. JVNC.NET) needs to  be supplied on the command
line. Additional args on the command line are the network numbers for
which you want inverse files (else will create for all nets that the
nameserver can list).

Make  sure that the "ls"  command in nslookup works. Also  set the csh
environment  variable  "Server" to the  nameserver  you want to query,
else it will use "localhost".

	% setenv Server idunno.princeton.edu
	% create_inaddr princeton.edu

	- creates 127.inaddr, 128.112.inaddr, 140.180.inaddr, etc

If nothing else, one can probably find a number of surprising bugs/oddities
in their nameserver setup from the resulting output files.

It took about 15 seconds to create all the files for princeton.edu (about 2500
hosts).


Makefile.rev
------------
I was  lazy,   so after  I created all    the   reverse files    using
"create_inaddr", I wanted the "reverse" files be automatically created
and ready to go !! So I wrote this cumbersome Makefile.rev which would
check out the files for me using RCS, then use  something like "mkdep"
to keep the header and update the information, then check the files in
and check them out (this time updating the revision  number in the SOA
record). After a week of playing with "make" and deepening respect for
this unpredictable delectable  software, I finally  came up  with with
Makefile.rev.  This  would  do all that  I wanted to  automate (except
restarting the nameserver).

'create_inaddr' creates files with the ".inaddr" suffix.  Makefile.rev
basically appends this inaddr file onto a template to  create a ".rev"
file which is the final file for the nameserver.  A sample template is
provided in "rev.template". Check this template  and copy/rename it to
<net-address>.rev (e.g.  128.121.rev, 192.12.211.rev,  127.rev).  Then
check REVS1 and REVS2 (I had two REVS since we are the primary for two
domains and the dependencies were differant.  All the other frills are
for automatic checking  out and checking  in and updating the revision
number...

The "cinout" dependency in the makefile substitutes all occurrences of
%I% with the RCS revision number (which it  extracts from the Revision
or Header lines).

See the  comments  on the   top  of the  Makefile.rev  file   for more
information.

A  word  of caution  - since  the   Makefile.rev cinout"  searches for
occurrences of $Header$ or $Revision$, you cannot use  RCS to maintain
revisions  of Makefile.rev itself since it  would replace these search
strings with the revision number, etc. maybe if you could  prevent RCS
from replacing certain occurences of this string...

Comments to me...!!
					Vikas Aggarwal
					vikas@jvnc.net
					December 21, 1990
-------------------------------------------------------------------------
