-------- Original Message -------- Subject: /etc/hosts and /etc/host.conf confusion Date: Tue, 22 Jun 2004 11:40:10 -0700 From: David Fuchs <[EMAIL PROTECTED]> To: [EMAIL PROTECTED]
I'm having some difficulties understanding the semantics behind the resolver in FreeBSD, and how /etc/host.conf, /etc/hosts, and
/etc/resolv.conf fit together.
The manpage 'host.conf(5)' states:
"The host.conf file holds part of the configuration for the resolver of FreeBSD. It describes what services (e.g., DNS or yp(8)) the C library resolving routines (like gethostbyname(3)) will use, and their order of use, when resolving host names or addresses."
Well that explanation sounds good to me. My /etc/host.conf file looks like this:
# $FreeBSD: src/etc/host.conf,v 1.6 1999/08/27 23:23:41 peter Exp $ # First try the /etc/hosts file hosts # Now try the nameserver next. bind # If you have YP/NIS configured, uncomment the next line # nis
Considering that 'hosts' is listed first, I would expect that any entries I add to /etc/hosts will take precedence over entries retrieved from bind. So, I added an entry to this file for a random IP-to-name mapping, and tested it with the 'host(1)' command, and it failed. When I enable debugging, it clearly shows that it's consulting the first nameserver listed in resolv.conf (an external host), no mention of a hosts file anywhere (or attempt to send a request to the local host).
As an addition to this, the manpage 'hosts(5)' states the following:
"When using the name server named(8), this file provides a backup used when the name server is not running."
Would someone please clarify this, as it seems to contradict my default 'host.conf(5)' file in /etc, which configures the resolver to consult /etc/hosts *before* bind (this behaviour is, of course, stated in the host.conf manpage).
Additionally, what classifies as 'when the name server is not running' - does this mean that /etc/hosts is used when all the nameservers listed in /etc/resolv.conf are unavailable? (As I only use the local named(8) daemon to host my personal domain, not for everyday recursive lookups.) Or does it literally refer to when my local copy of named(8) is not in the process list?
Thanks in advance for clearing things up for me.
-- -David Fuchs
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"