0

We host our application in two data centers. During a production update, we point the customer traffic to datacenter1 and test the update by adding datacenter2 IP in our hosts file, where the update is being done to our domain name. This has been working fine until windows 10. ping returns the datacenter2 IP but not nslookup. Is there a configuration/registry to change the order of dns servers to first look at the hosts file?

I researched several posts like hosts file ignored, how to troubleshoot?, Nslookup not using hosts file, HOSTS file being ignored, etc. but to no avail. Among other things, I tried recreating hosts file with no extension, in the format "<space/tab>".

Any help is greatly appreciated.

  • 2
    NSLOOKUP is specifically a tool to query *DNS*. It doesn't use the `hosts` file at all. This is not a new behavior in Windows 10, this is how it always worked. – Massimo Feb 15 '21 at 20:33
  • 1
    As your second link states clearly, `nslookup` uses DNS, not the hosts file. If `nslookup` is needed for your update solution, set up a simple DNS server (e.g. `dnsmasq` on a Linux VM; but easy to use solutions must exist on Windows) and point the PCs to it. – berndbausch Feb 15 '21 at 20:35
  • 1
    Also, please note that this will not affect your application, because *everything except NSLOOKUP* will use the `hosts` file. You have simply been using the wrong tool for your testing. – Massimo Feb 15 '21 at 20:38
  • @Massimo Their update solution might depend on `nslookup` (which would not be a good idea, but well...). – berndbausch Feb 15 '21 at 20:40
  • Unlikely, this seems more like a "I want to test what happens when the application is running in the other datacenter" scenario. However, if it's a web application, there *is* a thing that could bypass the `hosts` file: using a web proxy. That would also completely bypass DNS lookup on the client machine. – Massimo Feb 15 '21 at 20:57

0 Answers0