Skip to content


127.0.1.1 ? Ubuntu / Debian

127.0.1.1 ? What is it used for?

If you’re curious about why Ubuntu and Debian have an entry in /etc/hosts mapping 127.0.1.1 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:

192.168.1.13    linuxlnx    # Added by NetworkManager
127.0.0.1    localhost.localdomain    localhost
::1    linuxlnx    localhost6.localdomain6    localhost6
127.0.1.1    linuxlnx.linuxlnx.int linuxlnx

The reason why you find the 127.0.1.1 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 127.0.1.1.

        127.0.0.1 localhost
        127.0.1.1 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 127.0.0.1/8 address block since according to the RFC 1700 , 127.0.0.0/8 addresses are reserved for loopback purposes.

Leonardo (using Ubuntu 10.10 Maverick Meerkat )

useful words: why debian 127.0.1.1

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 127.0.0.1? Does it have to be different from the localhost address? I actually had some problems caused by that in my Ubuntu, so I changed 127.0.1.1 to 127.0.0.1, but I am wondering whether it can have some negative consequences.
    Best regards
    Ilya

  2. Leo says

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

    Leo

  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. 127.0.0.0/8 127.0.1.1 127.0.0.1 – Ubuntu / Debian – Leonardo Borda linked to this post on April 8, 2012

    […] time ago I wrote about “what does 127.0.1.1 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.