[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: hostname doesn't stick

On Mon, 2006-09-18 at 08:24 -0400, Matthew Saltzman wrote:
> Is there any real harm in having other names associated with the
> loopback address in /etc/hosts as well?

That rather depends...  You can add other references to itself, and
they'll work for references to itself.  For standalone PCs, I've done
that many times without any noticeable problems.

e.g. localhost mywebserver mynewsserver

It might a problem if you were on a network with more than one system,
and you tried to work between the two of them while one was still using
an address referring to itself.

It's more of a problem for users, than software, in my experience.  They
write a hosts file, with machines referring to themselves, then copy the
hosts file to another PC, and expect that " mywebserver" will
connect to the webserver on the other PC.

> Is there any issue if the real HOSTNAME is associated with some other 
> nonroutable address in /etc/hosts if (a) the machine is not connected
> to a network 

Shouldn't be.  You can have any number of interfaces and addresses on a
machine.  So long as, for itself, a name and IP are associated with each
other in a useable manner when you try to use them.

e.g. You might have a box with a hostname of "fred", it might have four
network interfaces, it *might* have a hosts file like: localhost fred groundfloornet ground firstfloornet first secondfloornet second thirdfloornet third

It could refer to itself using any of those addresses.  It's when other
machines want to connect to it that you have to be sure that they've got
the information available to them.

> or (b) if it is connected to a network but has some other IP (possibly
> routable) address on that network--either where other machines on the
> network know the machine name and IP (from DNS, e.g.) or where they
> don't?

The hosts file entries are for use within the machine itself, it can
have all sorts of extra information, and not be a problem for other
machines.  Unless you make the mistake of using non-unique names on more
than one machine (if you had another "fred" box, elsewhere, your use of
"fred" on this box would prevent it connecting with the other fred box,
in a many circumstances).

You can put aliases in your hosts file, that allow you to refer to some
address by yet another name (like my five line example, above).  The box
in the foyer might well be, hostname "wilma".  You could
add an entry to it on your hosts file, calling it "dino", and when you
refer to "dino", your computer will read its host file, find the IP
associated with it, and connect to it.

There's a proviso with that sort of thing:  virtual hosts with
webservers.  Your request also includes the name of the host you're
trying to connect to.  The Apache webserver can server different pages
from the one server based on the name in the request.

(Currently running FC4, occasionally trying FC5.)

Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]