The HOSTS file maps IP addresses to host names. That is, it associates an IP address to an Internet address such as www.yahoo.com. Windows checks the HOSTS file before it queries any DNS server and allows it to overrride any addresses in DNS. This blocks access to sites listed in the HOSTS file by redirecting to a different address. In other words, you can cause any connections to www.yahoo.com to actually connect to an entirely different address. This effectively blocks the connection to www.yahoo.com. Though you would not want to block Yahoo. This is just an example.

For example, the following line in a HOSTS file:

127.0.0.1 ad.doubleclick.net

This would block any connections to ad.doubleclick.net and redirects the connection to 127.0.0.1 (an IP address which is always your computer). Unless you run a webserver on your PC, this would basically cause the connection to ad.doubleclick.net to fail since there is nothing to connect to at 127.0.0.1 (your computer).

This was not the original intention of the hosts file, but this can allow you to block sites that provide ads, banners, cookies, violate your privacy, sites that provide spyware and/or adware applications or basically any site you want to block such as a pornographic website that you don’t want your kids to access.

How does this apply to the typical user? You can download maintained lists online of Internet addresses that are updated periodically and import those lists into your HOSTS file, acting as a sort of immunization against spyware, adware, viruses, privacy violation, etc.

Why use this method? It is an easy way to block websites which do or could potentially violate your privacy, infect your computer with malicious software, and track your online habits. You can also use software such as Adaware to remove bad applications once they are installed, but it does not prevent you from becoming “infected” with these issues.

You could compare using a hosts file to a flu vaccination. The doctor could give you medications to help you get over the flu, but without a vaccination you can still get it. With a vaccination or immunization you are protected from ever being bothered by the flu (or at least a specific strein of the flu).

There are many applications out there that make claims to do something you need. You’ve seen the popups and advertisements on websites that warn that you are infected or at risk and ask you to download software to fix the problems. In most cases, those applications actually act as a trojan horse like the one in Homer’s Illiad, pretending to be something nice, but in reality, not.

You don’t have the time to learn which applications are bad, which websites are not safe and private information a website gathers in the background without your approval. By using a list obtained online, you don’t have to, because someone else does it for you.

Instructions and Information @ MVPS

Free Hosts Files
MVPS List [Download Link] [Website]
Andrew Short’s List [Download List] [Website]
BadHosts [Download List] [Website]
hpHosts [Download List] [Website]

Recommended Links:
Wikipedia HOSTS File Article
Eliminate Web Advertisements
Blocking Ads on the Internet

HOSTS File Management Apps. (free):
HostsMan
HostsXpert

Note: It is possible that a hosts file obtained online may block addresses for parts of sites such as MySpace. You can remove the entry for that website in your hosts file. You can also always revert back to the original hosts file.

As always, the software and services discussed in this article are free.