DNS documentation summary

From: Thomas Kilday (tkilday@sparta.spartacus.com)
Date: Mon Jul 08 1991 - 14:55:33 CDT


        Thanks for all the replys on the DNS documentation
        question I had. Here is a summary of some of the replys:

You can not bet much better the the sun 4.1.1 Systems/Network administration
guide ...

-- 
Michael Shanzer	         shanzer@park.kodak.com
Phone: 716-588-8496         Pager: 716-783-7893

mbk@jacobi.tmc.edu (Matt Kennel) writes: >I can't get SunOS 4.1.1 to use the domain nameserver. We have some >On the other hand, I can do "nslookup" and get the number fine that way, >but it doesn't seem to happen automagically anymore. >What gives?

This question belongs in the "Frequently Asked Questions" file... Below is the instructions to build a new libc... The applications like telnet, finger, etc are linked at runtime to libc... The "vanilla" libc has routines which look for the hosts using yp and in the hosts file, but do not use the nameserver... The trick is to build a libc which has the resolver routines instead of the yp "junk"...

To build the new libc, you have to install the "shareable libraries" option... If you haven't done this, then get it off the cdrom... If you have installed it, then there will be a directory: /usr/lib/shlib.etc... The following README replaces the one in that directory... Just follow the directions... I have done it here at my site and it works fine...

Hope this helps, Brian boyter@fstc-chville.army.mil

------------------------------------------------------------------------- So, without further ado, here is the revised version of the file /usr/lib/shlib.etc/README. I recommend backing up the original, nuke my previous version (the one that Evan re-posted), and insert this in its place.

Greg Earle | "This is Kraft. It uses a blue box. Sun Microsystems, Inc. | This is Stouffer's. It uses red. JPL on-site Software Support | The choice is yours." sun!poseur!earle | Pretty damn convincing argument, eh?

------------- >8 Cut here - /usr/lib/shlib.etc/README 8< ---------------

This is a procedure you can use to substitute or add a module in your shared libc C library.

Note! If you are interested in a System V libc, please substitute libc_pic.a for libcs5_pic.a in step 3, libc.so.x.y.z for libcs5.so.x.y.z in step 8.

1. Become super user % su

2. Make a temporary directory # mkdir tmp

3. Change to the "tmp" directory just made, extract the pic .o from libc_pic.a and rm the file __.SYMDEF. The reason you need to do the 2 (or 3) "mv" commands is because "ar" truncated filenames over 16 characters. # cd tmp # ar x ../libc_pic.a # rm __.SYMDEF # mv rpc_dtablesize. rpc_dtablesize.o # mv rpc_commondata. rpc_commondata.o If on a Sun-4, perform this additional `mv' command: # mv xccs_multibyte. xccs_multibyte.o

Here are some extra instructions for building a shared libc.so that uses the resolver for hostname/addr resolution:

3a. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the tmp directory: # ar x /usr/lib/libresolv.a

The libresolv.a contains object modules that are position independant, so they can be added to the libc_pic modules.

*Note* If you have your own copy of the resolver library sources, (perhaps from a post-4.8 BIND distribution) you can compile each of these modules yourself using `cc -pic' and the resulting object modules *should* be usable in this schema as well. To test that the custom resolver modules will be usable, cd to the directory containing the custom resolver sources and object modules and perform this test:

# ld -assert pure-text *.o

If `ld' issues no complaints, then you can assume that the object modules are safe to use.

3b. Remove the old routine to do the hostname/addr resolution: # rm gethostent.o

3c. Remove the libresolv module that contains `strncasecmp' (which is now in the main C library, so it is redundant): # rm strcasecmp.o

3d. As mentioned in step 5 below, edit the file `lorder-sparc' in the .. directory. Remove the reference to `gethostent.o' and add the references to the resolver library routines by applying this patch:

*** lorder-sparc.orig Thu Feb 8 05:27:46 1990 --- lorder-sparc Mon Apr 9 12:58:59 1990 *************** *** 150,154 **** getwd.o getnetgrent.o ! gethostent.o ypxdr.o ttyname.o --- 150,161 ---- getwd.o getnetgrent.o ! gethostnamadr.o ! sethostent.o ! res_query.o ! res_mkquery.o ! res_send.o ! res_debug.o ! res_comp.o ! res_init.o ypxdr.o ttyname.o

3e. Continue on, from steps 6 to 9 (i.e., skip steps 4 and 5 immediately below).

4. Replace or add the .o that you wanted by doing a copy. Please note here that you are advised to create your object with the following compiler option, i.e "cc -c -pic yourprogram.c" to make it shareable. # cp your.o .

5. If you add a new module then you need to do this step. You need to edit the file "lorder-sparc" and add the name of the file you have copied from step 4 at the end of this file. # vi ../lorder-sparc

6. # cd ..

7. # make libc.so

8. Now you should have some libc.so.x.y.z built in the current directory. It is recommended that you tested out this library at this point before installing it. You can do so by setting the environment LD_LIBRARY_PATH to the current directory for example: # setenv LD_LIBRARY_PATH `pwd` # your_favorite_test_cmd Once you are satisfied that the new library worked, you can proceed to install it with the following commands: # cp libc.so.x.y.z /usr/lib # ldconfig # unsetenv LD_LIBRARY_PATH

9. You are now running with the new library. You can verify this by doing a trace command of let's say "date". # trace date The output should informed you that the new library is being used.

Below is a document I threw together while installing the BIND 4.8.3 resolver code in the shared library on five of our Sun Sparcstation 1+ computers running SunOS 4.1. This should work for any SunOS >= 4.1. Of course, there's never a guarantee... ;-)

Thanks to various Sun Techs and to Usenet for getting me started. The document referred to in the first line below works well for the libresolv.a which came with SunOS 4.1, but our primary name server had minor problems with that resolver - we would get "server failure" errors when trying to resolve anything about our own domain (nau.edu)! We've had BIND 4.8.3 running our primary nameserver for 2 weeks now, no problems whatsoever.

----------------- NEW BIND FOR SUNS 2/11/91 -----------------

[Partially taken from the document "Making a libc.so for DNS without NIS" that has been distributed to various SunOS users, and seen on Usenet.]

This document tells how to install a NEW version of the BIND Name Server resolver routines into the shared C library of a Sparcstation running SunOS 4.1 or greater. The procedure is a bit different when you are trying to install a version of BIND distributed from Berkeley, compared to the (older) resolver library that comes with SunOS.

A. Get BIND version 4.8.3 or later. We must fix the Makefile in the resolver directory to do what our sparcstation needs. The whole idea here is to compile the C source to .o files with the -pic option, and not do anything fancy to the .o files before putting them into the new libresolv.a library. Note that we rename your old libresolv.a file, so that it can be recovered if the new one doesn't work!

cd Bind4.8.3/res vi Makefile Comment out all sets of lines that look something like: -ld -r -x file.o mv a.out file.o Add to the "CFLAGS" variable the option -pic (so that a global tags entry gets added to each .o file) Fix paths and options in Makefile as needed. make mv /usr/lib/libresolv.a /usr/lib/libresolv.a.orig make install

This should have created the new /usr/lib/libresolv.a library.

Please also note that the string(3) man-page which comes with SunOS is more complete than the one distributed with BIND! Therefore you should NOT replace it as instructed to by BIND's README instructions.

B. Follow the steps below to make a new shared library on your Sun which includes the new resolver library routines in it.

1. Become super user by logging in as root, or first as a normal user and then typing: su

2. Move into the shared-lib area and make a temporary directory: cd /usr/lib/shlib.etc mkdir tmp

3. Move into this new directory, extract the pic (position independent code) object files from libc_pic.a and remove the SYMDEF file. The renaming (mv commands) is done because the "ar" command truncates names to 16 characters. cd tmp ar x ../libc_pic.a rm __.SYMDEF mv rpc_dtablesize. rpc_dtablesize.o mv rpc_commondata. rpc_commondata.o mv xccs.multibyte. xccs.multibyte.o

4. We now need to extract the object files from your new libresolv.a library, making sure not to overwrite two of the Sun objects already in this directory: mv mktemp.o mktemp.o2 # else it gets stomped mv strpbrk.o strpbrk.o2 # else it gets stomped ar x /usr/lib/libresolv.a mv strpbrk.o2 strpbrk.o # we gotta use Sun's. mv mktemp.o2 mktemp.o # we gotta use Sun's. (Any other object files that get overwritten are ok.)

