Re: #host localhost



On Fri, 27 Jul 2007 17:45:44 -0400, Oliver Cromm <lispamateur@xxxxxxxx> wrote:
Is there nothing one can do about "host localhost" showing nonsense?

Sure there is:

$ host localhost
localhost.laptop has address 127.0.0.1
$ host 127.0.0.1
1.0.0.127.in-addr.arpa domain name pointer localhost.laptop.
$ cat /etc/resolv.conf
search laptop
nameserver 127.0.0.1
$

The output shown above is a result of the named daemon running on my
laptop, but that's kind of besides the point here. The real point is
that if you are absolutely *determined* to make 'localhost' and
127.0.0.1 resolve correctly, both forwards and backwards, there _is_
indeed a way to do it. Naturally, running a local named daemon comes
with a cost -- the cost of learning about DNS and configuring your
own, local, caching named daemon -- but that's ok, I guess.

I spent an hour trying to "solve" this problem until I read a comment
to the effect that this doesn't work correctly on FreeBSD anyway, and
all is well if "ping localhost" goes right.

All my settings are the way it's described here:
http://wiki.unixboard.de/index.php/FreeBSD_-_Namensaufl%C3%B6sung

Can you post *here* what you have tried, what you expected to happen,
what you observed, and why you think this is a "FreeBSD problem"?

Not all the people who read newsgroup posts and reply to them are
constantly online, and there may be difficulties in tracking down the
web page and reading it.

But "host" insists on
1. adding the domain to "localhost", even when there is no "search"
in resolv.conf
2. using DNS to resolve, never the hosts file

This is _precisely_ the way the host(1) utility works. It specifically
mentions that it is a *DNS* *lookup* utility in its manpage.

If you want to debug and/or troubleshoot non-DNS resolution of host
names, domain names, or IP addresses, you will have to use some other
tool (i.e. 'ping' as you have found out already).

Maybe the man page for host should mention that? I guess I just ought to
use dig.

It does:

% HOST(1) BIND9 HOST(1)
%
% NAME
% host - DNS lookup utility
%
% SYNOPSIS
% host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type]
% [-W wait] [-m flag] [-4] [-6] {name} [server]
%
% DESCRIPTION
%
% host is a simple utility for performing DNS lookups. It is
% normally used to convert names to IP addresses and vice versa.

Nowhere does host(1) mention that it is expected to work, or that it
should indeed work for anything else *except* DNS. Please read the
manpage more carefully :-)

Well, host doesn't quite work on a RedHat Linux server at work, too,
the answer is:

Host localhost not found: 2(SERVFAIL)

That's ok. You have tried to resolve the non-qualified domain name
'localhost' and the Redhat implementation of host(1) didn't append any
domain name, even though the 'localhost' domain name lacks any '.'
character and is obviously 'unqualified'.

But that's slightly better than getting back an external IP. Is that
the fault of the DNS server I'm using (openDNS)?

Very likely. Haaving said that, if you don't like what an external
DNS server does, you can always install your own.

Regards,
Giorgos

.



Relevant Pages

  • Re: 2 Subdomains - 1 IP Address
    ... it only works on that computer and is not a replacement for DNS. ... You do not need WWW in your web site ... The host value is next, ... Localhost defaults to 127.0.0.1 or the TCP/IP localloop ...
    (microsoft.public.inetserver.iis)
  • Re: Unable to resolve hostname (winsock problem?)
    ... "Charlie Tame" wrote: ... >> The only thing in my hosts file is localhost. ... >>> # be placed in the first column followed by the corresponding host name. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: 2 DNS, one machine
    ... >> the hostname when it is set to localhost and the host is getting his IP ... Off hand that looks like a mess up on your part in the DNS records. ... RedHat 9 pair of machines with the DNS engine on the RedHat 9 machine. ...
    (Fedora)
  • Re: DBIx::DBH - Perl extension for simplifying database connections
    ... host that it would not connect using the host name and end up using TCP on ... The server name is ... important because I use the localhost name to match up with that, ... matches then don't add in the hostname to the connect string. ...
    (perl.dbi.users)
  • Re: Rerouting IP requests internally
    ... certain external database server, now wants to host the database locally, so ... we want to route any requests to the old db server to localhost basically. ... We have no control over the external host / IP so routing is the only way,, ... the ideal situation here is to fix the app such that the ...
    (microsoft.public.windows.server.general)