Tuesday 16 March 2010

Using Windows Hosts File

The hosts file is a computer file used in an operating system to map hostnames to IP addresses. This method is one of several system facilities to address network nodes on a computer network. On some operating systems, the host file content is used preferentially over other methods, such as the Domain Name System (DNS), but many systems implement name service switches to provide customization. Unlike DNS, the hosts file is under the control of the local computer's administrator.

Location
“hosts” file is stored in the \Windows\ folder for 9X/Me systems and in \Windows\system32\drivers\etc\ for Windows 2000/XP.

Format of Hosts File
The “hosts” file is a plain text file named just that, hosts.Note that there is no extension on the file name.

Make particular note of the so-called “loopback” entry:
127.0.0.1 localhost
This entry is a not an actual Internet IP address but defines a local address and can be used to direct the computer to send a packet to itself. This function is used in ad blocking and is discussed below.

If a hosts file exists, it is automatically searched during any process using the Windows TCP/IP stack.

Creating a Hosts File
Generally, the entries in the hosts file have to be created one way or the other. The IP address corresponding to an URL has to be looked up and entered. While those familiar with the PING function can do this themselves, the task would rapidly become too tedious for more than a few sites. Also, many sites regard PING as a nuisance and block it. Fortunately, others have created hosts files that can be downloaded. Several references are given in the sidebar.

Speeding Up Browsing
Many of the so-called Web accelerators that are available as freeware or as part of commercial packages make use of the hosts file. The idea is that if you can resolve IP addresses on your own computer instead of waiting for a DNS server to do it, you can cut the time required to find a Web site. If you have a slow connection or if the servers are very busy, you might shave a second or two off the connection time of your most used sites. Or on the rare occasion when DNS servers are down, you might even be able to continue to use the Web.

Blocking Adware
Perhaps the biggest use of the hosts file is to block sites that are regarded as undesirable or to block ads. This done by assigning the loopback IP 127.0.0.1 to an URL that you wish blocked. Thus an entry might be: “127.0.0.1 www.unwanted.com” (without quotes). Any request for such an IP address just gets sent right back to your own computer.

No comments:

Post a Comment