[comp.sys.sun] gethostbyname and nameserver resolution

mike@husc6.harvard.edu (Michael Cohen) (01/24/89)

Routines like ftp rlogin telnet ... do not normally have access to
nameserver resolution because neither yellow pages routines, nor
gethostbyname calls the resolver routines.  Sun has provided a standard
library of routines in /usr/lib/libresolv.a which do query the resolver,
and not the yellow pages.  The standard library of calls query the yellow
pages and not the resolver.  As a result, local yellow page masters have
to keep a hugh host table around if they want broad access.  Good access
to remote hosts only seems possible via nslookup.  Sun should properly
integrate name server queries, especially for routines like gethostbyname
with resolver routines so that they know how to use domain/nameservers.

bob@kahala.hig.hawaii.edu (Bob Cunningham) (02/01/89)

>Routines like ftp rlogin telnet ... do not normally have access to
>nameserver resolution because neither yellow pages routines, nor
>gethostbyname calls the resolver routines.

The yellow pages routines will iff you use the -b flag on makedbm for the
hosts.byname and hosts.byaddr (for inverse lookups).  This is documented
(albeit somewhat obscurely) in the manual page for makedbm in SunOS4.0).
This means modifying /var/spool/Makefile roughly as follows (your line
numbers will vary):

65c65
<                   | $(MAKEDBM) -b - $(YPDBDIR)/$(DOM)/hosts.byname; \
---
>                   | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/hosts.byname; \
68c68
<                   | $(MAKEDBM) -b - $(YPDBDIR)/$(DOM)/hosts.byaddr; \
---
>                   | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/hosts.byaddr; \

This effectively forces ypserv to resolve through the nameserver.

There are still some problems with this (ypserv lookups may not properly
time out, hosts with single-character names are not treated right, etc.),
up through SunOS4.0.1.  Previous versions also had other problems as well
(the special yp map entry created by that flag didn't propagate to slave
servers, etc.).  I highly recommend you actually use the ypserv and other
routines in the  ~ftp/sun-fixes/ddn.tar.Z kit available via anonymous ftp
from uunet.uu.net which has the latest versions of all the pieces you'll
need, including pieces that will work with SunOS releases going back to
SunOS3.5.

Also available in ~ftp/sun-fixes are sharable libc_resolv.so files,
updated versions of ypbind and in.ftpd and other items, all kindly
contributed in the public interest by the network development folks at Sun
and (I hope) all to be included in SunOS4.0.2.

[[ As I understand it, this does not work very well at all under 4.0, it
works in most cases under 4.0.1, and should work quite well under 4.0.2.
See v7n122.  --wnl ]]

jgarb@erim.org (Joe Garbarino) (02/01/89)

I don't know what version of the OS you're running, but I am running SunOS
V4.0.1 and am accessing the nameserver.  It required me to edit the
Makefile for the yp (/var/yp/Makefile) and change the makedbm to makedbm
-b for the hosts database.

The nameserver was also available in V3.5.  To use it required the yp
server be started up as ypserv -i

Unfortunately, this information is not clearly documented for V4.0 (under
the makedbm command switch -b), and not at all for V3.5.

	Joe Garbarino
	ERIM
	P.O. Box 8618
	Ann Arbor, Mi.  48107
	(313)994-1200 x2508
	jgarb@csd360b.erim.org