The small size of the ARPANET permitted hosts files to be used with some convenience for some time. Network nodes typically had one address, and could have potentially many names. As individual TCP/IP computer networks started becoming popular, however, the hosts file became a large burden on system administrators — networks and network nodes were being added all the time — making maintenance of the hosts file a task which grew significantly.
%SystemRoot%system32driversetcis the default location, which may be changed. The actual directory is determined by the Registry key
/private/etc(uses BSD-style Hosts file)
C:private10000882hosts, only accessible with file browsers with AllFiles capability, most are not.
An example can be found at http://vlaurie.com/computers2/Articles/hosts.htm.
Blocking ads in this way can result in quicker browser operation and performance improvement for several reasons. The first reason is that rather than the browser having to contact a DNS server in order to resolve multiple IP addresses, it quickly parses a small text file (the HOSTS file) located locally on a computer. Second, when the HOSTS file returns an invalid or local IP address (for example 0.0.0.0) it is not able to load the requested ad which saves time and bandwidth. For example, adding an entry to the HOSTS file such as "0.0.0.0 www.doubleclick.net" would mean that requests for ads from the ad company DoubleClick would be forwarded to an invalid IP address (0.0.0.0) and never be loaded. It is quicker to load nothing rather than download an ad image from the Internet.
This phenomenon is discussed in more detail on the well-known podcast "Security Now" with Steve Gibson available at http://www.grc.com/securitynow.htm under episode #45 - The Hosts File.
Another solution is to block browser requests for the ads in the first place. This can be done through browser based plugins such as "No Script" and "Adblock" for Firefox. Another solution would be to block the ad addresses via a proxy or firewall.
Another use of the host file is to block known dubious or criminal domains and servers (with spyware and other malware). This has the same risks as hosts blocking ads, but generally requires fewer addresses in the hosts file and therefore would have a smaller impact on the system.
A useful and time-saving tip for web site programmers, intranet developers and IT managers is to enable non-standard TLDs on a LAN such as example.local (for accessing Example Company's Intranet) or sample.new (for a new version of the Sample.com website during testing).
US Patent Issued to United Services Automobile Association (USAA) on Oct. 11 for "Systems, Methods, and Computer Readable Media for Managing a Hosts File" (Texas Inventor)
Oct 18, 2011; ALEXANDRIA, Va., Oct. 18 -- United States Patent no. 8,037,415, issued on Oct. 11, was assigned to United Services Automobile...