Wednesday, January 25, 2012

How to block a website using window HOSTS file

What is a Hosts file:

The Hosts file contains the mappings of IP addresses to host names. This file is loaded into memory (cache) at startup, then Windows checks the Hosts file before it queries any DNS servers, which enables it to override addresses in the DNS.  It basically tells your computer where to look for a certain website. When you type an address in the address bar of your web browser, it checks for instructions on the HOSTS file. If no record about a website is found, it opens a website for you. Otherwise, it opens a website from an IP address defined on the HOSTS file.


You can use a HOSTS file to block ads, banners, 3rd party Cookies, 3rd party page counters, web bugs, and even most hijackers. This is accomplished by blocking the connection(s) that supplies these little gems. 

How to block a website using window hosts file:

The host file is located under this path on your System:

C:\Windows\System32\drivers\etc



For Windows 7 users, type “Notepad” in Start Menu search bar, and then right click on the “Notepad” item, choose “Run as administrator”. Now you can open HOSTS file with “File -> Open” menu in notepad


The HOSTS file contains IP address and hostnames. You can add the mapping relationship of each websites.
 
 
The entry must have an IP address and the address of the website which you want to block. Choose 127.0.0.1 as an IP address, leave a space or press tab and then type the address of the website. See the example below:


Do not use # before the blocked website entry. To allow access to a website, simply remove the entry or you can add # before the line.


Hope this will work for you...

Thanks and Regards

PRdeep Kumawat
Network Engineer


No comments:

Post a Comment