If you are wondering how to block a website from opening then one of the possible ways to block it is using hosts file. Hosts is a file that contains lists of host names and its mapping IP addresses , Operating System first looks into the hosts file that is located in your PC and then queries the DNS for relative IP address of the host name.
The Possible location of hosts file for your windows is
|Windows NT/2000/XP Pro||c:\winnt\system32\drivers\etc\hosts|
|Windows XP Home / windows 7||c:\windows\system32\drivers\etc\hosts|
Now let us look how to block a website.
For the websites that don’t have related information in hosts file will be queried DNS to get its IP address, Suppose for the host google.com the IP address is 188.8.131.52,
You can find the ip address of the website you want to by opening command prompt and pinging it using the command
Then it replies like
Pinging google.com [184.108.40.206] with 32 bytes of data:
The IP in the brackets is the IP address of the host , Then your PC will send http requests to that particular IP , Now if you want to block this website all you have to do is open hosts file located in the above mentioned paths and pointing the IP of host to your local system itself. If you don’t know the IP of local system is 127.0.0.1 , Then when you try request google.com , the ip of the host is returned as 127.0.0.1 which is not true so it could not connect.
There are some websites which you want to block , may be if you are using pirated software and don’t want to let the software application to connect to its update servers or may be you don’t want to see ads of google etc. All you need to do is just mention the ip address of host name to local address as
etc.., then the hosts IP address is resolved to local IP and cannot be opened. Some times this changes won’t work immediatly because of dns cache, you can flush it using command
This is just blocking at your local computer level and can be accessed from different system using same internet connection.