Re: hostname doesn't stick

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

 



Thanks for the explanation. That tends to confirm my conjecture and it seems to answer at least some of the questions that came up here.

(Top posting because it's just an acknowledgement, so no need to scroll down...)

On Mon, 18 Sep 2006, Tim wrote:

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. 127.0.0.1 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 "127.0.0.1 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:

127.0.0.1 localhost fred
192.168.0.1 groundfloornet ground
192.168.1.1 firstfloornet first
192.168.2.1 secondfloornet second
192.168.3.1 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 192.168.0.12, 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.



--
		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux