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

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



On Tue, 29 Dec 2009, Russ Allbery wrote:
> > 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?

Yes, if you must/want.

I prefer to alocate such host names in a real domain, and give them just TXT
records or 127.0.1.1 A records in some weird cases where I can't trust the
box to not do idiotic things like go to the DNS bypassing the libc resolver.

Any arbritary but valid and unique DNS name would do.  People often use
".local" suffixes when doing that, I've seen ".local", ".localnet" and many
others.

> In truth, my laptop *does not have an FQDN*.  The concept has no useful

It must have, POSIX provided a way for apps to query it, and apps started
doing that.  So you need one.  It will be an arbitrary one, but that's fine.

> 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.

Well, sorry, but since gethostname() and friends exist and are used, there
IS a special name which is the box main 'identity'.  That one needs to be
there, needs to be sane, and most apps that use it will require it to
resolve to something that works (that's what the loopback is for).

Whether an application should be using gethostname() at all is a different
problem.

Give your box an GUID as its canonical name, if you want.  Change at every
boot, if you want.  Add a .local suffix to it to make it a FQDN (since too
much stuff is too broken to undestand a top-level FQDN).  As long as it is
resovable by the box itself, that's a perfectly fully functional canonical
host name.

> 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

You are quite correct in that.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: