SUMMARY: Gethostbyname does not work for non-local machines.

From: Brett Lymn (blymn@mulga.awadi.com.AU)
Date: Tue Apr 27 1993 - 12:07:38 CDT


A few days ago I wrote:
>
>
>I have just upgraded one of our machines to 4.1.3 and have hit a snag
>with getting DNS and NIS working together in *this* machine. What happens
>is if I try using some code that used gethostbyname (or gethostbyaddr) then
>I get the error message "Permission denied". I can use this same code
>(which is a couple of short programs I grabbed out of sunsolve) on other
>machines in our network and get the correct answers.
>
>Things I have checked:
>
>1) we do have the -b flag in the makefile of the nis master
>2) done a ypinit -s on the particular machine
>3) running ypxfrd on the machine
>4) check DNS works...it does, I can nslookup all the addresses I like
>5) turned debugging on on the named, when I use the gethostbyname it does
> not get used at all (named I mean)
>
>I am sure I have missed something in the great DNS/NIS merging but I cannot
>see what I have done wrong. I have RTFM and Answerbook and looked in
>sunsolve but cannot see anything appropriate. Any suggestions?
>

Many thanks to all the people that replied AND Sun support who worked
with me on this.

Basically what I had omitted to do was ensure that there was a valid
/etc/resolv.conf file on ALL my NIS servers. Once I put this file in
place and rebooted the NIS server things were fine. One sneaky aspect
is that the machine I had the problem with was set up fine but it had
bound itself (in the NIS sense) to another machine that was not set up
correctly so I was looking for the problem in the wrong place for a
while. Thanks to Randy Diffenderfer for pointing this one out.

BTW The error in errno after the gethostbyname call is bogus, at least
on Suns, as this error is returned even on a successful call so there
is no meaningful error return from gethostbyname. Thanks to Sun support.

Thanks to:
        Christian in the Aus support centre
        Randy Diffenderfer <rdiffe01@cad.gmeds.com>
        stern@sunne.East.Sun.COM (Hal Stern - NE Area Systems Engineer)
        kubipdal@uts.uni-c.dk (Peter Dalg}rd)



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:46 CDT