Let's Take Care Of The Requirements
Setting up your computer to block websites is easy, unfortunately it's also easy for people (your kids for example) to undo your changes to the Windows HOSTS file. In order to prevent this from happening we need to setup at least 2 user accounts.
One account will be an Administrator (you) and the other account will be a limited user account (your kids). Your Administrator account should have a strong password that no one else knows (especially your kids). The limited user account(s) do not have to have passwords, but they can if you want.
Limited user accounts prevent people from making changes to the computer. Therefore your kids will NOT be able to install new software, change settings or delete system files.
Setting up administrator and limited user accounts is easy but they are quite a few steps. So, I have created a article that shows you how to create a limited user account in Windows XP and Vista. I'll also show you how to make an administrator account
Please make sure you have your Administrator and limited user accounts setup before reading the rest of this article.
How Your Computer Finds Websites
Before we start talking about what the Windows Host file is, lets look at how your computer finds websites.
1. You open your web browser (Internet Explorer or Firefox).
2. You type in an address like www.yahoo.com and click enter.
3. Your computer queries the Windows host file for the ip address of yahoo.com This ip address looks like 220.127.116.11.
4. Since your HOSTS file does not have an entry for yahoo.com your computer will query the DNS servers listed in your TCP/IP settings for the ip address of yahoo.com.
5. Your computer gets the ip address for yahoo.com and your browser displays the yahoo.com home page.
So, those 5 steps above are actually a simplistic explanation for how your computer finds and loads a website.
Block Websites With The Windows HOSTS File
Ok, since we now know that our computer looks for websites locally first (in the HOSTS file) we can edit the contents of the HOSTS file so that our PC NEVER goes on the internet to find websites. Sounds sorta confusing huh?
Basically it means every website we add to our hosts file will not load if we set the value of the website to 127.0.0.1 (which is your computer). Here is an example.
Your kids are going to myspace.com a lot and they are picking up all kinds of nasty viruses (yes, many viruses come from myspace.com pages). You need to put a stop to it. Here's how:
1. Login as Administrator
2. Click Start (or the little globe in the bottom left if on Vista)
3. Click Run (in Vista just type where it say's "start search")
4. Type in the word: Drivers. Click Enter.
5. Double Click the Etc folder.
6. Right Click the hosts file, then click properties.
7. Uncheck the read only checkmark if it is checked.
8. Click apply, then click OK.
9. Double Click the hosts file.
10. Windows will ask you to choose the program to open the file with. Click Notepad
11. You will see an extry that looks just like: 127.0.0.1 localhost
12. We are going to add our myspace.com entry below this entry. Type 127.0.0.1 myspace.com
13. Click Save
14. Now, try going to myspace.com....you can't. You computer thinks that myspace.com resides on your local pc, of course it doesn't, so the site never loads.
15. Done! Add any other sites or domains you'd like to block.