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

July 7, 2015 6.5k views
PHP Linux Commands Ubuntu


I've installed sendmail in ubuntu, bit sending email was deadly slow.
In the file /etc/hosts there was HOSTNAME HOSTNAME
I changed this to 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 anymore??

1 Answer

There shouldn't be an issue with that as 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 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

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.