"hosts" file or "HOSTS" file?

R

Robbie

I apologise in advance if this is the wrong group for asking this.

Could someone tell me if the "hosts" file located in
system32/drivers/etc should be in capital letters? ie HOSTS rather than
hosts. My file has always been named in lower case, as hosts, but I
have read comments that it should be capitalized, ie HOSTS. To further
add to the confusion, some people refer to both their HOSTS file and
hosts file in the same post, switching between the two at random.

I only picked up on this issue when I thought about locking the hosts
file in Zone Alarm and decided to read up about it on the internet.

Thanks in advance for any help or clarification.

Robbie

Running: WXP SP2
 
J

Jim Byrd

Hi Robbie - This question generally sets off a big argument which I don't
want to engage in (yet again). Here's the best I know about it at this
point.

While XP per se may not distinguish between upper and lower case, there's
evidently code somewhere that does. While it may appear to work OK, and
will most of the time in some fashion when named lower case in W98x, Win2k
and XP, a good bit of experimentation has been done in these OS's which
shows that it will respond erratically upon occasion (blocking incorrectly,
translating IPs incorrectly, and/or freezing the browser) if not named upper
case. I (and some other MVPs who've looked at it) have never been able to
determine the specific cause, but that does appear to be the case. (I found,
for example, that I had to add a little .bat file (HostsSuspend.bat) to
reset the name to all caps after using HostsToggle in order to get proper
subsequent operation. I've since gone to a different approach using HostMan,
here: http://www.abelhadigital.com/. Another approach which properly
renames it is: http://www.mvps.org/winhelp2002/RenHosts.bat available
along with some other good data about using HOSTS files for blocking malware
here: http://www.mvps.org/winhelp2002/hosts.htm)

My guess at this point is that it is probably an artifact due (perhaps
indirectly) to legacy code from some initial decision to make it compatible
with "the format for host tables in the 4.3 Berkeley Software Distribution
(BSD) UNIX /etc/hosts file" and "This file provides compatibility with the
UNIX HOSTS file." as one MS document,
http://www.microsoft.com/resources/documentation/windows/98/all/reskit/en-us/part7/wrkappf.mspx
has it.


See also here, for example:
http://support.microsoft.com/default.aspx?scid=kb;en-us;228760
(http://support.microsoft.com/kb/228760/?sd=RMVP)


"4. Save the HOSTS file.

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



YMMV, and, of course, you're free to choose to name it as you please.
 
R

Robbie

Jim said:
"4. Save the HOSTS file.

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



YMMV, and, of course, you're free to choose to name it as you please.

Thanks Jim

Just to help me make my mind up what do do, what exactly is it saved as
on your computer?! I honestly don't know what to name it as, so I'll
follow what someone with more knowledge about it has their hosts/HOSTS
file named as...

Robbie
 
J

Jim Byrd

Hi Robbie - Well, as you might infer from my previous post, I always save it
as HOSTS. FWIW, I tend to use my HOSTS file a little differently from most
folk, since I do my blocking with a combination of lists that are
consolidated by a program called Confetch and then input to a local DNS
client, Treewalk, here: http://treewalkdns.com which handles the blocking
as part of its DNS lookup functionality. I therefore use my HOSTS file
almost exclusively to store the URL-to-IP translations of my Favorites, mail
and news server addys, and any links which I may want to override for some
reason that are on the blocking lists (since the HOSTS file is accessed
first before Treewalk does its thing, this lets me go ahead and access the
IP even though it's on the combined Treewalk filter.conf blocking list.)
Here's a little more info on HOSTS files from a 'canned' post about using
them for blocking that may be use:


First, you should understand that the original purpose of the HOSTS file
(BTW, it should always be named this way - all caps, no extension) was to
provide a local (therefore fast) translation from URLs to IP addresses for
frequently visited sites (typically your Favorites). It can still be used
this way (I do so, for example - there are utilities available such as CIP,
http://dl.winsite.com/bin/downl?500000007704 which will convert your
Favorites to IP's which you can then saveas and then copy into your HOSTS
file), but has also come to be used to block ad/malware servers by
redirecting them to your local machine instead of their servers using this
same mechanism. See here for some good info about this use:
http://www.mvps.org/winhelp2002/hosts.htm

This site also has downloads for some utility programs which you will find
useful if you decide to use a HOSTS file such as RenHosts.bat,
http://www.mvps.org/winhelp2002/RenHosts.bat, and lockhosts.bat and
unlockhosts.bat, http://www.mvps.org/winhelp2002/lockhost.bat, and
http://www.mvps.org/winhelp2002/unlockhost.bat. The lock and unlock files
can be used to protect the HOSTS file in between UPDATES so that it doesn't
get hijacked by malware, while the rename hosts program will allow you to
easily enable or disable the HOSTS file (while keeping the correct naming
convention). An even better approach IMO which I use is HostMan, here:
http://www.abelhadigital.com/ which offers some other useful tools as well.

As to size/performance - with any relatively modern computer the delay added
by the HOSTS lookup overhead should be negligible for even moderately large
HOSTS files (typically 250KB to 500KB) used for ad/malware blocking. If you
use it also for DNS-to-IP caching as I referred to above, the time saved
over going out to the net for DNS lookups will offset this many times. If
fact you may notice some speedup in "normal" address browsing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top