MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-04, 21:53
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default What is the hosts file?

Can someone tell me what the hosts file is and does?
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
Sponsored links
  #2  
Old 07-29-04, 22:18
Matacumbie's Avatar
Matacumbie Matacumbie is offline
Rocky Top
 
Join Date: Aug 2002
Location: Tennessee
Posts: 5,020
Thanks: 0
Thanked 16 Times in 16 Posts
Default Re: What is the hosts file?

eclayton,

Found this, let me know if you want the link for the long version.

The short answer is that the Hosts file is like an address book. When you type an address like www.yahoo.com into your browser, the Hosts file is consulted to see if you have the IP address, or "telephone number," for that site. If you do, then your computer will "call it" and the site will open. If not, your computer will ask your ISP's (internet service provider) computer for the phone number before it can "call" that site. Most of the time, you do not have addresses in your "address book," because you have not put any there. Therefore, most of the time your computer asks for the IP address from your ISP to find sites.

If you put ad server names into your Hosts file with your own computer's IP address, your computer will never be able to contact the ad server. It will try to, but it will be simply calling itself and get a "busy signal" of sorts. Your computer will then give up calling the ad server and no ads will be loaded, nor will any tracking take place. Your choices for blocking sites are not just limited to blocking ad servers. You may block sites that serve advertisements, sites that serve objectionable content, or any other site that you choose to block.


Steve
__________________
PLEASE DO NOT PM ME WITH QUESTIONS REGARDING MARRIAGE RELATED ISSUES

Momma always said "be good".......but she's been wrong before.
Reply With Quote
  #3  
Old 07-29-04, 23:22
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Thanks, Matacumbie,

So where is the Hosts file located?

I wouldn't mind having that link either!
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
  #4  
Old 07-29-04, 23:42
Matacumbie's Avatar
Matacumbie Matacumbie is offline
Rocky Top
 
Join Date: Aug 2002
Location: Tennessee
Posts: 5,020
Thanks: 0
Thanked 16 Times in 16 Posts
Default Re: What is the hosts file?

eclayton,

Here, http://www.accs-net.com/hosts/what_is_hosts.html other articles and issues I came across the file was in different places.

Steve
__________________
PLEASE DO NOT PM ME WITH QUESTIONS REGARDING MARRIAGE RELATED ISSUES

Momma always said "be good".......but she's been wrong before.
Reply With Quote
  #5  
Old 07-29-04, 23:59
acejones's Avatar
acejones acejones is offline
A Different Title
 
Join Date: Nov 2002
Location: Tulsa, OK
Posts: 1,468
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

eric,

my hosts file is in C:\WINDOWS\system32\drivers\etc (posted mine, b/c i thought they were supposed to be in C:\WINDOWS\system32\drivers)

oh yeah...windows xp
Reply With Quote
Sponsored links
  #6  
Old 07-30-04, 06:23
Ken3's Avatar
Ken3 Ken3 is offline
Major Geek
 
Join Date: Nov 2002
Location: Somewhere in Virginia...
Posts: 1,115
Thanks: 34
Thanked 62 Times in 49 Posts
Default Re: What is the hosts file?

Eric - if I remember right you're using Win2000, so from Ace's post replace "windows" with "winnt" and there it is. You can also do a Find on "hosts" to get at it quicker.
Reply With Quote
  #7  
Old 07-30-04, 09:05
Maxwell's Avatar
Maxwell Maxwell is offline
Folgers
 
Join Date: Apr 2003
Location: Wiltshire, UK
Posts: 1,210
Thanks: 11
Thanked 34 Times in 31 Posts
Default Re: What is the hosts file?

Use the hosts file that NICK ADSL UK posts: http://forums.majorgeeks.com/showthread.php?t=38130
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
  #8  
Old 07-30-04, 09:23
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Quote:
Originally Posted by Ken3
Eric - if I remember right you're using Win2000, so from Ace's post replace "windows" with "winnt" and there it is. You can also do a Find on "hosts" to get at it quicker.
Wow, dude, you have a good memory! But, we just recently got XP! :D

Okay, so, if I use the list that Nick posted, and I'm using Spyware blaster, do I just copy and paste those files in the hosts file section of Spyware Blaster? There are also some that are supposed to go into the restricted pages......seems I have my work cut out for me if I do this, but from the sounds of it, it's worth it......

Do I have this right?
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
  #9  
Old 07-30-04, 09:32
Maxwell's Avatar
Maxwell Maxwell is offline
Folgers
 
Join Date: Apr 2003
Location: Wiltshire, UK
Posts: 1,210
Thanks: 11
Thanked 34 Times in 31 Posts
Default Re: What is the hosts file?

Quote:
Originally Posted by eclayton
Okay, so, if I use the list that Nick posted, and I'm using Spyware blaster, do I just copy and paste those files in the hosts file section of Spyware Blaster? There are also some that are supposed to go into the restricted pages......seems I have my work cut out for me if I do this, but from the sounds of it, it's worth it......

