127.0.1.1
127.0.1.1 is the IP address used by the Debian Linux installer for a computer that does not have a LAN IP address. It should only be present on a computer that is not connected to a network. It is NOT a replacement for the loopback interface address 127.0.0.1 as the loopback address should be present on a networked or stand alone machine both.
5.1.1. The hostname resolution (Debian Manual):
For example, "/etc/hosts" looks like the following.
127.0.0.1 localhost 127.0.1.1 <host_name>
Each line starts with a IP address and it is followed by the associated hostname.
The IP address 127.0.1.1 in the second line of this example may not be found on some other Unix-like systems. The Debian Installer creates this entry for a system without a permanent IP address as a workaround for some software (e.g., GNOME) as documented in the bug #719621.
The <host_name> matches the hostname defined in the "/etc/hostname".
For a system with a permanent IP address, that permanent IP address should be used here instead of 127.0.1.1.
For a system with a permanent IP address and a fully qualified domain name (FQDN) provided by the Domain Name System (DNS), that canonical <host_name>.<domain_name> should be used instead of just <host_name>.
Fedora uses 127.0.0.2 for the same purpose.
The GNOME desktop expects the system hostname to be resolvable to an IP address with a canonical fully qualified domain name.
THIS IS A CHANGE FROM TRADITIONAL FORMAT IN OLDER DISTRIBUTIONS
In the past one might have observe something like this in /etc/hosts
127.0.0.1 localhost myhostname
The modern approach is to have
127.0.0.1 localhost 127.0.1.1 <host_name>
Here is a working example:
127.0.0.1 localhost 127.0.1.1 dilbert
Here the workstation hostname is dilbert. On the same system if you cat /etc/hostname you would see just the host
dilbert
Neither have a fully qualified domain attached to the host, as the workstation is on a private lan with non-routable IP addressing which is most common.
The hostname should be set in /etc/hostname. The fully qualified domain name is determined by the system checking /etc/hosts
You should NOT assign the system hostname to the loopback address of 127.0.0.1
- Loopback address is still 127.0.0.1
- Hostname can be 127.0.1.1 on a stand alone machine not connected to a network, otherwise the network IP is used