Monday, January 30, 2012

Blocking websites in your computer

If you want to block certain websites due to several reasons like parental restrictions or whatever use the following guidelines.

You will have to edit the host file. Here I will show you how to edit it in Ubuntu. The format of the host file is same in linux or windows so you will be fine even in windows.

Open your terminal
Your hosts file may be read only. so change it to read write. To do so you have to type in the command
sudo chmod +w /etc/hosts
Open the hosts file to edit it. You may open it using the commands :
sudo gedit /etc/hosts
You will see following things in your file.
127.0.0.1 localhost
127.0.1.1 abc-laptop


# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
In windows 7, the hosts file is located at
C:\Windows\System32\drivers\etc
You won't have the access to edit it. So in order to enable the editing:
right click on the hosts file
Click on properties
Click on Security
Choose your username then click edit
Check on the full control option.
Click on Apply and then on Ok
You can now edit the file.

What follows now is applicable to both windows and linux

You don't need to care about IPV6. Just ignore it. Now you need to add a line in the first block. Line to be added would be something like
127.0.0.1 www.facebook.com
Here I used it to block facebook, instead you can replace www.facebook.com with any domain name you would like to be blocked. So your final file would look something like this
127.0.0.1 localhost
127.0.1.1 mahesh-laptop
127.0.0.1 www.facebook.com
127.0.0.1 twitter.com
127.0.0.1 http://www.youtube.com


# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
Now save the file and close it.


Congratulations! Your sites are blocked

No comments:

Post a Comment