Re: where is /etc/hosts supposed to come from?
Vincent Bernat <email@example.com> writes:
> Russ Allbery <firstname.lastname@example.org> disait:
>>> I haven't said that. And this is often not the case under Debian,
>>> i.e. the FQDN is often obtained from /etc/hosts, which has the
>>> precedence over DNS (see /etc/nsswitch.conf).
>> I have no entry in /etc/hosts other than 127.0.0.1 and the corresponding
>> IPv6 entries. What could I possibly put in there?
> If this is a real question, put:
> 127.0.1.1 fqdn nodename
I think we're having some sort of fundamental misunderstanding or
communications gap here. What FQDN do you think I should put there?
Should I just make something up, like laptop.russ.allbery?
In truth, my laptop *does not have an FQDN*. The concept has no useful
meaning for a system that is not persistently on any one network, has no
"native" domain, has no DNS entry, and just gets IP addresses via DHCP
wherever it happens to be. Nor, as other people have been pointing out,
does it have any well-defined meaning for a system that has the opposite
problem: multiple separate IP addresses in completely different domains.
You seem to have a basic assumption that every given machine can, at the
end of the day, be assigned a unique "home" in DNS that is somehow more
legitimate and more correctly defines that system than any other. This is
simply not the case in several practical real-world situations.
As with a few other people commenting on this thread, I usually shrug and
pick an arbitrary one of the DNS names assigned to a multihomed box to be
the "real" name for hostname, since usually it doesn't matter. But I
don't think there's anything inherently correct about that, nor do I see
anywhere it's required by POSIX. And, for my laptop, there really isn't
any such name at all.
Russ Allbery (email@example.com) <http://www.eyrie.org/~eagle/>