Host file or DNS cache first in windows

6,751

They are both tied together in Windows. The displaydns command will show entries that are in the hosts file too. Here's a link to an MS article that explains how it works:

The ipconfig /displaydns command provides you with a means to view the contents of the DNS client resolver cache, which includes entries preloaded from the local Hosts file, as well as any recently obtained resource records for name queries resolved by the system. This information is used by the DNS Client service to quickly resolve frequently queried names before it queries its configured DNS servers.

Share:
6,751

Related videos on Youtube

Siva Prakash
Author by

Siva Prakash

Crazy about Cloud and Data.

Updated on September 18, 2022

Comments

  • Siva Prakash
    Siva Prakash over 1 year

    When there is a DNS query, what do windows checks first - host file or DNS cache ? In linux I can change my preference using nsswitch.conf. Is there something similar in windows.

  • Siva Prakash
    Siva Prakash about 7 years
    Thanks for your time. Say, I have an entry for a domain name in my cache, and I add an entry for the same domain name mapped to a different IP in my host file, which IP will the DNS query resolve to - The one in my cache or host file ?
  • Yisroel Tech
    Yisroel Tech about 7 years
    I'm not really sure, but what seems to me from the MS article is that the cache won't have any entries for the same domain that is already routed in the hosts file, because all the hosts file entries are always loaded in the cache right at the beginning.