How to Display the Contents of Your DNS Cache

Three Methods:Flushing the DNS Cache on a Phone or TabletViewing the DNS Cache on a PCViewing the DNS Cache on a Mac

You can display the contents of your Domain Name System ("DNS") cache by using the Command Prompt app on PCs or the Terminal app on Macs. It can then be flushed through a series of commands, or by an Airplane Mode reset on mobile. DNS caches are responsible for cataloging the sites you visit, but a DNS error can prevent you from being able to view these sites. Displaying and flushing the cache will help fix these errors.

Method 1
Flushing the DNS Cache on a Phone or Tablet

  1. Image titled 121665 1
    1
    Close all apps to prepare to flush your DNS cache. You can't actually view the DNS cache on mobile, but you can flush the cache and thereby fix any DNS or "timing out" errors you have encountered.
    • Make sure your browsers in particular are closed.
  2. Image titled 121665 2
    2
    Open the "Settings" menu. Scroll until you find the "Wi-Fi" menu.
    • For an Android, find the "Wireless and Networks" menu in "Settings".
  3. Image titled 121665 3
    3
    Select the "Wi-Fi" tab, then swipe the "Wi-Fi" switch to the left. Wait until your data indicator appears in the upper left-hand corner of the phone.
    • If you have an Android, tap the "Wi-Fi" switch to turn the wifi off.
  4. Image titled 121665 4
    4
    Swipe your phone's wifi switch back on. Wait until the wifi icon appears, then return to the "Settings" menu.
  5. Image titled 121665 5
    5
    Turn "Airplane Mode" on, then off again. Find "Airplane Mode" at the top of your Settings menu on iPhone. Be sure to wait a few moments (for the wifi indicator in the upper left-hand corner to disappear) before turning Airplane Mode back off again This will reset your network settings, thereby enabling the DNS cache to flush.
    • For Android, select "More" in the Settings menu to access the Airplane Mode setting toggle.
  6. Image titled 121665 6
    6
    Hold the "lock screen" button down, then swipe the "Slide to Power Off" button to the right. This will turn off your phone and flush your DNS cache. Leave your phone off for at least 15 seconds.
    • For Android, you need to hold down the "Power" button, then tap "Power off" in the resulting menu.
  7. Image titled 121665 7
    7
    Hold down the "lock screen" button until the screen lights up. This will turn your phone back on.
  8. Image titled 121665 8
    8
    Confirm that your DNS cache flush worked. Use your phone's browser to visit any site where you encountered a DNS error. You should now be able to access the site!
    • Loading your frequently-used sites for the first time after a DNS flush will take longer than usual, since your DNS cache is being updated.

Method 2
Viewing the DNS Cache on a PC

  1. Image titled Display the Contents of Your DNS Cache Step 9
    1
    Open the Start menu and click on "All Apps".
    • For earlier operating systems, replace clicking "All Apps" with clicking "All Programs" and then selecting "Accessories".
  2. Image titled Display the Contents of Your DNS Cache Step 10
    2
    Click "Windows System".
  3. Image titled Display the Contents of Your DNS Cache Step 11
    3
    Right-click the "Command Prompt" app and select "Run as Administrator". This should open "Command Prompt" with full access, allowing you to enter system commands.
  4. Image titled Display the Contents of Your DNS Cache Step 12
    4
    Type "ipconfig /displaydns" without the quotation marks. Double-check your typing, then hit Enter to view the cache.[1]
  5. Image titled Display the Contents of Your DNS Cache Step 13
    5
    Look over the DNS cache by scrolling through the "Command Prompt" interface. You can use the results of your search to view the IP addresses of frequently-visited sites, or you can flush your DNS cache.
    • The DNS cache also stores your web browsing history - even if you clear it from your browser.
  6. Image titled Display the Contents of Your DNS Cache Step 14
    6
    Flush your cache by typing in "ipconfig /flushdns". Don't include the quotation marks. If you're encountering DNS errors in your browser, flushing your cache will fix this problem. Flushing can also help your computer run faster by keeping your website data up-to-date.[2]
  7. Image titled Display the Contents of Your DNS Cache Step 15
    7
    Confirm that your DNS cache flush worked. Open a browser and visit a site where you previously encountered a DNS error. You will now be able to access the site!
    • Loading sites after a DNS flush will often take longer than usual.

