*BSD News Article 20620


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!doc.ic.ac.uk!pipex!sunic!uts!iesd!herring
From: herring@iesd.auc.dk (B. Erickson Herring)
Subject: [Q NetBSD-0.9] DNS, /etc/hosts, and name-resolution
Message-ID: <HERRING.93Sep8113615@havlit.iesd.auc.dk>
Sender: news@iesd.auc.dk (UseNet News)
Organization: Mathematics and Computer Science, Aalborg University
Date: 08 Sep 1993 10:36:14 GMT
Lines: 48

OK, I've read every *BSD article that was left in our spool, I've read
the FAQ, I've dug through my library, and I've asked everyone who
would listen to me.  Now I am posting to .questions so as not to
presume that I have a bug :-)

We have installed 0.9 from scratch and set it up in our network
(composed of several hundred Sun machines).  When I have an
/etc/resolv.conf file, the following two lines from /etc/netstart
fail (machine doesn't find `localhost') -- that is, /etc/hosts is not
consulted: 

	# set the address for the loopback interface
	ifconfig lo0 inet 127.0.0.1 # localhost
	 
	# use loopback, not the wire
	route add $hostname 127.0.0.1 # localhost

If, after booting, I `mv /etc/resolv.conf /etc/resolv.conf.old' and
then issue the commands by hand, there is no problem -- that is,
/etc/hosts is consulted.

The relevant manpage (gethostbyname(3)) says:

	This structure contains either the information obtained from
	the name server, named(8), or broken-out fields from a line in
	/etc/hosts. If the local name server is not running these
	routines do a lookup in /etc/hosts.

which I interpret to mean "if named is not running on the local
machine, /etc/hosts should be consulted before going to the DNS".

So, what's the deal?  Is there some type of resolver-configuration
file that specifies how names are fromulated into IP addresses?  I
know that in Linux there is an /etc/host.conf file.  The same file
exists on 386bsd.first.gmd.de, which claims to be running FreeBSD.

All input appreciated.  I've started digging through the source, but
it would be nice to know what "expected behavior" is in this
situation.

Thanks, Erick
--
-----
Erick Herring           |  Computation is the art of carefully throwing
H Data, Aalborg         |  away information [and] Life is the art of
UNIX Consulting         |  carefully throwing away opportunities, an 
SysAdmin & Programming  |  interesting coincidental parallel.
herring@iesd.auc.dk     |  - Guy L. Steele Jr.