Comment 23 for bug 19775

Thomas Hood (jdthood) wrote :

Dennis Kaarsemaker wrote:
> The line that should read
> localhost.localdomain localhost myhostname

No it should not. Read section 10.4 of the Debian reference which also applies to Ubuntu.

In general, it is important that the current system hostname be resolvable in /etc/hosts
to an IP address and back from that IP address to the same hostname or to a fully
qualified variant thereof.

This will not happen if the hostname is included as an alias for "localhost" because then
the hostname -> IP address -> canonical hostname lookup sequence will yield "localhost".

In other words, in /etc/hosts, the "" line should look like this: localhost

Do not put "localhost.localdomain" on this line. That is a RedHat-ism. It is not needed
in Debian and Ubuntu.

Assign the current system hostname (e.g., "foo") a permanent IP address if the machine
has one, e.g., foo

and assign it the loopback address if it does not: foo

Note the difference between and

To those who suggest putting the system hostname ("foo" in our example) on both
the line and the line: No, that is an invalid configuration. Each
host name should be associated in /etc/hosts with a single IP address.

What I describe above are /etc/hosts configuration standards for Debian and Ubuntu.
In the real world many people are confused about how /etc/hosts should be set up
and this includes many Debian and Ubuntu developers, and even those developing
and packaging network configuration tools. I haven't looked recently, but up until
two years ago there was no network configurator that even came close to writing
valid network configuration files in Debian and Ubuntu. For a very long time I have
avoid installing or starting network configuration tools in Debian and Ubuntu.