Display the Contents of Your DNS Cache
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.
Contents
Steps
Flushing the DNS Cache on a Phone or Tablet
- 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.
- Open the "Settings" menu. Scroll until you find the "Wi-Fi" menu.
- For an Android, find the "Wireless and Networks" menu in "Settings".
- 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.
- Swipe your phone's wifi switch back on. Wait until the wifi icon appears, then return to the "Settings" menu.
- 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.
- 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.
- Hold down the "lock screen" button until the screen lights up. This will turn your phone back on.
- 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.
Viewing the DNS Cache on a PC
- 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".
- Click "Windows System".
- 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.
- Type "ipconfig /displaydns" without the quotation marks. Double-check your typing, then hit ↵ Enter to view the cache.
- 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.
- 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.
- 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.
Viewing the DNS Cache on a Mac
- Open "Spotlight". Spotlight's icon is a magnifying glass located in the top right corner of your screen.
- Search for "terminal" and open the Terminal app. Terminal lets you access system information--such as your DNS cache--through typed commands.
- 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.
- 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.
- 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.
- 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.
- Close and reopen Terminal. This will help you avoid command errors when checking the next section of your DNS cache.
- 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.
- 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.
- 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.
- 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).
- 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".
- 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.
Related Articles
Sources and Citations
- http://windowsitpro.com/networking/how-can-i-view-and-clear-my-dns-cache-content
- https://technet.microsoft.com/en-us/library/cc781949(v=ws.10).aspx
- http://www.techradar.com/us/how-to/software/operating-systems/how-to-check-on-os-x-dns-cache-statistics-1298931
- http://www.dnscomparison.com/about4.html
- http://osxdaily.com/2014/11/20/flush-dns-cache-mac-os-x/