[Bug 234543] Re: /etc/hosts: hostname alias of loopback
Thomas Hood
234543 at bugs.launchpad.net
Fri Jul 15 08:49:42 UTC 2011
#0. The original report seems to be that
127.0.1.1 HOSTNAME
is not appropriate when the machine is on a local network.
That is not true. It is correct to resolve the local machine's
hostname to a loopback address.
The reason for choosing 127.0.1.1 as that loopback address
is that 127.0.0.1 is reserved for the special hosthame "localhost".
It is important that there be a one-to-one mapping between
loopback addresses and canonical hostnames, thus
127.0.0.1 <---> localhost
127.0.1.1 <---> HOSTNAME
#5. Here is is claimed that "[i]t is highly unusual to use the
hostname for a loopback address." Not true. It is actually
standard in Debian and Ubuntu, for the reason given above.
#10. Here is is asked "I move them to the public net and hand
assign them an IP in /etc/network/interfaces. At this point,
IIRC, I should edit /etc/hosts and replace 127.0.1.1 with the
public IP I'm giving to the server. Is this right?"
If a machine is given a *static* IP address then it is
acceptable, but not necessary, to replace "127.0.1.1" with
that static address in /etc/hosts.
#11. Here it is claimed that the 127.0.1.1. line needs
to be changed because XDMCP doesn't like it. It that is
true then it is, or was, a bug in XDMCP.
#12 claims that in Maverick NetworkManager futzes with
the /etc/hosts file, replacing the "127.0.1.1 HOSTNAME"
line with a "IP_ADDRESS HOSTNAME" line. That is
acceptable and probably introduced to work around bugs
in other applications, but should not be necessary. Local
applications are required to work correctly when
HOSTNAME resolves to 127.0.1.1, for the simple reason
that some computers are not connected to a network
and have no public IP address.
#14 mentions nss-myhostname. This is an alternative to
/etc/hosts futzing which is itself a workaround for bugs
in applications which don't work properly with
127.0.1.1 <---> HOSTNAME.
But it is better to fix those bugs than to rely upon a
workaround.
This report can be closed.
--
Thomas Hood
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netcfg in Ubuntu.
https://bugs.launchpad.net/bugs/234543
Title:
/etc/hosts: hostname alias of loopback
Status in “netcfg” package in Ubuntu:
New
Status in “ubiquity” package in Ubuntu:
New
Bug description:
There is a bug in /etc/hosts. Your hostname is NO alias of 127.0.1.1.
Only "localhost" is an alias for the loopback. When an application
want to know your ip adresss, it will get 127.0.1.1. But this is not
your ip adress in your local network!
This is not right:
127.0.1.1 HOSTNAME
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/234543/+subscriptions
More information about the foundations-bugs
mailing list