Re: Fwd: /etc/hosts and resolving of the local host/domainname - 127.0.0.1 vs. 127.0.1.1
Wouter Verhelst <firstname.lastname@example.org> writes:
> On 05-08-13 19:08, Thomas Hood wrote:
>> In that case 'hostname.domain' is the canonical name for alias
> 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...)
This may be a matter of style (and possibly even a matter of semantics),
but I consider the "localhost" name to be the canonical name for the
127.0.0.1 IP address, which always refers to the local loopback. It's a
different type of canonical name, but I still consider that a canonical
IMO, 127.0.0.1 resolving to anything other than localhost, or 127.0.0.1
resolving to any name other than localhost, is simply broken and not
behavior I want on any of my systems. Obviously, other people's mileage
may vary, and I'm not saying this to try to change anyone's mind about how
they want to run their systems, simply to register a contrary opinion from
a long-time UNIX user.
I think RFC 1912 is interesting here:
The "localhost" address is a "special" address which always refers to
the local host. It should contain the following line:
localhost. IN A 127.0.0.1
The "127.0" file should contain the line:
1 PTR localhost.
There has been some extensive discussion about whether or not to
append the local domain to it. The conclusion is that "localhost."
would be the best solution. The reasons given include:
"localhost" by itself is used and expected to work in some
Translating 127.0.0.1 into "localhost.dom.ain" can cause some
software to connect back to the loopback interface when it didn't
want to because "localhost" is not equal to "localhost.dom.ain".
Russ Allbery (email@example.com) <http://www.eyrie.org/~eagle/>