Thursday, 19 December 2013

How to block websites using hosts file?

Block Websites Using HOSTS file




Today let us see how to block websites using hosts file. This will helpful to administrator.



block websites




what is hosts file?

The host file contains Domain Name and IP address associated with them.  Your host file will be in this path:
C:\Windows\System32\drivers\etc\
Whenever we enter the Domainname or URL (for eg: www.webaddress.com), a query will be send to the DNS (Domain Name server).  This DNSconnect to the IP address which is associated with the Domain Name.   But before this to be done, the host file in our system will check for the IP address associated with the Domain Name.

Block websites
let us assume the website that you want to block is www.facebook.com.

1. Open the hosts file with notepad.

2. Type 127.0.0.1 www.facebook.com below the 127.0.0.1 localhost

3. Save the file.

4. Open Mozilla, type www.facebook.com
and hit enter. Now it will show page not found so user can not access the facebook.com

Update:
Windows Won't allow you to edit the hosts file from this location C:\Windows\System32\drivers\etc\ .
So copy the hosts file to desktop.
Edit as mentioned above.
Save the file.
Now copy the saved file and paste inside C:\Windows\System32\drivers\etc\.

No comments:

Post a Comment