From owner-freebsd-questions@FreeBSD.ORG Thu Feb 14 23:02:54 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9457C6B3 for ; Thu, 14 Feb 2013 23:02:54 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id 2CADA273 for ; Thu, 14 Feb 2013 23:02:54 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.2.117.99]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.6/8.14.6) with ESMTP id r1EN2jVx019555 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 14 Feb 2013 23:02:46 GMT (envelope-from matthew@FreeBSD.org) DKIM-Filter: OpenDKIM Filter v2.7.4 smtp.infracaninophile.co.uk r1EN2jVx019555 Authentication-Results: smtp.infracaninophile.co.uk/r1EN2jVx019555; dkim=none reason="no signature"; dkim-adsp=none (insecure policy) Message-ID: <511D6D0D.4090607@FreeBSD.org> Date: Thu, 14 Feb 2013 23:02:37 +0000 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Martin Pola Subject: Re: Cannot resolve localhost References: In-Reply-To: X-Enigmail-Version: 1.5 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2MOWPDNQIUIAINEBDFLPP" X-Virus-Scanned: clamav-milter 0.97.6 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2013 23:02:54 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2MOWPDNQIUIAINEBDFLPP Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 14/02/2013 22:35, Martin Pola wrote: > I'm trying to get my FreeBSD system to resolve localhost into > 127.0.0.1, but unfortunately it doesn't work. It appears the resolver i= s > never reading from /etc/hosts, where I have this line: > 127.0.0.1 localhost >=20 > Here's a sample output of what I get when I try to resolve the name: > $ nslookup localhost > ;; Got recursion not available from 91.90.24.250, trying next server > Server: 8.8.8.8 > Address: 8.8.8.8#53 > =20 > ** server can't find localhost: NXDOMAIN > =20 > What am I missing? The understanding that looking stuff up in the DNS[*] is never going to return anything from the contents of your /etc/hosts file? You can do a more generic lookup using whatever means are configured in your /etc/nsswitch.conf by: % getent hosts localhost ::1 localhost 127.0.0.1 localhost although with localhost, that really should also be available in the DNS, both forwards and reverse: % dig +short IN A localhost 127.0.0.1 % dig +short IN AAAA localhost ::1 % dig +short -x 127.0.0.1 localhost. % dig +short -x ::1 localhost. Although I note that Google's DNS resolver specifically *doesn't* have it= =2E.. % dig +short @8.8.8.8 -x ::1 % dig +short @8.8.8.8 -x 127.0.0.1 % dig +short @8.8.8.8 localhost % dig +short @8.8.8.8 IN AAAA localhost Just a peculiarity of the Google DNS service. Cheers, Matthew [*] BTW. nslookup is *so* 20th Century. All the cool kids are using dig(1) or drill(1) nowadays. --=20 Dr Matthew J Seaman MA, D.Phil. PGP: http://www.infracaninophile.co.uk/pgpkey ------enig2MOWPDNQIUIAINEBDFLPP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlEdbRUACgkQ8Mjk52CukIy5AQCeMv7neb856HuOclqnX8DTFOu+ NdoAoIeV0L73ta3zcN1xusl7Y9TgpatA =mr6u -----END PGP SIGNATURE----- ------enig2MOWPDNQIUIAINEBDFLPP--