PHF
By:
PHF

removed 127.0.1.1 hostname hostname from /etc/hosts after installing sendmail/ubuntu

July 7, 2015 1.3k views
PHP Linux Commands Ubuntu

Hi,

I've installed sendmail in ubuntu, bit sending email was deadly slow.
In the file /etc/hosts there was 127.0.1.1 HOSTNAME HOSTNAME
I changed this to
127.0.0.1 localhost localhost.localdomain HOSTNAME

so 0.1 instead of 1.1 and sendmail was super quick.

Is it a problem that my hostname is not listing to 127.0.1.1 anymore??

1 Answer

There shouldn't be an issue with that as 127.0.1.1 is bound to the loopback interface. It's a Debian/Ubuntu specific implementation detail really. See this section on hostname resolution from the Debian Reference guide:

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>.

Have another answer? Share your knowledge.