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

Re: Re: /etc/hosts and resolving of the local host/domainname - 127.0.0.1 vs. 127.0.1.1



Simon McVittie wrote:
> On 30/07/13 21:43, Christoph Anton Mitterer wrote:
> > - Back then, Thomas pointed out several ides on who the resolution could
> > be done (e.g. with a small nsswitch module)
> 
> libnss-myhostname is basically this, and is packaged. It tries to return
> a public address if possible, only falling back to 127.0.0.2 (upstream),
> 127.0.1.1 (as patched in Debian) or ::1 (IPv6) if there's nothing more
> suitable. Possibly it ought to try RFC1918 addresses before 127.x.y.z,
> or ought to fall back to 127.0.0.1 instead; I'm sure there are valid
> arguments each way.
> 
> I would be inclined to install libnss-myhostname by default, since it's
> the 99% solution. People who feel strongly about this sort of thing can
> uninstall or disable it, and apply whatever manual configuration they
> want to.

I'd like to see this as well (with a corresponding change to the
installer to stop putting an entry for the hostname in /etc/hosts).

This would get us one step closer to having the hostname configured in
only *one* place (namely, /etc/hostname).  With dhclient fixed to detect
the hostname at runtime, I think nss-myhostname is the last step
required before hostname changes become a one-step process of editing
/etc/hostname.

Note that /etc/hosts will still take precedence over nss-myhostname if
it specifies a name for the local system, so you can trivially override
nss-myhostname with or without uninstalling it.

- Josh Triplett


Reply to: