create a hosts file

create a hosts file


There are definitely more words than exercise in this tutorial, so please bare with me. I would like everyone, Newbie and Power Users alike, to understand & benefit by the "hosts" file.

Overview:  (For Windows XP)

Creating a "hosts" file can speed up your access to sites you visit regularly. What a "hosts" file does is it  redefines the first opportunity for your computer to find an IP, (Internet Protocol) address to forward your browser to. Normally when you click on a link or type in an address of a site on the Net, you are typing English or an "alpha' value. The connection wants a "numerical" value. The computer sends this alpha information off to your ISP, (Internet Service Provider) so that they can assign an IP address to the typed address. Just a little conversation going on between computers. Then when an IP is established by your ISP, you are whisked away to the site. 

Now, if you have a "hosts" file in your C:\WINDOWS\system32\drivers\etc folder, your machine will always check C:\WINDOWS\system32\drivers\etc\hosts first  for the numerical address associated with a alpha reference if recorded, avoiding the time it takes to locate the IP address. If you don't have a alpha reference with the corresponding numeric value, the alpha URL, (Unified Resource Locator) is sent off to the ISP for the numeric equivalent, IP address. 

All this communications going on between your computer and the ISP takes time. Just a  little bit of time, and results in a small hesitation when accessing a site. A hosts file will greatly reduce the connection time to the site,

The other concern is for the infamous, "Cookies". When you access a site, many of them use the download of their graphics to start the cookie process going. For e.g.:

You access a site that has an ad banner on it. The graphic of the ad banner has been downloaded to your hard drive in the C:\Documents and setting\"User Name"\Local settings\Temporary Internet Files folder. Along with the graphic, a cookie might be sent. If cookies are excepted by your computer, a return of information of your surfing habits go to the web sites statistics treasury. To learn more about Cookies, click HERE

Now. If you don't have cookies turned on, you might not be granted access to the web site. Not having cookies turned on, isn't an answer as your web surfing will be greatly impeded. To avoid being shunned by many of the web sites, you can create a "hosts" file. 

Creating Your Hosts File:

There is a way of  making the "hosts" file, really quickly. For this you will need Tweak Dun from Patterson DesignsVisual Basic 6 Run Time Libraries to be installed previous to Tweak Dun's installation. 

Once you have the program up and running you can click on the Configure Hosts File. In there you will go to the Import tool in the upper tool bar. Use the Import,  From Favorites, command buried in there. This will give you a big jump on your hosts file creation. This creates a hosts file in C:\WINDOWS\system32\drivers\etc for you and includes all the URL's you have already stored and imported from your Favorites . This file you can edit afterwards for the ad banners and any additions you might pick up along the way, in the future. The input style is already created for you by Tweak Dun. If you would like, you don't need Tweak Dun anymore so you can properly uninstall it from Add/Remove programs. The "hosts" file will remain in C:\WINDOWS\system32\drivers\etc.

When Tweak Dun creates the "hosts" file, it makes an area at the top of the hosts file with a pretty border. Kind of a Tweak Dun, Splash on the file. You can remove this safely if you would like.

Custom Entries:

Making custom entries to the a "hosts" file isn't all that difficult. Here is how to set up one of your favourite pages to load a bit quicker.

  1. Go to your favourite page or obtain the address.com part of the address. (In the address bar of your browser you will find this URL address if viewing the page.) 

  2. You want the host address only.
    e.g.: http://www.geocities.com/index.htm
    and all you need to copy is the "www.geocities.com" part of the address.

  3. Now open a Command Prompt window. (Start, Programs, Command Prompt) and type:
    "ping www.geocities.com" (Without the quotes) and this is what you should be looking at.


  4. Now hit Enter on your keyboard and this is what you should have:


  5. Armed with the information contained in the Command Prompt window you can create an entry in your host file. Well. Lets create a host file then. The program you will use is called Notepad. You will find it buried deep within your start menus bowels. Click on Start, Programs, Accessories, click "Notepad".

  6. Take the numbers that are listed after the "Reply from". In this case:
    209.1.224.10

  7. On the notepad workspace type the numbers in and hit your space bar about 6 times. You will need space between the numeric and corresponding alpha entries. At least 2 spaces are required. (I like to keep my columns nice and straight.)

  8. Now type, www.geocities.com .

  9. If you are finished making entries to your "hosts" file, Click on File and Save.

You have just made the first custom entry into your "hosts" file.

Note:
If you use this tutorial to create a "hosts" file, you must periodically update the file. From time to time you will get a "this page cannot be displayed" when accessing a web page. This may be caused by a DNS change. 

  1. Open your "hosts" file and check to see if you have a matching entry for the page you are trying to access. 

  2. If you have the entry, place a 1 in front of the address. Example: 1www.geocities.com

  3. Now save the "hosts" file leaving it open in your taskbar. Use Command Prompt to ping www.geocities.com and record the new DNS numbers.

  4. Exchange the new DNS for the old one and remove the 1 from the address.

  5. Save your modified "hosts" file.

Blocking Ad Banners:
Blocking ad banners isn't all to difficult either.

  1. Right click on the ad banner you wish to not receive, and from the context menu select, "Properties". This will show you the address of the ad banner.

  2. If the address is not the main web host address, (e.g.: ads.geocities.com) then you can make an entry in your "hosts" file.
    It will look like this:

    127.0.0.1      ads.geocities.com

    127.0.0.1
    is your computers, Internal IP address. You have directed your computer to access files requested from ads.geocities.com from the IP address of 127.0.0.1 .Your computer does not have the graphics that are supposed to be downloaded from this site so you get an empty frame where the graphic is supposed to be loaded on the page. If a cookie was to be sent with the graphic, it won't be and no denial of page either. Things speed up a little as well since you are not downloading anything from the site you don't need or want to download.

  3. Here is an example of the "hosts" file I use to view my own pages without ad banners and pop-ups. Click Here

  4. When I create new entries into my "hosts" file, I keep the blocked entries together and the pages I want to load faster, I keep together as well. You will notice this in the Click Here example above.

I think this is a wrap on the subject of "hosts" file.
Happy Surfing!

Beemer's Tutorials...


Beemer's Windows Tips

Go To BeemerWorld

For information on health, wealth building and personal development, click here.