Do I have this right?
I have SpywareBlaster version 3.2 but doesn't have a "hosts" section but it does have a means of backing up your hosts file. I usually just download and put the hosts file in place manually plus I protect it by making it read-only.
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
  #10  
Old 07-30-04, 13:27
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Okay, that makes sense, but I'm still not sure how to edit my hosts file.

Can someone walk me through it step by step?
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
Sponsored links
  #11  
Old 07-30-04, 13:31
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Well, maybe I figured this out.
I opened the second link on Nicks post, downloaded the zip file, then copied it and pasted it over top of my old hosts file in C:Windows/system32/drivers/etc

I hope that was right.......
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
  #12  
Old 07-30-04, 14:03
bigbazza's Avatar
bigbazza bigbazza is offline
R.I.P. 14/12/2011 - Good Onya Geek
 
Join Date: Jan 2004
Location: Cairns,Far North Qld,Australia
Posts: 10,768
Thanks: 891
Thanked 331 Times in 293 Posts
Default Re: What is the hosts file?

ec, check out my post today in http://forums.majorgeeks.com/showthread.php?t=38366 in answer to laurieB's question on hosts file. Lots of old MG links there that expand on what is posted here. Beware laurieB 's post hijacked part way through. Look for my post today. bazza.

===

Quote:
Originally Posted by eclayton
Well, maybe I figured this out.
I opened the second link on Nicks post, downloaded the zip file, then copied it and pasted it over top of my old hosts file in C:Windows/system32/drivers/etc

I hope that was right.......
Reply With Quote
  #13  
Old 07-30-04, 17:30
Maxwell's Avatar
Maxwell Maxwell is offline
Folgers
 
Join Date: Apr 2003
Location: Wiltshire, UK
Posts: 1,210
Thanks: 11
Thanked 34 Times in 31 Posts
Default Re: What is the hosts file?

Quote:
Originally Posted by eclayton
Well, maybe I figured this out.
I opened the second link on Nicks post, downloaded the zip file, then copied it and pasted it over top of my old hosts file in C:Windows/system32/drivers/etc

I hope that was right.......
Hang on Eric, did you already have a hosts file? What was in it? Did you keep a backup in case there was something significant in it? Occasionally you may have had some valid address translations in there to do with your e-mail client - see caveats at http://www.mvps.org/winhelp2002/hosts.htm

However, the new hosts will protect you from adverts, etc.
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
  #14  
Old 07-30-04, 19:30
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

I don't think I had a hosts file, because I never made one. Anyway, it's done now!

How do I go about adding the actual addresses of the sites that I want to browse faster? How do i find the number of the site, say, for Major Geeks?

I appreciate everyone's help, I'm learning alot here, it's fun!
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
  #15  
Old 07-30-04, 20:20
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default Re: What is the hosts file?

Quote:
Originally Posted by eclayton
I don't think I had a hosts file, because I never made one. Anyway, it's done now!
Everyone has one. It's just a text file. You can actually just open it up with Notepad or another pure text editor (but not a word procesor like WordPad or MS Word).

The default one looks like this:
Code:
# 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
Quote:
How do I go about adding the actual addresses of the sites that I want to browse faster? How do i find the number of the site, say, for Major Geeks?
Open up a command prompt (Start --> Run --> "cmd"). From here, type "nslookup <domain name>". So for www.majorgeeks.com, it will look like this:
Code:
C:\>nslookup www.majorgeeks.com
Server:  you.dns.server.here.com
Address:  xxx.xxx.xxx.xxx

Non-authoritative answer:
Name:    www.majorgeeks.com
Address:  67.19.72.100
The first part will look different, since I masked what my DNS server is. Now you go to Notepad and open up C:\winnt\system32\drivers\etc\hosts. Add the following line to the end of the file:

Code:
67.19.72.100 www.majorgeeks.com
Save the file and you're done. You don't have to reboot or anything.
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron

Windows 2k/XP Stop Error and Bug Check Codes:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp
Reply With Quote
Sponsored links
  #16  
Old 07-30-04, 20:31
eclayton's Avatar
eclayton eclayton is offline
Sgt. Shorts-cough
 
Join Date: Aug 2002
Location: Chicago
Posts: 1,342
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Very Cool! Thanks so much for the detailed info, it was easy to do. I went ahead and did it with MG, then went to do it with Yahoo......Yahoo has a few addresses. Do I need to enter each line seperately?
__________________
"The best defense is an honest life." Horatio Caine, CSI Miami.

"Everyone wastes time wishing they were somewhere else. If you can't be where you are, you're nowhere." (loose translation from Col. Potter, M.A.S.H. 4077)

"I wouldn't pray to God about Math, I'm fairly certain the Devil created it." - Wenchie
Reply With Quote
  #17  
