John Wunderlich said:
I don't really know whether I understand your major question
fully, but as for the hosts file:
It's a HOSTS file, not a "hosts" or "hosts.tld", etc..
Windows filenames are not case sensitive. "HOSTS" is equivalent to
"hosts" and is [customarily] found in the directory
c:\windows\system32\drivers\etc.
For the OP's application (i.e. Windows Networking) he should really
be specifying the "lmhosts" file rather than "hosts" file but this
fails for the same reasons.
Any XP or current windows version has a HOSTS file. I'm not sure
why you think a static address has any impact on a machine's HOSTS
file; there is no connection between the two.
To the contrary. A "hosts" file (or "lmhosts" file, for that matter)
strictly associates a _name_ with an _IP address_. With DHCP, a
machine's IP address can change from day-to-day so with DHCP it is
not practical to associate a name with a fixed IP address.
There are several tiny utilities that could look up an IP (on both
sides even) and feed a redirection for a URL request, not using
the HOSTS file even, and send the request to another location. I
suppose you could easy enough write a script to feed it to a HOSTS
file, but ... it doesn't seem necessary to me. Just redirect it,
period, right at the demarcation entry.
He is asking just that -- how do you redirect it? Lookups usually
require Dynamic DNS servers or WINS servers, neither of which I
suppose he has running on his small network.
And if IPs are a problem, drop back to using text names.
His programs already uses text names. He is asking how to redirect
his prior server name to a different server name. His new server
doesn't answer to his old server's name.
The extra lookup time will me minimal. I've never tried to use
anything but an IP in the HOSTS file though; so I don't know if
that's the place to redirect using text names.
Correct. It strictly associates a Fixed name to a Fixed IP address.
Traditionally servers are assigned fixed IP addresses. My solution
to this would be to assign the replacement server/machine a fixed IP
address in the same subnet but outside the DHCP-owned address range.
It is not mentioned why this would be impractical.
-- John
Hi John,
Rather than increase the mess above, I feel I have to correct some
misinformation you've provided, possibly from inexperience and just
unexpected by you, but ... in the future when something seems to be
"off" like this to you I would suggest you do the few minutes it takes
to validate/confirm such things. It would prevent you from giving out
so much misinformation.
You're partially right that windows filenames are case insensitive but
that is not 100% across the board. The HOSTS file is one exception and
there are others, too.
-- In order to function in XP, the HOSTS file must:
-- Be spelled all caps. Any lower case or file extension will render
it unused.
-- It must reside precisely in the ...\etc directory or it will not
be found and again will be unused.
-- Must not contain any non-text characters or it will also fail.
The socalled "lmhosts" file you mentioned doesn't exist. There is
however an lmhost.SAM file wich is probably waht you meant.
Additionally: Host names are case-sensitive. This is a WebSphere
limitation. Check your host name. For example, if your computer shows
the name as JASON (upper case), then you must enter JASON in the HOSTS
file.
No offense, but:
With your apparently still limited background you need even more than
most to validate and check out things you say in giving answers so you
won't make such mistakes. That's bad misinformation for newbies to get
hold of.
My advise toyou would be to get your facts in line before you put on
your "1337" hat and go around wielding questionable information.
http://support.microsoft.com/kb/101746:
http://www.tomshardware.com/forum/101070-45-hosts-file-question
http://www.computergripes.com/ttdir/hosts.html
The web site says that the HOSTS file must be in capital letters. This
was not my experience under Windows 2000. Still, in this MS KB article
How to Use a HOSTS File to Test a Site that Uses Host Headers on an
Intranet it specifically says the HOSTS file should be upper case. On my
Windows 2000 computer however, the existing HOSTS file was in lower
case. Conflicting signals from Microsoft. Not the first time. Mike
Burgess was nice enough to respond to an email and he warned that
testing he and others did has found that the HOSTS file may still
function in lower case, but there were several cases where it either
became
corrupted or failed to function properly.
http://www.raymarron.com/hostess/help/index.html
When I write "HOSTS" in all upper case, I am referring to the system's
actual HOSTS file. When I use "hosts" in lower/mixed case, I am
referring to the host names of computers on the Internet, in your
Hostess database, or in a text file
http://www.broadbandreports.com/forum/remark,12113970
NOTE: This file must be upper case, and should NOT have a file name
extension. In other words, the file name should simply be HOSTS.
http://www.dslreports.com/forum/remark,13812099
(I found, for example, that I had to add a
little .bat file (HostsSuspend.bat) to reset the name to all caps after
In your defense, I'm going to say that there is an awful lot of
misinformation on the 'net about the HOSTS file so it can be confusing.
The best thing to do is to prove it to yourself and actually do the
experiment; I did, long ago and just now since my last test was pre-SP3.
.. Then it'll become memorable.
Also keep in mind that this is about XP ONLY; 2000, NT, and others, I
don't recall the list, WILL allow the HOSTS file to be lower case and
some insist on lower case. Why XP has this limitation is beyond me and
I've never seen it explained. In fact, there is even at least one MS KB
that states it incorrectly and which has not been superceded. But that's
not unusual with MS's documentation. Maybe it was that way at one time
too, I don't know, but I'm pretty sure it was never like that in XP.
HTH,
Twayne`