Hello Fellow Sun-Managers
First of all I really apologise for not reading the FAQ's very closely. I went
through them once, a couple of weeks ago, but sure overlooked the answer.
I got an over whelming response and I am very grateful to everyone who
responded.
Some people got confused with the question. Simply I am using one
sun as the DNS server. All the other machines (SCO, AIX, OS/2, etc ) are using
the Sun's DNS successfully. But the Sun can not resolve hostnames if I remove
sun's /etc/hosts file. The Sun will only look at its own /etc/hosts file.
>From all the responses I got there are two solutions to this as I have it listed
below and mentioned in FAQ's.
1. Re-build the shared library version of libc .... (see below)
2. Run NIS with the "hosts" maps only ... (see below)
I am going to setup NIS and use NIS in conjuction with DNS which seems to be an easier solution.
MY ORIGINAL QUESTION:
--------------------
I am having a problem using /etc/hosts in conjunction with DNS. I am running
SunOS 4.1.3 as a Domain Name Server (DNS) using a Sun SparcStation 2. I have
a hetrogeneous environment with DOS, OS/2 and UNIX machines (e.g OS/2
machines using OS/2 TCP/IP, PC's running SCO UNIX, Solaris x86, UnixWare,
PowerPC's running AIX 3.2, IBM RISC 6000's running AIX 3.x). I only keep
bare /etc/hosts file containing entries for the host itself and the loopback
entry on all these machines.
The interesting part is that all these machines EXCEPT the Sun are using Sun's
Domain Name Services without any problems (i.e.resolve names not in their host
table by querying the Sun). Everytime a new machine is installed all I have to
do is to add the /etc/resolv.conf (UNIX machines) and TCPIP\ETC\RESOLV for
(OS/2 machines) to start using DNS.
I have the same /etc/resolv.conf file on the Sun also, but the Sun refuses to
query itself :-( The Sun will only resolv entries from the /etc/hosts file.
What am I missing ... ?? I really would like to use DNS on the Sun everytime
we update our DNS stuff and not have to make changes in two places.
SOLUTION:
---------
I got similar responses from many people. This is also in section 3 of the FAQ.
I am just going to list it here for your reference. I am going to setup NIS and
use NIS in conjuction with DNS which seems to be an easier solution.
From: Ric Anderson:
===================
1) How to get DNS working when not running NIS ?
Note: Solaris2.x users should see question 64..
The "normal" behavior of a hostname lookup under NIS is to
consult the NIS hosts map and then DNS (if configured). If
you are not running NIS the system will only look in
the /etc/hosts file.
You have two options to correct this situation:
A) Re-build the shared library version of libc with replacement
resolver routines which understand DNS. Resolv+ provides one
of the best sets of replacement routines and it cames with
detailed instructions. Also, it will take of fixing the
many problems with the normal Sun shared library rebuild.
Finally, resolv+ can be obtained from thor.ece.uc.edu.
Get the file /pub/sun-faq/resolv+2.1.1.tar.Z.
Rebuilding the shared library will not allow statically
linked binaries to do name resolving and these binaries
will only use /etc/hosts. You can get "dynamically linked"
replacements for these via anonymous ftp to
thor.ece.uc.edu(129.137.8.118) and get the file
/pub/sun-faq/rcp-mount.dynamic.tar.Z.
This file only contains sun4 binaries.
To be able to rebuild shared libraries you need to
install the "shlib custom" option which is avaiable
with SunOS version 4.1 or greater.
If you want to do it under 4.0.3 you need to get the
patches available from ftp.uu.net(192.48.96.9) in the
/systems/sun/sun-fixes directory. You will need the following
files:
lib.msg, libc_pic.a.sun3 or libc_pic.a.sun4 and
libc_resolv.so.sun3 or libc_resolv.so.sun4
Make sure to get the README that cames with these files.
It is in the same directory.
Note: You can still use NIS for other things in environment,
such as passwd, and group maps.
B) Run NIS with the "hosts" maps only. If you
only need DNS capability than change the "all"
line /var/yp/Makefile to "all: hosts".
It does not require any changes to shared libraries.
See question 2 for complete directoins on how to setup
DNS with NIS.
2) How to get DNS to be used when running NIS ?
First setup the appropriate /etc/resolv.conf file.
Something like this should do the "trick".
;
; Data file for a client.
;
domain local domain
nameserver address of primary domain nameserver
nameserver address of secondary domain nameserver
where: "local domain" is the domain part of the hostnames.
For example, if your hostname is "thor.ece.uc.edu"
your "local domain" is "ece.uc.edu".
You will need to put a copy of this resolv.conf on
all NIS(YP) servers including slaves.
Under SunOS 4.1 and greater, change the "B=" at the top
of the /var/yp/Makefile to "B=-b" and setup NIS in the
usual fashion.
You will need reboot or restart ypserv for these changes
to take affect.
For Method A, ( Thanks to John Murray)
=======================================
-----------------
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.
Original document by Paul Balyoz (pab@naucse.cse.nau.edu).
Updated to include OS4.1.2 information, Hal Pomeranz, 3/3/92.
Minor revisions by Brian Utterback, 4/4/94.
]
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 through SunOs 4.1.3_u1. 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, since most
people do not put "." into root's path. So edit the Makefile
and modify the definition of "OBJSORT" to read:
OBJSORT=./objsort
If you are using SunOS 4.1.2 or later, change the lines
(there are two) in the Makefile which read:
ld -assert pure-text `${OBJSORT} lorder-sparc tmp`
to read
ld -assert pure-text `${OBJSORT} lorder-sparc tmp` -ldl
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.
----------------------------------------------------------------------------
Many thanks to:
tkevans@eplrx7.es.duPont.com (Tim Evans)
pawel@grape.meil.pw.edu.pl (Pawel Marczewski)
bpiatek@nova.gmi.edu (Bradley S. Piatek)
penthesilea.Uni-Trier.DE (Jochen Bern)
xaviers@ucsg.edu.ec (Xavier Salvador)
han@trdlnk.com (Han Tunca)
kumeda@tds.com (Andy Kumeda)
bobr@houston.wireline.SLB.COM (Bob Reardon )
rcw@netrix.com (Ralph Wolman)
ric@Artisoft.COM (Ric Anderson)
marinier@dreo.dnd.ca (Claude Marinier)
crane@cadlab.ECE.Drexel.EDU (Richard Crane)
Nyles.Harris@corp.sun.com (Nyles Harris)
crane@cadlab.ECE.Drexel.EDU (Richard Crane)
kinscoe@ccmail.crc.com (Kevin P. InSCOe)
John.Murray@germany.eu.net (John Murray)
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:02 CDT