Company Logo
Company Logo

Parker & Myers Computers

(270)527-2233 or (270)489-2082

Security page logo
Security page logo

SECURITY

The Hosts File Part 1

The Hosts file available to Windows, Mac, and Linux users (almost everyone) is a very versatile tool. It can improve the security of your computer. It can block ads thereby improving browsing speed. It can be used as a parental control for net browsing youngsters. All these uses and not only is it free but you already have it!

When clicking a link or typing in a web address You see something like this: http://www.microsoft.com and once you are familiar with URLs (Universal Resource Locator) you will know this takes you to the Microsoft web site. Your computer and the servers that make up the Internet don't understand this address style, they only understand numbers. The www.microsoft.com gets converted to 207.46.225.60 an IP address which IS understood by computers. This is accomplished through DNS (Domain Name System) servers that keep a list of domain names and there corresponding IP addresses.

Before sending a query to a DNS server your computer checks its own hosts file for the IP address. When an IP address is found the computer stops looking and sends a request to that IP address. Since the "local host" (your computer) has an IP address of 127.0.0.1 , you can list a host name for an ad company like tribalfusion.com and assign it this address. This effectively blocks ads or anything else from that site.

I mentioned you already have a host file. To use it you need to know where it is on your drive. Here are the locations for Windows users.

You also already have the tools to edit your hosts file. A simple text editor, such as Notepad, is all it takes. It is recommended to make a copy of your original host file and save it with a different filename before making any entries. Once you have a back up host file open Notepad and click on "File"

Notepad
then click on "Open"
File Menu

This calls the "Open" dialog.

File Open Window
Click the down arrow on the "Files of Type:" box.

File Type
Click on "All Files"

Next click the down arrow in the box labeled "Look In" Open Navigation



Then click on your "C:" drive. Your drive may have a label other than "Local Disk" and if your installation is not standard your Windows folder may be located on a drive with a different letter designation.

Windows Folder

When you have located it click on the Windows folder unless you have Windows 2000 in which case click on the WinNT folder.

Windows 98/ME users should now look for the host file if it exists. If not you will find a sample file named "host.sam" Now click on that file name.

System32 Folder

Windows 2000 and Windows XP users need to look for the "System32" folder and click on it.

Drivers Folder
Next look for and click on the "Drivers" folder.

Now open the "ETC" folder ETC Folder

Here is where Win2000 and XP users will find their host file. Open the Host File



Click on it and Notepad will open the file or as shown here highlight the host file then click the "Open" button.

You should wind up with something similar to this Hosts File
At the top is a brief set of instructions for host file usage. For those not familiar with scripting or other types of programming, comments are for the benefit of humans and completely ignored by the computer. Each line beginning with a "#" is a comment line. Notice also that none of the host names are preceded by the familiar "http://www." This is NOT used by the host file even though this isn't mentioned in the instructions. Another important detail not mentioned is the fact that an entry with an IP of 127.0.0.1 blocks the whole site not just a single page on the site. The "127.0.0.1 localhost" is the only entry in the host file that should NOT be removed.

In the time since first writing this article, we have run across a situation in which the hosts file was being used to block a particular site. This hosts file was on a computer that was part of a network. A broadband Internet connection was accessed via a NAT router to which the computers on the network were attached. In this situation when items were entered into the hosts file in the manner shown above the hosts file didn't block access to the site. Adding "www." to the site name entry solved the problem. The point is test your hosts file when you have it set up to make sure it is doing the job properly.

Find the last entry

Now that the do's and don'ts have been covered, we can make an entry to the host file. Place your cursor (the vertical line that blinks) at the end of the last entry and hit the "Enter" key. This puts the cursor at the beginning of the next line. The keyboard shortcut for this procedure is to press and hold down the "Cntrl" key then hit the "End" key. Release both keys and hit "Enter". Although this sounds like a lot of trouble there is a good reason for doing it this way. Basically the host file is a Data Base file. Each line represents a record in the database and the data fields of each record are separated by spaces. The last record in the data base ends with a special character EOF (End of File). Using the "Cntrl" + "End" key sequence places the cursor between the last printable character and the EOF character. That way when you hit "Enter" the EOF is automatically moved to the end of the record your about to enter.

Enter Local Host

Now type "127.0.0.1" then to keep everything lined up neatly hit the "Tab" key.

Host Name

Now when you type in the host name "coolwwwsearch.com" you will still have 2 orderly columns.

This exercise gives you practice in making host file entries and protects your computer from a source of some particularly hard to remove spyware. The other entries shown here are adware companies with the exception of the "filtered.by.edexter" entry.

When you have finished entering host names save the file. Here is another detail not mentioned in the instructions. The host file doesn't use a file extension in its filename. Notepad has a tendency to place a .txt on the end of file names. Therefore, if after making your entries and saving the file, you find that it doesn't work then check the filename in Windows Explorer to make sure there is no extension.

Microsoft, Microsoft Office, Windows, Windows XP and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other names have been included in the above text that are trademarks of the respective companies.

  Top of Page     Next Page