Path: vixie!dungeon!jimmy@phri.nyu.edu
From: dungeon!jimmy@phri.nyu.edu (Jimmy Kyriannis)
Newsgroups: local.mail.dns.names
Subject: Re: SunOS 4.1.3 & DNS w/o NIS?
Date: 15 Mar 1994 22:07:08 -0800
Organization: Vixie Enterprises
Lines: 97
Sender: daemon@vix.com
Distribution: local
Message-ID: <199403160442.XAA00610@dungeon>
NNTP-Posting-Host: gw.home.vix.com
X-To: namedroppers@nic.ddn.mil, coffinda@srs.gov
X-Cc: jimmy@phri.nyu.edu
X-Content-Type: text
X-Content-Length: 3412

>   I must be doing most things right.  I set up a SPARCstation for someone 
>   at our site.  I set it up as a cache-only name server pointing at a site 
>   nameserver.  It all works.  I can nslookup either by specifying the local 
>   machine (127.0.0.1) or the site name server as the first address in the 
>   resolv.conf file.
>   
>   My problem is that I had attempted to set this up without using NIS, but 
>   name resolution didn't work until I started using NIS (as if it couldn't 
>   find the name server.)  It seems to me that there must be a way to use 
>   DNS without NIS (using SunOS 4.1.3.)
>   
>   If it ought to work, and I've only experienced an anomoly, can anyone 
>   propose a fix and/or a circumstance under which I'd experience this?
>   
>   Any help or information will be appreciated.
>   
>   Dave Coffin
>   coffinda@srs.gov
>   


This is an easy one...  the SunOS C library (pre SunOS v5.x) uses only NIS
lookup routines for hostname resolution.  You haven't done a thing wrong; Sun
just wants the whole world to run NIS intead of DNS.

To fix this problem, you have to rebuild libc, replacing the NIS hostname
resolution routines with DNS routines.


Here's exactly what you have to do:

0- su root
1- cd /usr/lib/shlib.etc

If there are no files in this directory, you have to run suninstall and install
the "shlib custom" stuff.

2- mkdir tmp; cd tmp
3- ar x ../libc_pic.a
4- ar x /usr/lib/libresolv.a
5- rm __.SYMDEF
6- mv rpc_dtablesize. rpc_dtablesize.o
7- mv rpc_commondata. rpc_commondata.o
8- rm gethostent.o
9- rm strcasecmp.o
10- cd ..

11- Edit the Makefile, and add "-ldl" right after the "ld" in the ld commands.
    (This should not be done on a pre-SunOS v4.1.2 box.)

12- Edit the file "lorder-sparc", removing the NIS gethostname routine and
    replace it with the DNS routines:
        - delete the line containing the entry "gethostent.o" and insert the
          following 8 lines in its place:
                gethostnamadr.o
                sethostent.o
                res_query.o
                res_mkquery.o
                res_send.o
                res_debug.o
                res_comp.o
                res_init.o

13- Create the new library with the command "make libc.so".  This will create
    a file called "libc.so.i.j.k", where i, j & k are the version numbers of
    your library.

14- To test your new library, type (from csh) "setenv LD_LIBRARY_PATH `pwd`"
    while staying in the current directory (/usr/lib/shlib.etc).  You should
    now be able to ftp, telnet, ping, etc. any host on the Net.

15- Once you're convinced things are fine, install the library into the system:
       - cp -p libc.so.i.j.k /usr/lib
         ldconfig
         unsetenv LD_LIBRARY_PATH


Now, these steps will not make NIS hostname lookups possible; it's either NIS
or DNS - not both.  The only reason I can think of wanting to use NIS lookups
would be to support diskless clients.  I'm sure you can even get that to work
with DNS, but I haven't had the time to work it out.

If you ever want to switch back to NIS lookups, you can either do it
temporarily by setting LD_LIBRARY_PATH to a directory containing a copy of
only the older libc, or you can just remove the library you just built.


Let me know if you have any problems,


Jimmy Kyriannis

--------------------------
dungeon!jimmy@phri.nyu.edu

"Do... or do not.  There is no try."   - Yoda

