<firstimage=”//static.makeuseof.com/wp-content/uploads/2011/06/HostsFiles05.png”>Any website you visit potentially tracks your browsing habits, loads annoying ads, or distributes malicious software. Most of the time, common sense and standard malware protection software, such as antivirus programs or browser addons can help you steer clear of the worst sites. If you would like to add an additional layer of security, however, and block known offenders, you should look into the possibilities the Windows Hosts file has to offer.
In this article I will show you how to block unsafe websites by adding blocking lists to the Windows Hosts file. The Hosts file allows you to re-direct domain names to an IP address of your choice. Subsequently, you can use this knowledge to block any domains, such as those distributing advertisements, banners, cookies, and more.
What Is The Windows Hosts File?
The Windows Hosts file is a plain text file Windows refers to for mapping hostnames to IP addresses. The file is loaded into the cache at startup and every time Windows queries a DNS server, it first checks the Hosts file for redirection information. Simply put, the Hosts file can be used to re-direct a domain name to a different IP address and hence to a completely different website or simply back to the local computer.
What Are The Benefits Of Blocking Sites Using The Hosts File?
First of all you can block malicious websites using excluding lists that contain known offenders.
Secondly, if those lists contain ad servers or trackers, you will experience faster website loading times, as all ad and tracking related apps are blocked from loading. Moreover, this protects your privacy and enhances security since your browsing habits are shielded from many known trackers.
Finally, you can play a prank on people by re-directing any website you like, for example Bing to Google.
How Can I Edit The Windows Hosts File?
Mark wrote an article explaining how to block websites via the Hosts file, which covers almost everything you need to know: Create your own Internet Filter with the Windows Hosts file.
I will briefly describe how to edit the file in Windows 7.
- Open Notepad as Administrator. For this go to > Start > All Programs > Accessories, right-click > Notepad and select > Run as administrator. When asked whether you > (…) want to allow the following program to make changes to the computer, select > Yes.
- From within Notepad go to > File > Open and browse to the Hosts file, which is located under > C:\Windows\System32\drivers\etc. The folder will be empty as it’s only showing *.txt files. In the bottom right of the folder click the drop-down menu and select > All Files.
Where Can I Find Blocking Lists?
A great resource for a customized Hosts files to block ads, banners, and other parasites, can be found on WinHelp2002. The Hosts file on offer has been updated regularly, most recently in June 2011. You can download the file in plain text or as a ZIP file. The Zip file contains a batch file (mvps.bat) to automatically rename and replace your current Hosts file. However, you can also manually add the list via copy and paste from the text file to your Hosts file, following the instructions above.
You can also find Hosts files on hpHosts. You can either follow the installation instructions on the website, or manually copy and paste the list from their Hosts text file into your existing Hosts file.
There are other resources that share blocklists. However, you need to make sure you get a list that has the format ‘IP address domain name’ (without quotes), for example ‘127.0.0.1 google.com’ (without quotes), which would redirect the domain name google.com to the IP address 127.0.0.1 (localhost). Of course you can manually add the IP address in case you get a list that is lacking it.
What Tools Can I Use to Manage My Hosts Files?
I recommend HostsMan. Apart from providing a simple interface to add entries to your Hosts files, it also allows you to import blocking lists from hpHosts via the > Update Hosts button.
You can either merge this data with your current Hosts file or overwrite it. I recommend merging, since this allows you to simply delete the added information later and not lose anything you have in there already.
You can also edit the Hosts file using a convenient user interface.
Unfortunately, HostsMan does not currently allow you to import your own text files and merge them with your Hosts files. This is something you need to do manually.
If you liked this article, also check out the following posts on MakeUseOf:
- 3 Best Resources To Find Sites That Are Known To Have Spyware & Viruses
- Block Websites Without Any Network Experience using Any Weblock
- 3 Free Real-Time Malware Protection & Removal Tools
Did you know about the Hosts file before and what are you going to use it for now?
Image credits: John David Bigl III