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/hostscontaining 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
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