Old 07-30-04, 23:54
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default Re: What is the hosts file?

Yes. You have to have a line break between each entry (i.e., only one per line), and there must be at least one space between the IP address and the domain name. Also, you can't use wildcards in a hosts file, so *.majorgeeks.com wouldn't be valid, even if www.majorgeeks.com and forums.majorgeeks.com were on the same server. (www.mg.c and forums.mg.c aren't even on the same network, so take note of that if you add both to your hosts file; they have different IP addresses
.)
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron

Windows 2k/XP Stop Error and Bug Check Codes:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp
Reply With Quote
  #18  
Old 07-31-04, 00:56
ANHEDONIC's Avatar
ANHEDONIC ANHEDONIC is offline
Will Title For Food
 
Join Date: Aug 2002
Location: New Jersey
Posts: 1,215
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

hmmm i'm confused... i thought peopel just edited their hosts file to block certain sites... what was the benefit of Eric adding the majorgeeks IP? :

my particular hosts file doesn't have any addy's but it was set to "read only" in properties...
__________________
norml.org
Reply With Quote
  #19  
Old 07-31-04, 01:58
lesley lesley is offline
Private E-2
 
Join Date: Jul 2004
Location: victoria, australia
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: What is the hosts file?

Have read this post with great interest and I have located the hosts file on my C drive (am using windows CP home).

When I opened the hosts file with notepad and added a URL (had obtained the nslookup details) and then went to save it, I had to save as a new file, did not save the file I had opened up. Does this mean that "nothing" is happening? Will my saved file override the original file or is the original file without my additional entry being used??

thanks for your help
Reply With Quote
  #20  
Old 07-31-04, 04:50
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default Re: What is the hosts file?

Quote:
Originally Posted by MiDGeT
hmmm i'm confused... i thought peopel just edited their hosts file to block certain sites... what was the benefit of Eric adding the majorgeeks IP? :

my particular hosts file doesn't have any addy's but it was set to "read only" in properties...
Well, whenever you try to resolve a domain name, Windows checks the local DNS cache before anything else. There are two ways to get into the DNS cache: 1) be in the hosts file (a static cache), 2) be a domain name that was previously resolved this session (a dynamic cache).

So, whenever a web browser or other piece of software requests DNS name resolution, it can find frequently used domain names in the dynamic or static cache. By default, the static cache only has the one entery for localhost, so the dynamic cache is the only one used.

However, there's some problems with the dynamic cache. First, the size of the cache is limited. So eventually you'll start popping out old domains for new ones. Second, domain names not from the hosts file only stay in the cache for a set amount of time (known as a time-to-live) before being removed from the cache. Additionally, if you restart the system the dynamic cache automatically gets reset.

The hosts file (static cache) doesn't have a fixed limit (and, to the best of my knowledge, doesn't take up any of the dynamic's size limit) and the entries never expire, so Windows never has to go out and ask the DNS server where www.google.com is, for example.

There's a few problems with the hosts file, however. First, you have to edit the file manually. It's not automatic like the dynamic cache, so it requires a lot of user action to configure. Second, because it's static it doesn't take into account DNS changes. If the IP for www.google.com happens to change, for example, you will not be able to access that website until you manyally edit the hosts file again.

Still, the hosts file does have a wide number of uses. because it can point to the wrong IP address, a lot of ad sites and spy sites can be added to hosts file and told to point to the IP address 127.0.0.1, a special IP address called the loopback (actually, it's any address with the first octect of 127). It always means "this machine". So if you point all these bad sites at the loopback IP, they go nowhere and just time out.

However, there are also some types of malware that purposefully alter the hosts file. What if you put in an entry that pointed www.google.com to the Bonzi Buddy homepage? Therefore, a lot of spyware protection programs make the hosts file read-only to help prevent this kind of DNS cache poisoning.

If you want to see the contents of the DNS cache, you can open up a command prompt and type "ipconfig /displaydns". You can empty the dynamic cache by entering "ipconfig /flushdns".

On this page, scroll down to #2 and you'll see some registry hacks to improve the performance of the Windows dynamic DNS cache (but I've never used them so I can't exactly recommend it).
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron

Windows 2k/XP Stop Error and Bug Check Codes:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp
Reply With Quote
Sponsored links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:39.


MajorGeeks.Com Home Page
| Admin Tools | All In One | Anti-Spyware | Anti-Virus | Appearance | Backup | Benchmarking | BIOS | Browsers | Covert Ops |
Data Recovery | Diagnostics | Drive Cleaners | Drive Utilities | Drivers | Driver Tools Ergonomics | Firewalls | Games | Game Tweaks | Graphics | Input Devices | Internet Tools | Macintosh | Mail Utilities | Memory | Messaging | Monitoring | Microsoft | Multimedia | Networking | Office Tools | Process Management | Processor | Registry | Security | System Info | Toys | Video | Miscellaneous
|
Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger