Skip site navigation (1)Skip section navigation (2)
Date:      29 Oct 2001 11:23:48 -0930
From:      Andrew Reid <andrew.reid@plug.cx>
To:        Philip Mak <pmak@aaanime.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: /etc/hosts doesn't work?
Message-ID:  <1004334727.445.12.camel@aviion.alfred.cx>
In-Reply-To: <Pine.LNX.4.30.0110281104590.19082-100000@sg1.indexthis.net>
References:  <Pine.LNX.4.30.0110281104590.19082-100000@sg1.indexthis.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2001-10-29 at 03:36, Philip Mak wrote:

> What's happening above? I'm trying to make it so that the host "db" (or
> db.buildreferrals.com) points to 65.119.108.130 (as specified in
> /etc/hosts) when I look it up from the machine. But when I actually look
> up that host, it gives a different address.

That's because host(1) doesn't look at the local hosts file. The third
line of the man page explains host this way:

 	"host - look up host names using domain server"

The bottom line: host(1) uses DNS only. Something as simple as ping is
generally good enough for testing weather or not the host name is
resolving correctly.

For example, my laptop that I'm sending this on now (aviion.alfred.cx)
is mapped in my hosts file as 150.101.93.190. Here's what happens when I
ping myself:

    andrew@aviion andrew > ping aviion
    PING aviion (150.101.93.190): 56 data bytes
    ping: sendto: No route to host

(It's giving me "No route to host"'s because the port replicator for my
Portege isn't attached, giving the OS the impression its not there).

Basically, the thing to look for in the example above is the fact that
ping(8) resolved the name to the IP address as listed in /etc/hosts.

On your machine, processes (such as httpd, smptd, etc.) that do host
lookups are probably working the way you want them to already, you just
don't realise that because of your flawed testing methods.

   - andrew

-- 
void signature(){
    cout << "Andrew Reid -- andrew.reid@plug.cx" << endl;
    cout << "Cell: +61 401 946 813" << endl;
    cout << "Quidquid latine dictum sit, altum viditur" << endl;
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1004334727.445.12.camel>