From owner-freebsd-questions@FreeBSD.ORG Sun Jun 7 04:44:39 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDCA71065672 for ; Sun, 7 Jun 2009 04:44:39 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.221.173]) by mx1.freebsd.org (Postfix) with ESMTP id 9577E8FC16 for ; Sun, 7 Jun 2009 04:44:39 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: by qyk3 with SMTP id 3so3433537qyk.3 for ; Sat, 06 Jun 2009 21:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=AyrSua9rfZ51OmY3/X8BqvtgMdsBDXz/gUaD851XM7U=; b=KlA095utIeGAYpRmfV2xaMDHkqV7ZhZKL62G9+bw7gltFIZvbpHPiDxxCmxDnAXbhY 2N+6ooWmgZ1WVKDYvlko70H90sLUx2JJGGOdy8g5qE/sg4ZSUHNlnqpmL8JdjeuulLNm yAQm2Pe8E1T5w5t8DLDus5sQxt6EKMfNF4odQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Yu4snFDKCQgSwzeeLB/yPMV1BvwKucKBrFTNZr2LuMOftbNA5hZLM+EEdXEMzNhH6G +V3DLimcEoeuZIEyldB7zyc1yhCDqzGYA4oPsU9kpSD03J1u9I/bamv2kS+eOhrni9FJ ZaBNCPfc77WnnmMsCsEP2xkPCmAfOCwP/pJNA= MIME-Version: 1.0 Received: by 10.220.77.79 with SMTP id f15mr3208387vck.2.1244349878897; Sat, 06 Jun 2009 21:44:38 -0700 (PDT) In-Reply-To: <5359c8a6e4fc10bf951a7ee095b0d29f.squirrel@webmail.pknet.net> References: <5359c8a6e4fc10bf951a7ee095b0d29f.squirrel@webmail.pknet.net> Date: Sat, 6 Jun 2009 22:44:38 -0600 Message-ID: From: Tim Judd To: Peter Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions Subject: Re: /etc/hosts - how does that file work?? - was weird nfs issues. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2009 04:44:40 -0000 On 6/4/09, Peter wrote: >> On Thursday 04 June 2009 20:48:21 Peter wrote: >>> iH, >>> This all started with NFS not mounting at boot....so, testing in VMs: >> >> >> >>> Why is ping using one IP, and ssh/mount_nfs/showmount using another IP > from /etc/hosts? >> >> Q: Where is described that name resolution for A or PTR records should > be >> returned in a fixed order and that a consumer should always use the > first >> one >> returned? >> A: Nowhere. Name servers are encouraged to do round-robin returns if not > specified otherwise. Applications may sort/pick at their own leisure. >> >> -- >> Mel > > I do not think /etc/hosts does round robin, I always assumed first match > wins...DNS/bind I would understand... > > Why does ping always return the 172.20.6.1 address, > and ftp,nc,ssh,telnet,fetch _always_ uses the 116 address? > > I would assume at least sometimes it would hit the 172 address with > anything besides ping - but it only ping hits the 172 address... > If so, I'd guess there would be consistency between ping lookups and > 'telnet/ssh/etc' lookups... > > Why if the 116.23.45.3 last octet is bumped up, everything _always_ > returns the 172 address? > > client# grep server /etc/hosts > 172.20.6.1 server.test server > 116.23.45.5 server.test server > client# telnet server > Trying 172.20.6.1... > telnet: connect to address 172.20.6.1: Connection refused > Trying 116.23.45.5... > > /etc/hosts - 'server' changed to > 116.23.45.3: > > client# telnet server > Trying 116.23.45.3... > telnet: connect to address 116.23.45.3: Operation timed out > Trying 172.20.6.1... > telnet: connect to address 172.20.6.1: Connection refused > telnet: Unable to connect to remote host > > if server has ip>116.23.45.3, it always uses the 172 address first... > > but ping always uses the 172... > even if third entry is added into /etc/hosts - nothing ever uses it as the > first/primary IP. > > Is there an algorithm based on IP/program being used and the returned IP? > I can't sit and watch this thread anymore. Something itchin' to say: DNS, who can handle multiple A records in an optional round-robin design, is perfectly fine to assign multiple A records to a resource. /etc/hosts, which as always existed (back when the Internet was created/new), was a unique record source only. Having oddities in /etc/hosts is expected IMHO when a "mistake" like multiple resources assigned different records. What's to stop you from creating slightly different records in /etc/hosts? Whats to stop you from hitting 'privserver' and 'pubserver', for private and public IPs respectively. why are you so hung up on dual IPs for a single host? would dnsmasq provide a solution to dual A records for one resource? I'll help, when I can. but forcing this on /etc/hosts is a dead end.