What goes in /etc/hosts?

Nat Gross natgross.rentalsystems at verizon.net
Thu Mar 10 17:02:30 UTC 2005


Brian Fahrlander wrote:

>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! 
>  
>
When you say append .local, is that referring to all machines on the 
local net, or only to this one local host. In other words, for the other 
hosts on the lan, do I also need to append .local?
Thanks;
-nat




More information about the fedora-list mailing list