Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2023 21:38:26 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        questions@freebsd.org
Subject:   Re: Using /etc/hosts, not dns
Message-ID:  <44y1k5n0q5.fsf@be-well.ilk.org>
In-Reply-To: <20230626194054.6a3119f50513650f249b2312@sohara.org> (Steve O'Hara-Smith's message of "Mon, 26 Jun 2023 19:40:54 %2B0100")
References:  <846f37ec-c0b3-0b1a-6294-1da6a9260777@Gmail.com> <1ED24C4A-FABF-4096-970D-4017616FC124@vanderzwan.org> <ebb7199a-98bc-980e-a077-f7a7c7085b4e@Gmail.com> <F269F458-919D-42D4-BDE4-E7A56C74BB02@vanderzwan.org> <6c840288-0446-122d-7d97-d6b02982e27c@Gmail.com> <20230626194054.6a3119f50513650f249b2312@sohara.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Steve O'Hara-Smith <steve@sohara.org> writes:

> On Mon, 26 Jun 2023 14:35:06 -0400
> Steven Friedrich <freebsdlouisville@gmail.com> wrote:
>
>> Correct, Linux still works.  After all these years and my extensive Unix 
>> experience, I am abandoning FreeBSD.  You have completely abandoned 
>> common sense.
>
> 	The host command has been specified to only use DNS for as long as
> it has existed. If there's an implementation of host that reads the hosts
> file then it is that implementation which is anomalous not the FreeBSD one.

And it's documented to be a DNS lookup utility on my (Ubuntu) Linux
system also.

But that version also first gives a result from /etc/hosts, in the form: 
	theserver has address 172.30.250.1

It looks like the Ubuntu host(1) program comes from ISC, just like the
one in the bind-tools package on FreeBSD, but it's been modified to
check /etc/hosts as well. I suspect that Linux distributions vary on
this, although I'm too lazy to go around checking.

I don't think this is necessarily a bad piece of functionality, but
given that host(1) is specifically a DNS lookup tool, it should
definitely indicate when it is giving results that don't come from doing
a DNS lookup. As far as I know, "host" is not a POSIX standard command,
so it can be anything its host (no pun intended) system wants it to be.
However, all of the versions I can find (easily) either come from the
ISC codebase or are trying to imitate ISC, so I think it's only
reasonable to assume that its results reflect a DNS query.

My take is that what the original poster expects isn't unreasonable, but
people with that superficial an understanding of how things work
probably shouldn't be editing /etc/hosts in the first place.

Be well.



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