I know that you shouldn't have duplicate entries in your Windows NT hosts file, windows\system32\drivers\etc\hosts
, but what is the expected behavior if you have them?
You can have multiple entries with the same hostname but different addresses in the Windows NT hosts file (windows\system32\drivers\etc\hosts
). When you access that host on the network, the Windows DNS system will resolve it to one of those entries. How can I tell which entry will be used?
E.g.:
127.0.0.1 mydomain.com
192.168.1.1 mydomain.com
Edit: This particular example seems to force special behavior. The loopback seems to override any entry, regardless of order.
Or:
192.168.1.2 mydomain.com
192.168.1.1 mydomain.com
I am seeing the first entry in the list take precedence.
But, is the behavior I am seeing guaranteed, is it version specific, or is it generally unreliable?
The reason I ask is because I am writing some scripts to handle hosts, and I am trying to figure out if I can reliably select one of them to remove/comment out, and expect there to be no impact to the user's system.
127.0.0.1
seems to force special behavior. I edited the question to ask about the different scenarios...