Why you would need it?
Sometimes we wish that a particular site should not be accessed from our PC in conditions like:
- You want to block Facebook/Orkut etc. for the employees
- You are a parent and want your children not to be able to access specific bad sites
- You want to prevent an application on your PC from contacting a particular site
How to block sites?
There are many ways you can do it. eg. by adding filters in your firewall software, using a proxy and then blocking sites from proxy control directly, preventing a site from being resolved etc.Here, we will learn how to block a site using ip resolution block method. It is very simple and you do not need any external tools for it either.
Overview of what we wish to do
You may already know that when a web site is opened, it is first resolved from its host name (eg. yahoo.com, gmail.com etc.) into its corresponding IP address by Windows's resolving mechanism. This is called host name resolution.Then the real transaction of data takes place and we use the site.So, now if we somehow prevent the host name of a site from being resolved into its IP address, we can can consider it blocked. In other words, no one can be able to access the site from any browser or service from your computer.
How to do it?
We now have to somehow override the default host name resolution in Windows. There is a file located atC:\Windows\System32\drivers\etc\hosts
that contains overridden entries for host names to ips like
IP HOSTNAME
in each line.
Now, go to
[Start] > All Programs > Accessories
Right Click on Notepad. Click on Run as Administrator
Windows will now ask for permission. Allow it.
Once notepad is opened in Admin mode, click on File > Open
Navigate to C:\Windows\System32\drivers\etc\hosts
At the end of this file, add a line:
127.0.0.1 sitename.com
Where sitename.com is the site you wish to block.
Save this file by pressing Ctrl+S
Voila! We have set the blocking!
Now try to open the site we just now blocked in any of your browsers; It will not work. :)
No comments:
Post a Comment