127.0.1.1 host address in Debian (Ubuntu) hosts file

Sometimes the/etc/hosts file will see the address 127.0.1.1. What is this

127.0.0.1 this loopback address is very common, which is the loop/loopback address of the local interface. But sometimes 127.0.1.1 will appear in the/etc/hosts file. What is the address?This is also a local loop/loopback address.

The reason for this address is that some applications need a fully qualified domain name (FQDN). FQDN requires not only the host name but also the host domain name. Its expression is hostname.domainname

If your host has a static IP address, the FQDN name will be resolved to the static address, otherwise it will be resolved to the local loop address 127.0.1.1. So generally, you won’t see 127.0.1.1.

127.0.0.1 only corresponds to the host name, which is the main difference between the two, as follows

127.0.0.1 hostname
127.0.1.1 hostname.domainname

Of course, it is not necessary to use the 127.0.1.1 IP. Any IP in the 127.0.0.0/8 IP segment specified in RFC can be used. As long as there is no conflict, Debian chooses 127.0.1.1

View the host name
# host name
host name

View the FQDN name
# host name – FQDN
hostname.domainname

Similar Posts: