Display DNS Resolver Cache in Windows  

Page 1 of 2 12 LastLast
    Display DNS Resolver Cache in Windows

    Display DNS Resolver Cache in Windows

    How to Display Your DNS Resolver Cache in Windows
    Published by Category: Network & Sharing
    06 May 2022
    Designer Media Ltd

    How to Display Your DNS Resolver Cache in Windows


    A DNS (Domain Name System) resolver cache is a temporary database, maintained by Windows, that contains records of all your recent visits and attempted visits to websites and other Internet domains.

    The Internet relies on the Domain Name System (DNS) to maintain an index of all public websites and their corresponding IP addresses. Every time a user visits a website by its name (such as "tenforums.com"), the user's web browser initiates a request out to the Internet, but this request cannot be completed until the website name is converted into an IP address.

    This conversion process is called name resolution and is the job of DNS, but it takes time. A DNS cache attempts to speed up the process by handling the name resolution before the request is sent out to the Internet.

    If the IP address of a website changes before your DNS cache updates, you may not be able to load the webpage. If you are running into a lot of Page Not Found errors and you know you are connected to the Internet, you could try flushing your DNS cache to have your computer request new information.

    Viewing the contents of your DNS cache may help in troubleshooting to verify name resolution and IP.

    This tutorial will show you how to view the contents of your DNS resolver cache in Windows 7, Windows 8, and Windows 10.

    ipconfig /displaydns Output Explained:

    Output Description
    Record Name This is the name you query DNS for, and the records (addresses or something else) belong to that name.
    Record Type This is the type, displayed as a number - although more commonly they are referred to by their names, internally (in the DNS protocol) each has a number. Type 1 is "A" for "address", an IPv4 address. (IPv6 uses type 28, "AAAA", for an address four times as long.) "PTR", type 12, is a "pointer" to a hostname - most commonly used when mapping an IP address back to its name. "CNAME" is "canonical name".
    Time to Live This is the time in seconds after which the cache entry must expire.
    Data Length This is the length in bytes - an IPv4 address is four bytes, IPv6 is sixteen bytes. For CNAME or PTR, Windows displays a static number (either 4 or 8, depending on your system) - this is actually the size of a memory address where the actual text is kept.
    CNAME Record Domain (will check the address of this domain instead of the domain, CNAME records can have a very long TTL so its useful to avoid unnecessary queries.)
    A (Host) Record This is the IPv4 address of the domain name.
    AAAA Record This is the IPv6 address of the domain name.


    Contents

    • Option One: To Display DNS Resolver Cache in Command Prompt
    • Option Two: To Export DNS Resolver Cache to a .txt File






    OPTION ONE

    To Display DNS Resolver Cache in Command Prompt


    1 Open a command prompt.

    2 Copy and paste the ipconfig /displayDNS command into the command prompt, and press Enter.

    3 You will now see the contents of your DNS cache.

    Display DNS Resolver Cache in Windows-display_dns_cache_command.png

    If you see a Could not display the DNS Resolver Cache message, then either item below may be the cause.

    1) You just flushed the DNS resolver cache. If so, then the next time you open a web page, the DNS cache will have content again.

    2) The DNS Client service has been disabled. If so, then enabling the "DNS Client" service and setting it to Automatic (Trigger Start) and Start (Running) will allow the DNS cache to work again.

    Display DNS Resolver Cache in Windows-display_dns_cache_command-2.png






    OPTION TWO

    To Export DNS Resolver Cache to a .txt File


    1 Open a command prompt.

    2 Copy and paste the command below into the command prompt, and press Enter. (see screenshot below)

    ipconfig /displayDNS >%USERPROFILE%\Desktop\DNS_cache.txt

    Display DNS Resolver Cache in Windows-output_dns_cache_to_file_command.png

    3 You will now have a DNS_cache.txt file on your desktop.

    4 You can open the DNS_cache.txt file to see the contents of your DNS cache.

    Display DNS Resolver Cache in Windows-dns_cache_txt_file.png

    If you see a Could not display the DNS Resolver Cache message, then either item below may be the cause.

    1) You just flushed the DNS resolver cache. If so, then the next time you open a web page, the DNS cache will have content again.

    2) The DNS Client service has been disabled. If so, then enabling the "DNS Client" service and setting it to Automatic (Trigger Start) and Start (Running) will allow the DNS cache to work again.

    Display DNS Resolver Cache in Windows-dns_cache_txt_file-2.png


    That's it,
    Shawn Brink






  1. Posts : 56,825
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #1

    Good one, Shawn.

    404 errors are a good reason to take a look-see at the DNS. In addition, rogue sites and malware could inject a re-direct of say BANANAS.COM to ROTTENEGGS.COM. If a query to a site is obviously going somewhere else, one of the reasons may be this, along with things like infected hosts file and a hijacked site. If things look strange, the sister tutorial for flushing the DNS should be used. A little explanation about the TTL. The DNS is never automatically erased/flushed. Each entry remains for the duration of it's Time to Live (TTL).

    Default max is 1 day (86400 secs), unless specified in the DNS record. Bad responses are kept for a default of 5 minutes. That can explained what some experience...."It wasn't working yesterday, but today it's fine!".

    http://windowsitpro.com/networking/h...tive-responses

    windows 7 - How often does the DNS cache clear? - Super User
      My Computers


  2. Posts : 68,923
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Thank you Dick. I added some additional explanation of the output to the tutorial to help. :)
      My Computers


  3. Posts : 2,979
    Windows 11
       #3

    Why is my DNS cache full of random websites I've never heard of or ever visited?
      My Computer


  4. Posts : 68,923
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    Kol12 said:
    Why is my DNS cache full of random websites I've never heard of or ever visited?
    Hello Matt,

    Possibly from cookies, 3rd party software checking in for updates, etc...
      My Computers


  5. Posts : 2,979
    Windows 11
       #5

    Brink said:
    Hello Matt,

    Possibly from cookies, 3rd party software checking in for updates, etc...
    Hi Shawn,

    Does the Hosts file have anything to do with the DNS cache? Some of the entries in my cache match sites I've added to the Hosts file (C:Windows\System32\drivers\etc) to block browser mining...
      My Computer


  6. Posts : 68,923
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    Kol12 said:
    Hi Shawn,

    Does the Hosts file have anything to do with the DNS cache? Some of the entries in my cache match sites I've added to the Hosts file (C:Windows\System32\drivers\etc) to block browser mining...
    The displaydns command does indeed show entries that are in the hosts file.
      My Computers


  7. Posts : 2,979
    Windows 11
       #7

    Brink said:
    The displaydns command does indeed show entries that are in the hosts file.
    Interesting. Thanks Shawn!
      My Computer


  8. Posts : 68,923
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Kol12 said:
    Interesting. Thanks Shawn!
    I had to look that up to discover. I didn't know for sure either.
      My Computers


  9. Posts : 2,979
    Windows 11
       #9

    Brink said:
    I had to look that up to discover. I didn't know for sure either.
    Thanks Shawn. I'll read some more into it as well.
      My Computer


 

Tutorial Categories

Display DNS Resolver Cache in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:35.
Find Us




Windows 10 Forums