Subject: bin/10839: Problem with host lookups using /etc/hosts
To: None <gnats-bugs@gnats.netbsd.org>
From: Tyler Mitchell <fission@isotope.iball.org>
List: netbsd-bugs
Date: 08/15/2000 15:32:17
>Number:         10839
>Category:       bin
>Synopsis:       IP addresses are in /etc/hosts but in some situations programs don't seem to find them
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 15 15:33:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Tyler Mitchell <fission@mb.sympatico.ca>
>Release:        20000620-1.5_ALPHA
>Organization:
	n/a
>Environment:
	System: NetBSD isotope.iball.org 1.5_ALPHA NetBSD 1.5_ALPHA (GENERIC) #2: Thu Jun 22 13:59:59 PDT 2000 matt@cheetah.local:/other/kobj/vax/GENERIC vax
	Computer: MicroVAX 3100/30 w/8MB RAM and KA48 CPU

>Description:
I have a small LAN set up with no DNS server, only entries in /etc/hosts.  The /etc/nsswitch.conf file has been updated to reflect this (hosts: files dns) and the entries for the few computers I have are added in /etc/hosts.  Here is my /etc/hosts file:

#       $NetBSD: hosts,v 1.5 2000/02/05 17:53:30 itojun Exp $
#
# Host Database
# This file should contain the addresses and aliases
# for local hosts that share this file.
# It is used only for "ifconfig" and other operations
# before the nameserver is started.
#
#
127.0.0.1               localhost
::1                     localhost
#
# RFC 1918 specifies that these networks are "internal".
# 10.0.0.0      10.255.255.255
# 172.16.0.0    172.31.255.255
# 192.168.0.0   192.168.255.255

192.168.0.11    isotope         isotope.iball.org
192.168.0.1     nucleus         nucleus.iball.org
192.168.0.10    positron        positron.iball.org
# End of /etc/hosts.

My local host name is 'isotope'.  When telnetting in from hosts like 'nucleus', "who" shows the following:

fission  console  Aug 15 14:37
fission  ttyp0    Aug 15 14:42  (192.168.0.1)

even though that host is plainly in the /etc/hosts file, and the /etc/nsswitch.conf file is correctly set.  The /etc/resolv.conf file has entries for my ISP's DNS servers.  192.168.0.1 is a computer doing NAT over PPP.  "telnet nucleus" works just fine, which is why I am confused.  An interesting thing to note: during the telnet process (when I telnet from nucleus to isotope), a ps -aux on isotope shows:
	root    374 32.6  6.7  28  528 p1 Rs+   4:50PM 0:01.00 login -h 192.168.0.1 -p
Even though it should show the host name 'nucleus' instead of the IP address.  Now, this isn't a very big problem - the problem comes in when DNS servers are unavailable (ie, when 'nucleus' has disconnected PPP).  When I try to telnet to 'isotope' when DNS servers are unavailable, I get about a 60-second delay between the login name and the password prompts.  Same thing for 'su', it will take some time for it to display the password prompt if DNS servers are unavailable.

I have a computer running 1.4.2 with much the same set-up - the only difference is that its hostname is qualified.  I've tried to qualify my hostname here (as isotope.iball.org) but it makes no difference.

>How-To-Repeat:
	Just implement a similar setup to my own, described in the "Desctiption:" section.
>Fix:
	I know of no fix for this problem.
>Release-Note:
>Audit-Trail:
>Unformatted: