Ok, so explain to me how the WinXP hosts file works again.....

Oct 19, 2000
17,860
4
81
I'm looking for info on how the hosts file works in Windows. I know where to find it, and was told it's pretty self explanatory on how to use it when you see it, but I must be stupid, because I don't know how or what to type in.

This is kind of a vague post for those who do not know what I'm talking about, so I'll leave it up to anyone who is bored to explain what the hosts file is.

TIA
 

Kadarin

Lifer
Nov 23, 2001
44,296
16
81
Originally posted by: BCYL
Doesn't the hosts file map names/alias to IP addresses?

Correct. It manually maps host/domain names to ip addresses. When looking up the ip address for a given domain, the OS will check the hosts file first before querying the DNS server. Hosts file entries will override DNS because of this, so the concept of modifying the hosts file to map common ad sites to localhost or an invalid ip address is a valid one.
 

FoBoT

No Lifer
Apr 30, 2001
63,084
15
81
fobot.com
RTM
search your system for the file, open it, read it

# 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
 
Oct 19, 2000
17,860
4
81
Originally posted by: Astaroth33
Originally posted by: BCYL
Doesn't the hosts file map names/alias to IP addresses?

Correct. It manually maps host/domain names to ip addresses. When looking up the ip address for a given domain, the OS will check the hosts file first before querying the DNS server. Hosts file entries will override DNS because of this, so the concept of modifying the hosts file to map common ad sites to localhost or an invalid ip address is a valid one.
So what is the proper format to input these new maps in the file? I don't think it makes it clear enough as how to correctly input what you want.

Say I want the address microsoft.com to point back to localhost, how would I type that in so the file will automatically read this and basically disallow access to the real microsoft.com?
 

FoBoT

No Lifer
Apr 30, 2001
63,084
15
81
fobot.com
it is pretty clear, it includes an example

list the ip, leave some type of whitespace, list the FQDN , save the file

thats all you have to do