1234

TechTips - Block Websites Via the Host File in Windows

TechTips
Network administrators are almost always in a battle to keep network traffic flowing smoothly. Users often don't realize that everything they do on the internet has some sort of affect on the network at work. As network administrator you have to block certain sites to ensure that the right network traffic is flowing smoothly. Now there are many ways to do this, many big companies with lots of money use expensive programs, firewalls, or other hardware and software related methods.

Small businesses can't always afford these expensive tools to help regulate where users can and can't go on the internet, so there is a much easier method that should keep most users from certain sites (tech savvy users might be able to figure this out). You can simply edit the host file of all of the PC's on your network to block certain sites. It's a free method that should at least hinder most users from going where you don't want them to.

So how do you block sites using the Host File in Windows? It's actually very simple, all you have to do is edit the host file in notepad to include the websites you want blocked for the users and then save the file. This is why if you have a user who is somewhat savvy they might be able to figure out how you are blocking their free range of the internet and they can change the file.

So where is the Host File? You can find the Host File in the root directory.

C:\windows\system32\drivers\etc

It is simply called Hosts, you can edit it by double clicking, if prompted choose to open it in notepad or wordpad (you can choose any program you want but those are probably the easiest to use to edit it).

Once open you will most likely see this

# Copyright (c) 1993-2006 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

This is a sample Host File that is probably what you will see if you open your Host File on your PC right now. If you want to block a website all you have to do is:

On a new line below the 127.0.0.1 type in the computers IP (you can get this by doing ipconfig at the command line)

After the IP hit TAB

Now type the website address (www.google.com)

Save the file

Test

Open your web browser and try to open Google, it should give you an error saying that it can't open the webpage. If you received the error message then you have succeeded, you can now add a line for each website you want to block, save the file and move on to the next PC.

This isn't an ideal solution for a big business with thousands of PC's on their network. This is a simple solution for a small business or home office, you could also use this to keep your kids off websites you don't want them visiting (kids usually figure out how to get around stuff like this though).

This is a simple free method for a network administrator to try to limit some of the unwanted internet traffic their users might be creating.

Published by TechTips

I am a senior systems engineer and enjoy writing articles about computers, technology and other electronics.  View profile

1 Comments

Post a Comment
  • Jan Corn5/24/2010

    You've such a whiz at describing how to handle tech info!

To comment, please sign in to your Yahoo! account, or sign up for a new account.