?
Solved

How can I change the location of the hosts file in Windows XP?

Posted on 2010-03-22
13
Medium Priority
?
418 Views
Last Modified: 2012-05-09
I am trying to change the location of the hosts file in Windows XP.  I have changed the location in the "DataBasePath" value at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.  I have also changed "DataBasePath" wherever else I find it in the registry.

However, even after rebooting several times, Windows XP insists on using the former DataBasePath value to find the hosts file.

This is not a case of DNS caching.  I have tested this by creating a gibberish word for a domain in the new hosts file and in the old hosts file and associated it with two different IP addresses.  The gibberish domain resolves to the IP address in the old hosts file.  Changing the IP address in the old hosts file shows immediate results.

It is also not associated with the browser I am using.  Not only have I tested this with IE and Firefox, but if I ping the domain I will still get the IP address in the old hosts file.

I have tested this on a XP SP3 install and a XP SP3 VM install.  Same result.


Has anyone actually gotten this to work?  I have seen plenty of advice on how to change the location, but not, seemingly, a lot of people who have actually done it and gotten it to work.

This same question was asked here: http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_23212176.html but with no conclusive result.

The accepted solution mentioned trying it with a new AD account, but there was no response from the asker on whether it worked or not.  I don't see how AD could make a difference when this is a machine setting, not a user setting.

If you have actually gotten this work and you have some insight on my problem I would be mighty grateful.
0
Comment
Question by:trapperb
  • 5
  • 4
  • 2
  • +1
13 Comments
 

Expert Comment

by:SCRLPB
ID: 28294520
Hi,

I presume you wish to change the hosts file to another location, possibly a single point of contact.  I'm also assuming you're in a situation where there's a domain setup in place.

Your best bet is to use group policy to deploy changes to the hosts file.  It might also bode well to restrict the file to local and domain admins to prevent unauthorised changes.

That said, if you really want to make it so that you can make changes to a "global" hosts file, you could build a Linux machine and install dnsmasq, which will use Linux's host resolving mechanisms to determine the IP address of a certain host, then forwards it back.  This means that if you make entries in the Linux machine's /etc/hosts file, it will resolve as if it came from a nameserver on the Internet.  A VM is ideal for this, and the setting can easily be deployed via DHCP.  Once you have that in place, simply replace the hosts file with an empty file and make it read only to all.

HTH
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 28364208
"This is not a case of DNS caching. "

Even after a reboot is still looks to the old HOSTS file?
0
 

Author Comment

by:trapperb
ID: 28366243
Thanks SCRLPB

dnsmasq certainly looks interesting, but I don't see how you've answered my question.

Are you suggesting that Windows XP would reside as a VM on a Linux box that would use dnsmasq to resolve NAT requests?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 

Author Comment

by:trapperb
ID: 28366562
johnb6767:

That is correct.  Also, any changes I make to the OLD hosts file immediately resolve.  If I delete the OLD hosts file, then it will completely skip local resolution--ignoring the hosts file in the new location.  It's like it ignores whatever value is in DataBasePath in favor of some other, internal value.
0
 

Expert Comment

by:SCRLPB
ID: 28393783
trapperb:

No, what I mean is to run Linux in a VM (especially if you don't have the rackspace to spare, and this application has very little footprint so a separate box would be a waste of space), with dnsmasq installed and configured.  By using the hosts file on the Linux box, it allows you to centralise its management to one location for access by all.
0
 
LVL 66

Accepted Solution

by:
johnb6767 earned 1000 total points
ID: 28396077
Sorry, but I am having a hard time understanding why it would revert to the old HOSTS file... I have done this with no problems before, usually a reboot clears everything up (it stops/restarts the TCPIP service), to process the changes......

In a domain though, too many other variables. I have suggested the fix as well, with no negative feedback.....

Odd indeed.....

Can you humor me for a breif moment? See if the below link's reg mods help any......

Tweak DNS Errors Caching in Windows 2000 / XP
http://www.speedguide.net/read_articles.php?id=158

One more thing.....

Once it reverts to using the old HOSTS file, is the DatabasePath value still pointing to another custom location you specified?
0
 

Author Comment

by:trapperb
ID: 28398733
I can understand why you'd be having a hard time understanding....I've been working on it for a couple of weeks now and I still don't understand why it's doing what it's doing.  :-)

I thought of the domain issue.  That's why I used a gibberish word that I knew was not being used at any level of my domain.

Yes, the DataBasePath value is still pointed to the custom location even while XP is using the old location of the hosts file.

I'll give the article a try and get back to you.

Thanks!
0
 

Author Comment

by:trapperb
ID: 28698066
Hey John6767.

It is definitely not a DNS caching issue.  The changes I make are immediately apparent, not cached.  The problem still is that the OS is completely ignoring the DataBasePath and so I must  change the old hosts file.  

Thanks for the idea though.

0
 
LVL 66

Expert Comment

by:johnb6767
ID: 28740500
Im sorry, but I dont have anything else... I will keep my eyes open though... It might be one of those things you need to call , *gulp* Microsoft for.....
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 28740793
"the OS is completely ignoring the DataBasePath and so I must  change the old hosts file.  "
"The gibberish domain resolves to the IP address in the old hosts file."

NON SEQUITUR.  

You don't change the path to the hosts and LMHOSTS files -- you change the values in those files to accomplish what you want.
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 28741638
Well yea, but if you want to point to a central location, that can be done by modifying the registry key for the DataBase path......

It usually works....
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 28742003
ha ha !!
0
 

Author Closing Comment

by:trapperb
ID: 31705839
Well, it didn't really solve my issue, but I think good efforts should be rewarded.  Thanks.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A few solutions to a problem some of us have been having when trying to add Hostgator email accounts to Outlook 2016 (will probably work with Outlook 2013 as well).
A simple method to resolve a "keyboard not working" problem by modifying the Windows registry. This issue can often be encountered after using the VMware vCenter Converter Standalone Agent to perform a Physical-to-Virtual (P2V) conversion process.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Suggested Courses

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question