[CentOS] /etc/hosts - hostname alias for 127.0.0.1
nkadel at gmail.com
Tue Mar 8 02:21:08 UTC 2011
On Mon, Mar 7, 2011 at 11:34 AM, Sean Carolan <scarolan at gmail.com> wrote:
> Can anyone point out reasons why it might be a bad idea to put this
> sort of line in your /etc/hosts file, eg, pointing the FQDN at the
> loopback address?
> 127.0.0.1 hostname.domain.com hostname localhost localhost.localdomain
> CentOS mailing list
> CentOS at centos.org
It's common to do so, so that the network lookups for "hostname" still
operate, even if the rest of the network is dead. This is particularly
important for self-monitoring, sendmail (which relies on the FQHN
beinf first, mind you!!!) and X Windows.
If you have an intermittent network connection, such as one for a DSL
connected device or a roving wireless connection, keeping the hostname
in the 127.0.0.1 line helps assure that the X sessions work, even when
other connections are interrupted. It also helps improve performance
for local network access and keeps your external ports uncluttered by
local CIFS and NFS access.
That said, it can be problematic when you "ping $HOSTNAME" and get a
valid 127.0.0.1 response, and haven't actually tested your external
port. It also requires thought for configuring SSH and SNMP and NFS to
allow localhost access.
More information about the CentOS