Ignored (Hosts/TCP/IP) DatabasePath registry value

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
I'm trying to centralize the Hosts file onto a network hard disk for a group of computers at my work place. However, the HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DatabasePath registry item appears to be ignored by WIndows7. I need help to either fix or work around this problem.

So far, after hours of researching on the Internet, and experimentation on one Win7 machine (Home Ed.), I have come to a personal conclusion that Windows7 does not support the DatabasePath anymore, and the existence of DatabasePath is either a left-over or backward-compatibility for apps and programs. I have found on the Internet only one (ask&ans) post on Aug/24/2011 that directly asks about both Win7 and the fact that the DatabasePath registry value being ignored. So far, the poster is still waiting for an answer. (ref http://superuser.com/q/319949)

From the Internet, it seems that the problem with relocating the Hosts file happens mostly with Win7 (and works fine with WInXP), and any problems in the other Windows versions are mainly due to errors of some kind with either the registry's DatabasePath, or the Hosts file, or security authorization.

In my experiments, I used a temporary folder in my 'c' drive to hold the test Hosts file, and I verified the following points:

-My test Hosts file does work as I've copied and tested it in the \Windows\System32\drivers\etc folder.

-No matter what the HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DatabasePath is set to in the registry, Win7 will always read the Hosts file in c:\Windows\System32\drivers\etc even after a reboot or "ipconfig /flushdns."

-I could MOVE the \etc folder to the \Windows folder, set DatabasePath to c:\Windows\etc (or even %SystemRoot%\etc), reboot, and Win7 will still try to find 'Hosts' in c:\Windows\System32\drivers\etc, after which Win7 operates as if the Hosts file was empty. (After verifying that Win7 will not load the Hosts file from c:\Windows\etc, moving the \etc folder back to c:\Windows\System32\drivers, and either rebooting or issuing an "ipconfig /flushdns"--without changing the registry--will reload the Hosts file table properly.)

-On the chance a program was interfering, I did a clean boot (using msconfig to prevent loading all non-system programs at boot-up), and Win7 still tried to read a c:\Windows\System32\drivers\etc\hosts file when DatabasePath was pointed somewhere else.

-The registry really is case-INsensitive.
 

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
This is a small LAN and a small company. I'm trying to avoid having to buy another computer or different Windows 7 OS as much as I can. Also the overhead to maintain a server (of any kind) is more than any benefit we would get out of it. We would most likely have to give-up on centralizing the Hosts file if I can't find a work-around this Window 7 issue.
 

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
Thanks for the suggestion, but it would require starting that computer first before any other machines, and leaving that computer on for the duration of the day; both situations which cannot be assured, and is not desirable at this point in time. I will keep MaraDNS in mind though.
 

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
It is done per machine/user. Again, it's a small company, and only one machine really has any data that would require backup. Also, it would not be impossible to rebuild the data if push comes to shove.
 

lkjhgfdsa

Distinguished
Sep 19, 2011
1
0
18,510
You found my post while searching for an answer and I found yours while doing the same (yes, I’m still waiting). :( Unfortunately it does indeed seem that Windows 7 ignores the entry. The TechNet page says nothing about what versions of Windows it works in (though the article is from Windows 2000), and the latest information I can find is for Server 2003, which does not include that entry (though the whole thing is incomplete, so it may not be because it is not supported).

Using a DNS server is out of the question for me as well because I am dual-booting XP and 7 on a single system, and I am trying to use that registry entry to keep the HOSTS file in sync between the two OSes.

At this point, I am considering the option of just hacking DNSAPI.DLL to replace the hard-coded path with my own. It’s ugly, but at least I’ll get Windows to behave the way I want/need it to. :??:

--
Synetech
 

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
Glad to have you in the discussion, lkjhgfdsa/Synetech! :D

My alternative that I'm considering was to see if this little utility by Microsoft would help keep my multiple copies in sync: MS SyncToy. My guess is I would either need to run it after my changes to the master file (best case) or I need to run it on each computer to update each copy (hopefully it is automatic). Well, we'll see if it is better than nothing.

Update: a recent tech-support reply with an incorrect solution got me wondering whether the IPv6 could be overriding the registry entry, or have specific requirements on the location of the Hosts file. So, I tried to do a maximum disable of the IPv6 via both a registry entry and the "Change adapter settings" (in Control Panel > Network and Sharing Center). . . Disabling had neither effect of where Win7 looked for the Hosts file nor whether Win7 acknowledges the registry entry.

Let me know how that DNSAPI.DLL hack goes.
 

Pete-ohki

Distinguished
Sep 9, 2011
6
0
18,510
Well I just got a confirmation from someone who probably knows best:

After researching on this, I found that Windows 7 does not support moving hosts file to the other place. You may refer to the following link to use script to copy hosts file to etc folder.

http://www.techimo.com/forum/networking-internet/108391-using-hosts-file-across-network.html

Important Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
___________________________________________________________________________________
(Quote source: Windows Client TechCenter > Windows 7 IT Pro Forums )
A disappointed "c'est la vie." I didn't learn about the DatabasePath registry until recently.