[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: where is /etc/hosts supposed to come from?

On 2009-12-29 20:23:31 -0800, Russ Allbery wrote:
> I'm having a hard time figuring out what you think the canonical name of
> my laptop could possibly be, given that it has no static IP address and no
> DNS entry.

It doesn't need to have a static IP, nor a DNS entry.

> In practice, it's whatever arbitrary label that I gave it,

Yes, it may be arbitrary (the main goal being to identify the

> and none of these DNS-based resolution techniques are going to do
> you much good or give you any sort of consistent answer, if they
> work at all.

If it doesn't make sense (e.g., you can't connect to the machine
from the outside), they don't need to work... well, only locally,
but it has been said that is typically used for that.

> I have no entry in /etc/hosts other than and the corresponding
> IPv6 entries.  What could I possibly put in there?

As said by Steve Langasek in <[🔎] 20091227222253.GA19353@dario.dodds.net>,
something of the form: nodename.domainname

> > This is implementation-defined, but still, the host has a canonical
> > name, that should be obtainable with getaddrinfo, as described.
> I don't see where you're finding any justification for that "should" in

Otherwise this would be a failure, and failures are things that one
wants to avoid.

> > BTW, Debian defines /etc/mailname as containing the FQDN. So, this
> > notion is explicitly defined on Debian, and one should expect
> > "hostname -f" to return the same name (according to its
> > documentation).
> No, it's not.  You have completely misunderstood the purpose of
> /etc/mailname.

No, this is what is documented. You should RTFM.

>     If your package needs to know what hostname to use on (for example)
>     outgoing news and mail messages which are generated locally, you
>     should use the file /etc/mailname. It will contain the portion after
>     the username and @ (at) sign for email addresses of users on the
>     machine (followed by a newline).
> So on my system, for instance, /etc/mailname is "stanford.edu,"
> because that's what goes on the RHS of e-mail addresses. Which, of
> course, is not the canonical name of my laptop.

"stanford.edu" is definitely wrong. First it's just a domain name, not
a FQDN (as required by the mailname(5) man page). This would meen that
two different machines could generate the same Message-Id; the right
part of "@" in a Message-Id should contain the hostname to avoid this
kind of problems. Moreover, concerning the e-mail addresses, root is
local to the machine, so that generating a mail from root@stanford.edu
is incorrect.

Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)

Reply to: