From owner-freebsd-questions@FreeBSD.ORG Fri Feb 18 08:36:01 2005 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 C4FEB16A4CE for ; Fri, 18 Feb 2005 08:36:01 +0000 (GMT) Received: from gen129.n001.c02.escapebox.net (gen129.n001.c02.escapebox.net [213.73.91.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FADD43D54 for ; Fri, 18 Feb 2005 08:36:01 +0000 (GMT) (envelope-from gemini@geminix.org) Message-ID: <4215A8EC.8090609@geminix.org> Date: Fri, 18 Feb 2005 09:35:56 +0100 From: Uwe Doering Organization: Private UNIX Site User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <20050217215904.G78640@floyd.gnulife.org> In-Reply-To: <20050217215904.G78640@floyd.gnulife.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Received: from gemini by geminix.org with asmtp (TLSv1:AES256-SHA:256) (Exim 3.36 #1) id 1D23cF-00010J-00; Fri, 18 Feb 2005 09:35:59 +0100 Subject: Re: Unexpected resolver behavior 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: Fri, 18 Feb 2005 08:36:01 -0000 Jamie Ostrowski wrote: > > I'm running 4.10-p5 on my workstation at home, and I can't understand > why I cannot get www.foo.com to resolve to an IP I am specifying in > /etc/hosts (I want to over-ride the IP returned by the nameserver I query > by default). > > in /etc/hosts: > > 199.xx.xx.24 www.foo.com. > > in /etc/host.conf: > > # $FreeBSD: src/etc/host.conf,v 1.6 1999/08/27 23:23:41 peter Exp $ > # First try the /etc/hosts file > /etc/hosts > # Now try the nameserver next. > bind > # If you have YP/NIS configured, uncom > > (I have no nsswitch.conf file in /etc) > > But when I try to resolve www.foo.com from the command line, I am getting > the IP address from the nameserver from the outside world rather than the > IP from /etc/hosts. I am not running a local named on this machine, > either. Any ideas? Only programs that use gethostbyname(3) and friends (system library functions) can be expected to take heed of '/etc/host.conf', and therefore '/etc/hosts'. Now, the utility commands that are part of the Bind package, like 'host', 'nslookup' etc., talk to the DNS server directly and ignore what you have in '/etc/hosts'. This can also be true for some applications (MTAs come to mind) that have their own DNS query code because they need DNS information that is not available through system library functions. Uwe -- Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers gemini@geminix.org | http://www.escapebox.net