Hi Richard,
I'm sorry, but, this confuses me. You say that I only put addresses for
domains I DO NOT want to access in the HOSTS file. Correct? Then, I don't
understand the benefit for me to have a HOSTS file, as I know what domains I
want to go to, but, I have no idea what domains I would not want to visit to
put their address into the HOSTS file. Plus, since I would not go there in
the first place, what point would there be to putting them in the HOSTS
file. ??
Not quite right. You can put ANY domain's IP address in the HOSTs
file. However, you only assign the 127.0.0.1 to domains you do NOT
want to access. All other can have their own valid external IP
address and will be accessed normally.
The way you find out what domains you do NOT want to visit is to
download one of the supplied HOSTS files that already have thousands
of ad server domains listed with all of them pointing to 127.0.0.1.
It's also not a question of your deciding not to go there in the first
place. It is a question of whether a site which you go to for
whatever reason (or are redirected to by a site which you have chosen
to visit for whatever reason) may be an ad-server unbeknownst to you
or which may have a page which access an ad server. The HOSTS file
protects you from those situations.
Perhaps my understanding is all wrong. I had the impression that the purpose
of the HOSTS file was to protect you from the ad servers on the areas of the
Internet that you normally access.
That is partially correct. As I indicate above, you can also use the
HOSTS file to access other Web sites. The advantage to this is that
if you know the IP address of the site you want to go to, the system
will get that IP address from the HOSTS file directly without having
to go out to the DNS server and have it looked up. This can speed up
Web surfing slightly. Of course, most of us don't know and don't
really care what the IP address is of the sites we visit - we usually
address them by domain name. But if you have a concern for efficient
surfing repeatedly to the same sites, you can learn the IP address of
the site and place it in the HOSTS file which will then be used by
Windows to access the site slightly faster than if it has to use the
DNS server of your ISP.
This is how I thought it was supposed to work, but, obviously my
understanding of how it is to be set up is all backwards.
No, you've pretty much got it, you just need to understand that the
HOSTS file can be used for both ad-blocking and for speeding up access
to repeatedly visited Web sites and that blocking an ad-server doesn't
necessarily block a domain that refers to the ad-server domain. Most
people just use it for ad blocking, tho. And such use doesn't
conflict with DNS as long as you don't put the 127.0.0.1 IP address in
for domains you DO want to visit.
In other words, to block an ad on Microsoft's Web site, you'd put the
ad-server domain name (which might be something like
adclick.spammer.com - which is referenced by Microsoft's Web page
HTML) in the HOSTS file with an IP address of 127.0.0.1, but you DON'T
put Microsoft's domain name in there with that IP address. Then when
you tell your browser to go to Microsoft, it goes to the HOSTS file,
doesn't find Microsoft, goes out to your ISP's name server and
requests Microsoft's IP address, gets it, retrieves Microsoft's main
page, then when your browser reads the reference in the main page HTML
to the ad server and tries to retrieve the ad, Windows goes to the
HOSTS file, sees the ad server has an address of 127.0.0.1, and does
absolutely nothing. So the ad is never returned, and your browser
loads the rest of the page more quickly because it never has to
download the ad. So you get the Microsoft page with everything except
anything coming from that ad server.
Clearer now?