[ Alternatively you can extract Sun's original mktemp.o and strpbrk.o files again at this point by typing: ar x ../libc_pic.a mktemp.o strpbrk.o ]

5. Make sure the old host resolver is not still lying around: rm gethostent.o (ignore error "rm: gethostent.o nonexistent" if you see it.)

6. Remove the new resolver's string code because Sun's libraries already includes this, so it would be redundant: rm strcasecmp.o

7. Go back up to the shared library building directory and duplicate the list of object files to use: cd .. cp lorder-sparc lorder-sparc.orig

8. Edit this object file list and make the following modifications if they haven't already been done before to this file: remove: gethostent.o add: gethostnamadr.o sethostent.o res_query.o res_mkquery.o res_send.o res_debug.o res_comp.o res_init.o herror.o strerr.o (the last two are new, which Sun's resolver doesn't use) After deleting gethostent.o, you can use the following patch, or make the changes by hand (in this order):

*************** *** 149,154 **** --- 149,164 ---- listen.o getwd.o getnetgrent.o + gethostnamadr.o + herror.o + sethostent.o + res_query.o + res_mkquery.o + res_send.o + res_debug.o + res_comp.o + res_init.o + strerror.o ypxdr.o ttyname.o setbuffer.o

9. The Makefile in shlib.etc for building shared libraries has one problem when you run it as the super user. So edit it and modify the definition of "OBJSORT" to read:

OBJSORT=./objsort

10. Now we can finally build the shared library. Type: make libc.so

What kind of errors might you get? Here's a couple: a. It blows up on one of the .o files in tmp, saying that the object file is in an inconsistent state. SOLUTION: start over; you did something wrong when you compiled the new libresolv.a in section A, above. Make SURE not to let Makefile "ld" the object files! b. It lists hundreds of error lines about offsets or addresses being wrong in all your resolver .o files. SOLUTION: start over; you needed to specify "-pic" to the C compiler when building the libresolv.a library.

11. If all goes well, you now have a "libc.so.x.y.z" in this directory. Test it out before installing it systemwide! You can do this by pointing your shell's library path variable to the current directory, then trying various networking commands: setenv LD_LIBRARY_PATH `pwd` ping some.host.edu ftp another.host.com telnet someone.else.ca unsetenv LD_LIBRARY_PATH If anything in the library fails, you need to start section B over again. Maybe you forgot to use Sun's versions of mktemp.o and strpbrk.o; things just won't work with BIND's new versions of these files.

12. When you are sure it's working OK, you can install it into the system library directory: cp lib.so.x.y.z /usr/lib chmod 755 /usr/lib/lib.so.x.y.z ldconfig

13. You can prove that you're using the new library now, by watching the output of something like: trace date

The lastest BIND resolver is now installed on your system. You can go ahead and compile and install the other BIND tools such as named, nslookup, etc. You do not need to specify the "-lresolv" library when compiling these tools.

-- Paul Balyoz, Software Specialist II pab@naucse.cse.nau.edu Northern Arizona University root@naucse.cse.nau.edu PO Box 15600, Flagstaff, AZ 86011 pab%naucse@arizona.edu NICname for whois: PB1 ...arizona!naucse!pab

============================= End ======================================

Best regards Gucky

__ _________| |_____________ //-// _____ +-------------------------------+ / Gerhard Holzer (Gucky) | \ | UUCP: tuvie.at!rcvie!cc_gucky / +----------------------------------------+ | Tel : +(431) 39-16-21 / 163 + | Alcatel Austria - ELIN Research Center | | Fax : +(431) 39-14-52 / o \ \ | Ruthnergasse 1-7 | +-+---------------------/ -|- \-+ | A-1210 Vienna - Austria - Europe | | | / \ +----------------------------------------+-+-+ - -

Here is a procedure I got off the net.

# # This Procedure is for sunos 4.1 # (you need about 4megs of free disk space in /usr to do this. if not do a cp -r /usr/lib/shlib.etc to a partition where there is room)

1. cd /usr/lib/shlib.etc ( or where you have coppied it to) 2. mkdir tmp 3. cd tmp 4. ar x ../libc_pic.a (took a while on my machine) 5. ar x /usr/lib/libresolv.a 6. rm __.SYMDEF 7. rm gethostent.o 8. rm strcasecmp.o 9. mv rpc_dtablesize. rpc_dtablesize.o 10. mv rpc_commondata. rpc_commondata.o 11. mv xccs.multibyte. xccs.multibyte.o 12. cd .. 13. vi lorder-sparc

delete the "gethostent.o" line.

add (just after th getnetgrent.o line!):

gethostnamadr.o sethostent.o res_query.o res_mkquery.o res_send.o res_debug.o res_comp.o res_init.o 14. make libc.so 15. When it is done libc.so.0.14.1 is created in the current directory. 16. test new library: setenv LD_LIBRARY_PATH `pwd` (the current directory) telenet nic.ddn.mil (or some other host you want to resolve.)

you should get a cnnection. name was resolved, great.

17. install new library:

cp libc.so.0.14.1 /usr/lib

ldconfig

unsetenv LD_LIBRARY_PATH

18. Happy Resolving!

Thanks again for all the responses!!!

tkilday@sparta.spartacus.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:21 CDT