Method 3
Viewing the DNS Cache on a Mac

  1. Image titled Display the Contents of Your DNS Cache Step 16
    1
    Open "Spotlight". Spotlight's icon is a magnifying glass located in the top right corner of your screen.
  2. Image titled Display the Contents of Your DNS Cache Step 17
    2
    Search for "terminal" and open the Terminal app. Terminal lets you access system information--such as your DNS cache--through typed commands.
  3. Image titled Display the Contents of Your DNS Cache Step 18
    3
    Type "sudo discoveryutil udnscachestats" into Terminal. Don't include the quotation marks. Press Return when you're done.
    • The "sudo" part of the command sets up the rest of the command for "root privilege", which allows you to view sensitive system information.
    • The "discoveryutil" part of the command request the DNS information from your system.
    • The "udnscachestats" part of the command displays one of two sections of your DNS cache.
  4. Image titled Display the Contents of Your DNS Cache Step 19
    4
    Enter your Administrator password into Terminal. This should be the password you use to log in. Press Return when you finish typing. Terminal should display your Unicast DNS cache.[3]
    • The Unicast DNS (UDNS) cache translates website addresses (such as Facebook) into IP addresses for your computer to use during future searches.
    • With Unicast, your address sends out one IP address request to one server per site, regardless of how many servers exist. If that server becomes unresponsive, you will encounter a DNS error.[4]
  5. Image titled Display the Contents of Your DNS Cache Step 20
    5
    Look over the Unicast DNS cache by scrolling through the Terminal. You can use the results of your search to view the IP addresses of frequently-visited sites. If you encountered a DNS error, the UDNS cache is the most likely location of the problem.
    • You can also use the UDNS cache to check your recent site history. You will need to check the Multicast DNS cache as well for a complete report.
  6. Image titled Display the Contents of Your DNS Cache Step 21
    6
    Close and reopen Terminal. This will help you avoid command errors when checking the next section of your DNS cache.
  7. Image titled Display the Contents of Your DNS Cache Step 22
    7
    Type "sudo discoveryutil mdnscachestats" into Terminal. Don't include the quotation marks. Press Return when you're done.
    • The "sudo" part of the command sets up the rest of the command for "root privilege", which allows you to view sensitive system information.
    • The "discoveryutil" part of the command request the DNS information from your system.
    • The "mdnscachestats" part of the command displays your Multicast DNS cache.
  8. Image titled Display the Contents of Your DNS Cache Step 23
    8
    Enter your Administrator password into Terminal. This should be the password you use to log in. Press Return when you finish typing. Terminal should display your Multicast DNS cache.
    • The Multicast DNS (MDNS) cache also translates website addresses (such as Facebook) into IP addresses for your computer to use during future searches.
    • With Multicast, your address sends out multiple IP address requests to multiple servers per site. If one server becomes unresponsive, you still have multiple connections to other servers, meaning you're much less likely to encounter a DNS error on a Multicast network than on a Unicast network.
  9. Image titled Display the Contents of Your DNS Cache Step 24
    9
    Look over the Multicast DNS cache by scrolling. You can use the results of your search to view the IP addresses of frequently-visited sites.
    • You can also use the MDNS cache to check your recent site history. Checking the MDNS cache in conjunction with the UDNS cache will give you a full history report.
  10. Image titled Display the Contents of Your DNS Cache Step 25
    10
    Flush your DNS cache(s). Type "sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say cache flushed" into Terminal. Hit Return to finalize the flush. This will reset your saved website data and clear any DNS errors you may encounter. This command is appropriate for the the latest version of OS X (10.11).[5]
    • This command flushes both cache sections (UDNS and MDNS). Flushing both sections resolves any current errors and prevents future errors from occurring, so you should always flush both for consistency. Flushing the cache will not harm your computer.
    • The Terminal commands to flush the DNS cache vary between OS X versions. Find out what version you are running by going to the Apple menu and selecting "About This Mac".
    • For OS X 10.10.4 and up type "sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say cache flushed".
    • For OS X 10.10 to 10.10.3 users should type "sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches; say flushed".
    • For OS X 10.7 to 10.9 type "sudo killall -HUP mDNSResponder".
    • For OS X 10.5 to 10.6 type "sudo dscacheutil -flushcache"
    • For OS X 10.3 to 10.4 type "lookupd -flushcache".
  11. Image titled Display the Contents of Your DNS Cache Step 26
    11
    Confirm that your DNS cache flush worked. Use your browser of choice to visit a site on which you encountered a DNS error. You should now be able to access the site!
    • Loading your frequently-used sites for the first time after a DNS flush will take longer than usual, since your DNS cache is being updated.

Tips

  • Turning on and off Airplane Mode and then restarting any tablet or mobile phone should always flush the DNS cache.

Warnings

  • You should always back up your computer and double-check all of your commands for accuracy before entering them into Command Prompt or Terminal.
  • Be wary of viewing or resetting the DNS cache on a work or shared computer. Always be sure to ask for permission first.

Article Info

Categories: Networking