I ran into the following problem under Windows 7: name resolution uses the result from a DNS lookup instead of using what I have in my local hosts file. This is different from previous versions of Windows. What workarounds are there to fix this bug?
My local hosts file contains the following entries (I disabled IPv6):
# ::1 localhost 127.0.0.1 localhost 127.0.0.1 svn.mydomain
I can ping svn.mydomain and Windows 7 resolves the name as 127.0.0.1, as expected.
However, nslookup resolves svn.mydomain as 192.168.4.105, which is the entry that comes from my office network's domain nameserver. Windows XP correctly returns 127.0.0.1. I recently moved the server in-house, which is why the svn.mydomain resolves through DNS now, but doesn't when I am outside the office network. I would prefer to not remove that host from DNS.
I specifically put this entry in hosts so I could create a secure tunnel to the Subversion repository on my server (localhost -> svn.mydomain) regardless of my network connection, and it is configured to respond only through a tunneled connection. This bug broke that solution and I'd really like to "resolve" (yes, pun intended) this problem.
How do I keep Windows 7 name resolution from overriding hosts entries?