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 is > never reading from /etc/hosts, where I have this line: > 127.0.0.1 localhost > > 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 > > ** server can't find localhost: NXDOMAIN > > 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...
% 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.
--
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey
signature.asc
Description: OpenPGP digital signature
