[arch-general] Confusion About /etc/hosts File

Snarkout snarkout at linuxfortherestofus.com
Sat Jan 23 11:10:40 EST 2010


On 01/22/2010 01:51 PM, Carlos Williams wrote:
> #<ip-address>    <hostname.domain.org>    <hostname>
> 127.0.0.1       localhost.localdomain   localhost mail
> 10.1.1.200      mail.iamghost.com     mail
>    

I have seen multiple styles of hosts file, but I tend to set mine up 
like so:

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1       localhost.localdomain   localhost
10.1.1.200      mail.iamghost.com   	  mail

This kills two birds with one stone - localhost and localhost -f return 
the correct info, and it tells the box that "mail" and 
"mail.iamghost.com" are both at the non-loopback IP you specify.  If 
that's not what you want, then you probably want something more like:

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1	mail.iamghost.com mail	localhost.localdomain localhost

though, even then, some folks will say that this is also incorrect and you need to designate a loopback per-entry.

-Snark



More information about the arch-general mailing list