Sunday, October 3, 2010

How to block websites without using any software ?

For education purpose only. I shall never be responsible for any damage.
Beware don't mess much with the system files.

So here is the way how to block any website on your machine without using any software in window XP.
We do this by editing the Hosts file in our machine. Hosts file is file that contains IP address to hosts name mappings. When ever we open any website the host name to IP address mapping takes place. Like if you type www.google.com and hit enter then, first the machine will resolve the google.com to its IP address and after that it makes connection to google using its IP address. This is called name resolution and it is done by DNS(Domain Name Server). But in case of window OS the Hosts file is prefered to do mapping, and if no mapping is availabel in Hosts file then mapping is done by DNS. This means the OS will first look for mapping in Hosts file rather than directly making a DNS query.
So now we edit Hosts file so that mapping takes place according to ourself, what we define.
First of all you need to edit the Hosts file in your machine. First make backup of Hosts file. The Hosts file is situated at :

C:\WINDOWS\system32\drivers\etc

if C:\ is your installation directory.
You will see there will be a file named as Hosts.
Open that file in wordpad.
now type following at end of file, create new line at last:

127.0.0.1 Website name u want to block

Save the file and exit.

for example if I want to block orkut.com then I type following :

127.0.0.1 orkut.com

Don't forget to enter space between 127.0.0.1 and orkut.com in above line.

How it works ??
127.0.0.1 is a loopback address. This address is used to check status of TCP/IP in a machine. This is the address that is used to connect to your own machine. For eg:
Open CMD and type the following & hit enter:
ping 127.0.0.1

you will get 100% success, because you are pinging your own machine. If you don't get success then it means there is problem with your TCP/IP settings or your OS have some problems.

Now in above example we are telling to Hosts file that, the IP address of orkut.com is 127.0.0.1 ,
so now when you type orkut.com in browser, your browser will ask Hosts file about IP address and as we have mapped orkut.com's IP to 127.0.0.1 so browser will redirect you to 127.0.0.1.
Thus the website will no open..

This trick can be used in other way too. Suppose if u try to open yahoo.com , but google.com opens..!!! if u want this to happen then u can try this.
put this line in hosts file as explained above:

74.125.43.104 www.yahoo.com

when u try to access yahoo.com you will be redirected to google.com
This works as same as I have described above.

No comments:

Post a Comment