From owner-freebsd-questions@FreeBSD.ORG Tue Jun 22 18:36:28 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 73D3E16A4CE for ; Tue, 22 Jun 2004 18:36:28 +0000 (GMT) Received: from davidfuchs.ca (domains1.davidfuchs.ca [216.113.197.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2408E43D2D for ; Tue, 22 Jun 2004 18:36:28 +0000 (GMT) (envelope-from david@davidfuchs.ca) Received: from d207-81-106-95.bchsia.telus.net ([207.81.106.95] helo=[190.190.104.2]) by davidfuchs.ca with asmtp (TLSv1:AES256-SHA:256) (Exim 4.30) id 1Bcq7s-00051N-2z for freebsd-questions@freebsd.org; Tue, 22 Jun 2004 11:36:08 -0700 Message-ID: <40D87D0A.3060604@davidfuchs.ca> Date: Tue, 22 Jun 2004 11:40:10 -0700 From: David Fuchs User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: /etc/hosts and /etc/host.conf confusion X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2004 18:36:28 -0000 Hello, 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/hosts 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, no mention of a hosts file anywhere. 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 explicitally states that /etc/hosts will be consulted before bind. 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 daemon to host my domain, not for everyday recursive lookups.) Or does it literally refer to when my local copy of named(8) is not functioning? Thanks in advance for clearing things up for me. -- Thanks, -David Fuchs