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

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



On 05-08-13 19:08, Thomas Hood wrote:
> Wouter Verhelst wrote:
>> The right way, in my opinion, is that /etc/hosts should
>> look like this:
>>
>> 127.0.0.1 localhost
>> 127.0.0.1 hostname.domain hostname
> 
> Strictly speaking there should be no more than one line per
> IP address, so that would be

In practice, however, glibc parses that and it does not cause problems.
Any program directly parsing /etc/hosts is broken.

At any rate, I also said:

>> or, alternatively:
>>
>> 127.0.0.1 hostname.domain hostname localhost
> 
> In that case 'hostname.domain' is the canonical name for alias 'localhost'.

Which is fine. "localhost" is *supposed* to be an alias, it is not a
canonical name (there are far too many machines called "localhost" for
it to be a canonical name of any use...)

I believe a canonical name should always be an FQDN; there are, in fact,
some systems that break when this assumption is not adhered to (MIT
Kerberos and gridengine spring to mind, but I'm sure there are others).

> Before any move is made to conflate the system hostname with
> 'localhost' in this way I'd like to see some proof that this no longer
> causes any malfunction, or if it does cause malfunction (e.g.,
> 'localhost' appearing in log files)

The first entry on any line in /etc/hosts, AIUI, is supposed to be the
canonical name, with other entries being aliases. If "localhost" appears
in log messages, that would be because "localhost" is listed first on
that line. Fixing that is a simple case of "don't do that, then".

> then I'd like to see the
> malfunctioning packages fixed in advance of the transition from
> 127.0.1.1 to 127.0.0.1. And before making this potentially disruptive
> change, I'd like to see evidence that the current practice actually
> causes problems --- problems that can't easily be solved by patching
> individual packages either to make them listen on 127.0.1.1 on the one
> hand or to make them talk to localhost on the other.

It is, in theory, always possible to fix system-wide issues by patching
individual packages, but that isn't necessarily the right thing to do.

Historically, "localhost" has always been "127.0.0.1". It feels wrong to
change that, simply because "localhost" starts showing up in places it
was never meant to show up in. Yes, the change to 127.0.1.1 may have
fixed that particular issue, but it's ugly.

If applications were logging with "localhost" as their name, then either
these applications are buggy (not using the canonical name when they
should), or the order is not defined as clearly as I thought it was.

-- 
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you
will not go to space today.

  -- http://xkcd.com/1133/


Reply to: