Subject: Re: nslookup and hosts on local net
To: Mark E. Perkins <perkinsm@bway.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 03/28/2002 23:55:37
On Thu, Mar 28, 2002 at 05:16:49PM -0500, Mark E. Perkins wrote:
> How do I get nslookup to return the IP address of hosts on my local net? 
> This probably applies to gethostbyname(), as well. To be more specific:
> 
> * I'm using 192.168.x.y addresses
> 
> * None of my local hosts have FQDNs; they're all things like 'netbsd1' 
> 'printserver', etc.
> 
> /etc/hosts looks thusly:
> 192.168.1.1  netbsd1
> 192.168.1.2  printserver
>   (and so on)
> 
> /etc/resolv.conf has the line:
> lookup file bind
> (though I understand from the man pages that this is ignored)
> 
> /etc/nsswitch.conf has the line:
> hosts:          files dns
> 
> /etc/rc.conf has the line
> domainname=""
> 
> Nevertheless, if I say 'nslookup printserver' I get a "Non-existent 
> host/domain" error back from the name server at my ISP. (I almost never 
> want to do this, but some programs use gethostbyname() for a local network 
> host and ending up failing....)

nslookup doesn't use gethostbyname(), it does direct query to the DNS (it's
a DNS debug tool after all, and can return much more infos than gethostbyname()
can).

gethostbyname() should honnor the nsswitch.conf settings.
What's wrong with it ? Doesn't 'ping netbsd1' or 'ping printserver' work ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--