Skip to content ? Ubuntu / Debian ? What is it used for?

If you’re curious about why Ubuntu and Debian have an entry in /etc/hosts mapping to your server name. You’re not alone, in fact this is not a bug nor it has been put in there by mistake.
Looking at the example below we can see the entries of my testbox:    linuxlnx    # Added by NetworkManager    localhost.localdomain    localhost
::1    linuxlnx    localhost6.localdomain6    localhost6 linuxlnx

The reason why you find the in your /etc/hosts is that some applications like GNOME expects that the hostname to be resolved to an ip address with a canonical fully qualified domain name – FQDN. As you can see on Debian documentation:

Some software (e.g., GNOME) expects the system hostname to be resolvable to an IP address with a canonical fully qualified domain name. This is really improper because system hostnames and domain names are two very different things; but there you have it. In order to support that software, it is necessary to ensure that the system hostname can be resolved. Most often this is done by putting a line in /etc/hosts containing some IP address and the system hostname. If your system has a permanent IP address then use that; otherwise use the address localhost linuxlnx

To see whether your system hostname can be resolved to an IP address with a fully qualified domain name, use the hostname –fqdn command.

Also it could be any ip address in the address block since according to the RFC 1700 , addresses are reserved for loopback purposes.

Leonardo (using Ubuntu 10.10 Maverick Meerkat )

useful words: why debian

Posted in Knowledge Base.

Tagged with , , , .

6 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. ilya says

    Hi Leo!
    Thanks for the useful post! Can you tell why is this IP address different from Does it have to be different from the localhost address? I actually had some problems caused by that in my Ubuntu, so I changed to, but I am wondering whether it can have some negative consequences.
    Best regards

  2. Leo says

    Hi ILya
    It should not be a problem as long as your system hostname can be resolved to an ip address.


  3. A Friend says

    > use the hostname –fqdn command.

    You have a typo here. The command should either be `hostname -f` or `hostname –fqdn` (note the double-dash). I think you had this right, but the software used to create this post interpreted the double-dash as an m-dash.

  4. A Friend says

    Ha. It’s definitely the software. The double-dash in my previous comment was also converted!

Continuing the Discussion

  1. – Ubuntu / Debian – Leonardo Borda linked to this post on April 8, 2012

    […] time ago I wrote about “what does mean ?” and I explained why some applications like GNOME expects that the hostname to be resolved to […]

  2. Metaverse Ink Blog» Blog Archive » Bad Ubuntu! linked to this post on October 9, 2012

    […] this maps the domain name to an interface in localhost, for reasons explained here. As stated in the Debian […]

Some HTML is OK

or, reply to this post via trackback.