What goes in /etc/hosts?

fredex fredex at fcshome.stoneham.ma.us
Thu Mar 10 01:19:50 UTC 2005


On Wed, Mar 09, 2005 at 07:55:52PM -0500, Neal Becker wrote:
> Suppose my FQDN is a.b.c.  I'd like to set hostname to a.b.c.  What goes
> in /etc/hosts?  I believe that X won't work unless you have:
> 
> 127.0.0.1 localhost localhost.localdomain a.b.c
> 
> But this won't work with nfs4.  If hostname is set to a.b.c and the entry
> a.b.c is in hosts under 127.0.0.1, then when I try to mount a server (a.b.c
> is client) I get this:
> >> mount: can't get address for a.b.c
> 
> I guess mount isn't figuring out there is an eth0 interface and using that
> address.  If I remove the entry from hosts, and set the hostname to just
> 'a', mount works.


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.

-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
                      The eyes of the Lord are everywhere, 
                    keeping watch on the wicked and the good.
----------------------------- Proverbs 15:3 (niv) -----------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050309/62f15f7a/attachment-0001.sig>


More information about the fedora-list mailing list