Home / Display DNS cache on Windows

Display DNS cache on 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.