Hosts File Info by Dan What it is supposed to be used for What it can be used for Limitations Format/Setup Example The Windows Hosts file is essentially a local DNS. It is stored in the same directory as the winsock.dll file, usually c:/windows/. When an application tries to connect to a remote host, it looks first at the Hosts file to see if it is listed. If it is listed, the app will use the given IP without checking a DNS. It is supposed to be used as a backup DNS, in case a remote one is not available, or as a local DNS when it is used on a local network/server. However, someone came up with the idea of listing a host name and linking it to the loopback IP, 127.0.0.1. This means that unless you have your machine set up as a server, and the required data on hand locally, you get a 'Server not found' error. This makes it possible to block various hosts that you may find objectionable. Maybe porn sites, maybe banner sites, hell, maybe AOL :) I've found a few drawbacks to using this as a, um, 'firewall'? (too strong a word I think). If you use IE5, when your machine can't find a server, and the banner/ad space isn't defined, you get a 'friendly' error message. Friendly, as in, "hey, friend, you don't mind if I totally blank out that page you were trying to read just so I can tell you I couldn't find an ad, do you?". Pretty irritating at times. As far as I can tell, NS4.6 and Opera 3.6 use small broken link icons to hold the place of missing ads, and if they can't find a host for a page URL, you get the a small box in the middle of your screen. Drawback #2 You can't block selectively like you can with At-Guard or Junkbuster. Since it is a host name file, if you try to block a paticular directory, you end up blocking the server in total. You can't block a certain file type either. Drawback #3 The Hosts file IS case sensitive, while host names in a web browser are not. So www.geocities.com and www.GEOCITIES.com are read the same by your browser, but to block both with the Hosts file, you'd have to use two entries with different capitalizations. Not much of a problem, since standard is to lowercase host names, but the potential is there. Drawback #4 The hosts file is parsed sequentially, so if it's huge, your browser might take a while to read through it. Drawback #5 You can't block numerical IPs. (tested with http://207.155.123.211/w3gconference/Main.cfm?CFApp=28) Drawback#6 The host name HAS to be in the form xxx.yyy.zzz Just using yyy.zzz (as in altern.org) won't work. At least, I couldn't get it to block reliably. The following shows the default HOSTS file provided with Windows 95. # Copyright (c) 1994 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows 95 # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the computer name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost If you don't have a hosts file, all you have to do is open a new text file in Notepad, fill in the info you want, and save it as HOSTS in the same dir as winsock. Note the lack of extension, it's very important. Then as you browse, you can take note of where the offending material comes from, and add the server at will. The HOSTS file format is the same as the format for host tables in the Version 4.3 Berkeley Software Distribution (BSD) UNIX /etc/hosts file. The following is my hosts file, started as Gordon's HOSTS file of INCREDIBLE POWER (tm), and modified with input from elf, NME, and my cache logs.