Display DNS cache on Windows
Posted September 5th, 2008 in Windows
It is possible on Windows to display the DNS cache from the command line. This can be useful for diagnosing DNS issues where an invalid or out of date DNS record might be cached. This post looks at how to displayed cached DNS records on Windows, and a post from Wednesday looked at how to flush the DNS cache on Windows.
To display records currently in the DNS cache, open up a command line and enter the following command:
ipconfig /displaydns
A completely empty DNS cache, with only a "localhost" setting in your local hosts file will show something like this:
Windows IP Configuration 1.0.0.127.in-addr.arpa ---------------------------------------- Record Name . . . . . : 1.0.0.127.in-addr.arpa. Record Type . . . . . : 12 Time To Live . . . . : 173129 Data Length . . . . . : 4 Section . . . . . . . : Answer PTR Record . . . . . : localhost localhost ---------------------------------------- Record Name . . . . . : localhost Record Type . . . . . : 1 Time To Live . . . . : 173129 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 127.0.0.1
After look at the homepage of this website with a clean DNS cache, it would show something like this:
Windows IP Configuration www.electrictoolbox.com ---------------------------------------- Record Name . . . . . : www.electrictoolbox.com Record Type . . . . . : 5 Time To Live . . . . : 420 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : electrictoolbox.com 1.0.0.127.in-addr.arpa ---------------------------------------- Record Name . . . . . : 1.0.0.127.in-addr.arpa. Record Type . . . . . : 12 Time To Live . . . . : 173178 Data Length . . . . . : 4 Section . . . . . . . : Answer PTR Record . . . . . : localhost www.google-analytics.com ---------------------------------------- Record Name . . . . . : www.google-analytics.com Record Type . . . . . : 5 Time To Live . . . . : 104 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : www-google-analytics.l.google.com pagead2.googlesyndication.com ---------------------------------------- Record Name . . . . . : pagead2.googlesyndication.com Record Type . . . . . : 5 Time To Live . . . . : 236 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : pagead.l.google.com toolbarqueries.google.co.nz ---------------------------------------- Record Name . . . . . : toolbarqueries.google.co.nz Record Type . . . . . : 5 Time To Live . . . . : 155 Data Length . . . . . : 4 Section . . . . . . . : Answer CNAME Record . . . . : toolbarqueries.google.com localhost ---------------------------------------- Record Name . . . . . : localhost Record Type . . . . . : 1 Time To Live . . . . : 173178 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 127.0.0.1
And finally, if you have entries in your Windows hosts file, these will also show up in the DNS cache. For example, I run an Apache webserver locally and access them in a web browser with .local domain names e.g. www.electrictoolbox.com An example entry from my hosts file looks like this:
192.168.1.15 www.electrictoolbox.local
and the associated records in an ipconfig /displaydns would look like this:
15.1.168.192.in-addr.arpa ---------------------------------------- Record Name . . . . . : 15.1.168.192.in-addr.arpa. Record Type . . . . . : 12 Time To Live . . . . : 172534 Data Length . . . . . : 4 Section . . . . . . . : Answer PTR Record . . . . . : www.electrictoolbox.local www.electrictoolbox.local ---------------------------------------- Record Name . . . . . : www.electrictoolbox.local Record Type . . . . . : 1 Time To Live . . . . : 172534 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 192.168.1.15
So that's how to use ipconfig to display the current DNS cache on Windows. Also refer to my earlier post about how to flush the DNS cache on Windows.
Related posts:
- How to flush the DNS cache on Windows (Wednesday, September 3rd 2008)
- Editing the hosts file on Windows Vista (Sunday, April 20th 2008)
Recent posts:
- MySQL queries for article summaries part 2 of 2 (Tuesday, January 6th 2009)
- Aims for 2009 (Monday, January 5th 2009)
- Weekly Roundup - January 5th 2008 (Monday, January 5th 2009)
- MySQL queries for article summaries part 1 of 2 (Sunday, January 4th 2009)
- 2008 Summary of Posts (Saturday, January 3rd 2009)
- 2008 / 2009 overview (Friday, January 2nd 2009)
Subscribe to RSS Feed / Email / Bookmark / Share
Use the buttons below to subscribe to my RSS feed to be notified next time something is posted, share this post with others, or subscribe by email and have my posts sent in a daily email.
Posts are made using the following schedule (although it may vary some weeks): Mondays & Fridays = PHP; Tuesdays & Saturdays = MySQL; Wednesdays & Sundays = Javascript/jQuery; Thursdays = HTML/CSS.
