Can't get my host file to work properly...

Kelemvor

Lifer
May 23, 2002
16,928
8
81
So I'm at work and trying to test a website. I entered the IP and URL into my hose file in the standard format:
xx.xx.xx.xx www.xxxx.com

I also added it without the www just to be safe.

I flushed my DNS and rebooted but when I type in the URL it still goes to the normal website.

I checked some place in the registry where you can set the order of where it checks and hosts is set to check before DNS.

I even set it to 127.0.0.1 assuming I'd just get an error that way but it still went out to the normal site.

I don't know if the work network is somehow screwing something up here or what. Any ideas for me?

Windows XP and multiple browsers to check.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
There is a potential for there to be multiple hosts files;
Search for such and rename all but one
 

Kelemvor

Lifer
May 23, 2002
16,928
8
81
Searched the whole PC and just the one hosts file in the etc folder where it belongs.
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
Can you temporarily change your network card properties so that no DNS servers are specified and see if the entry in your hosts file works? You might want to flushdns after removing DNS servers from the NIC properties.

Microsoft says that the name resolution process for Windows XP is to make sure that it's not looking for an address for the local hostname, then check the hosts file, then check DNS, then try netbios. The first place with a valid entry is supposed to be the address used...so none of this work should be necessary because your entries in hosts should happen before DNS is even an option.
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
There's your answer.

The HOSTS file will work as expected once you plug into a home network, or direct connect.

I wouldn't buy that as being the answer to his problem. The operating system's ability to process the hosts file isn't something that will magically change when the computer is plugged into a different network.

OP - search google for "hosts file not working" or "windows xp hosts file not working". Some people need to delete and re-create the file to get the OS to process it. Others have needed to reinstall Windows. Some also suggest running winsock fix.
 

Slugbait

Elite Member
Oct 9, 1999
3,633
3
81
I wouldn't buy that as being the answer to his problem. The operating system's ability to process the hosts file isn't something that will magically change when the computer is plugged into a different network.
Actually, it probably would magically start working. Many corporations employ methods that intercept URL requests so that you'll hit the corporate DNS first, I believe they can use proxies or NetBIOS Name Server. One reason for doing this is proper resolution when requesting an internal corpnet web site. And some IT depts don't like it when you manually mess with the HOSTS file.
 

seepy83

Platinum Member
Nov 12, 2003
2,132
3
71
Actually, it probably would magically start working. Many corporations employ methods that intercept URL requests so that you'll hit the corporate DNS first, I believe they can use proxies or NetBIOS Name Server. One reason for doing this is proper resolution when requesting an internal corpnet web site. And some IT depts don't like it when you manually mess with the HOSTS file.

I don't think you understand the way the process works. The Operating System looks at the HOSTS file first. If it finds an IP address for the hostname there, it doesn't go on to ask the DNS servers what IP address it should contact. When the HOSTS file is being processed correctly, there is no opportunity for anything else on the network to interfere. The computer then sends out a request to an IP address...not a hostname.

Yes, many IT departments don't want you to manually mess with a HOSTS file. Preventing that is done by denying permissions to edit the file.

Unless someone else comments on this thread with facts about how a network/systems admin can force the operating system to not process the HOSTS file, I'm sticking to my belief that the OP's computer has a fixable problem. I've been a systems and network administrator for 5 years and I don't know of a way to force the windows OS to ignore a HOSTS file. That's not to say there isn't a way to do it, but I've never heard of one.

OP can check the options for his browser to see if it's configured to use a Proxy server and rule that one out. Since he said he has multiple browsers to check, I'm assuming that his IT department isn't bothering to locking down those settings when the users can install additional ones. OP can probably also use ping from a cmd prompt to see what address the computer resolves the hostname to. A proxy should only effect the web browser.
 
Last edited:

Emulex

Diamond Member
Jan 28, 2001
9,759
1
71
127.0.0.1 active.asdf.com

nslookup active.asdf.com should go to dns
ping active.asdf.com will go to 127.0.0.1

so if the active.asdf.com is just doing a normal connect - not dns tunneling then the hosts file will do its job.