What goes in /etc/hosts?

Brian Fahrlander brian at fahrlander.net
Thu Mar 10 01:56:28 UTC 2005


On Wed, 2005-03-09 at 20:19 -0500, fredex wrote:

> It makes no rhyme nor reason for me as to why RH installer or
> network config tools set up /etc/hosts the way they do (as you
> describe above). It clearly doesn't work right.
> 
> I always find I have to manually fix it. The correct form
> should be like this:
> 
> 127.0.0.1 localhost localhost.localdomain 
> 192.168.0.1 myhost myhost.mydomain
> 
> unless your machine is assigned an address by dhcp, in which
> case use only the first line.

    The 127.0.0.1 line should always read "localhost.localdomain
localhost" unless you're doing something fancy routing things to a
special 127.0.0.* type address. (I've never needed it; don't know why)

    But when it comes to _naming_ your IP address, consider that
'reserved' IP spans can't truly be named "fred.amazon.com" (for
example), because:

     1) you're not part of amazon.com and 
     2) no one's gonna be able to route to this reserved IP address.

    I use a simple way to get around this: Everything in 192.168.1.* has
a name like aquila.fahrlander.local, and my webserver is both
www.fahrlander.net (on the outside) and pip.fahrlander.net on the
inside. 

    So decide what you want your machines to be called and append .local
after it.  Put those in /etc/hosts in case the DNS can't be called, and
you should be really happy.  This makes for a robust system that's
clearly understood.

    Enjoy! 
-- 
------------------------------------------------------------------------
Ever notice that blue states have more taxes, higher cost of living,
more pollution and violent deaths and more unhappy people?  Why is that?
------------------------------------------------------------------------
Brian Fahrländer                 Christian, Conservative, and Technomad
Evansville, IN                                http://www.fahrlander.net 
ICQ: 5119262                                          AIM: WheelDweller
------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050309/99c79218/attachment-0001.sig>


More information about the fedora-list mailing list