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

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.
trapperbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SCRLPBCommented:
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
johnb6767Commented:
"This is not a case of DNS caching. "

Even after a reboot is still looks to the old HOSTS file?
0
trapperbAuthor Commented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

trapperbAuthor Commented:
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
SCRLPBCommented:
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
johnb6767Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trapperbAuthor Commented:
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
trapperbAuthor Commented:
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
johnb6767Commented:
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
scrathcyboyCommented:
"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
johnb6767Commented:
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
scrathcyboyCommented:
ha ha !!
0
trapperbAuthor Commented:
Well, it didn't really solve my issue, but I think good efforts should be rewarded.  Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.