Date: Thu, 14 Feb 2013 23:02:37 +0000 From: Matthew Seaman <matthew@FreeBSD.org> To: Martin Pola <martin.pola@kottnet.net> Cc: freebsd-questions@freebsd.org Subject: Re: Cannot resolve localhost Message-ID: <511D6D0D.4090607@FreeBSD.org> In-Reply-To: <wde4r3glj3qd2trs7jp8app3.1360881125775@email.android.com> References: <wde4r3glj3qd2trs7jp8app3.1360881125775@email.android.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?511D6D0D.4090607>