From owner-freebsd-questions Tue Oct 30 17:54:46 2001 Delivered-To: freebsd-questions@freebsd.org Received: from keetoo.alfred.cx (keetoo.alfred.cx [150.101.93.135]) by hub.freebsd.org (Postfix) with ESMTP id DD91237B403 for ; Tue, 30 Oct 2001 17:54:36 -0800 (PST) Received: from aviion (unknown [150.101.93.190]) by keetoo.alfred.cx (Postfix) with ESMTP id B2DF0209; Tue, 30 Oct 2001 07:27:09 +1030 (CST) Subject: Re: /etc/hosts doesn't work? From: Andrew Reid To: Philip Mak Cc: freebsd-questions@freebsd.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1004334727.445.12.camel@aviion.alfred.cx> Mime-Version: 1.0 X-Mailer: Evolution/0.15 (Preview Release) Date: 29 Oct 2001 11:23:48 -0930 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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