Q&A Monday: Block Sites from Computer
Question:
Hey Jim
hope your doing well and having a good summer! I need a little help. My daughter has autism and she loves Youtube. However, some of the things on youtube are very disturbing. Is there anyway we can totally block Youtube from our computers?
Media, Pa
Answer:
There is a simple an easy way to block sites from a computer, the computer’s hosts file. When a computer looks for a website it has a path of places it will look for the address. The first place the computer will look is the hosts file located on the computer you are browsing from, and that’s where we will block the site.
Open up Notepad on the computer by either going to
Start->Programs->Accessory->Notepad
or
Start->All Programs->Accessory->Notepa
once notepad is opened, click File Open and browse to the following path:
C:\Windows\System32\Drivers\Etc
make sure your file type is set to "All Files" and you should see a file called Hosts
When you open hosts file you will see this displayed in your notepad.
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
You notice that the last line reads 127.0.0.1 localhost. The 127.0.0.1 address is what is called a loop back address and just loops the traffic back to your computer. So this is what we are going to use to create a block on a particular site. For this example let’s use YouTube.com as the site we want to block then we add the following line to the hosts file in notepad:
127.0.0.1 youtube.com
So now the hosts file should look like this:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 youtube.com
Then save the file, and you should now have caused the YouTube site to be blocked. Try it, if you open your web browser and try to point to youtube.com, you’ll see that it can’t find the site, because it’s looking for it on your computer.
I’ve used this technique many times to block sites on computers from home computers to some corporate companies use this. Even if someone uses a search engine and tries to goto the site, they will always end up back here. Now as a note some sites have sub domains like . something.thesite.com. The “something” part of the address might have it’s own address so you’ll need to make sure you add that to the host files as well. It’s always recommend that you test to make sure the entire site is blocked.
——————————————————————————————–
If you have any questions that you want Jim to answer, from business servers to home computers, drop him a line at me@jimguckin.com, and he’ll try to answer your question. Check back every Monday for a new Question and Answer session, and during the rest of the week for other technical insights.