Check DNS Cache

Last updated

To flush your DNS cache, run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS, ipconfig /flushdns on Windows, or sudo resolvectl flush-caches on Linux. Clearing the DNS cache forces your system to fetch fresh DNS records instead of using stale cached data.

Why flush your DNS cache?

Every DNS lookup is cached for up to the time-to-live (TTL) of the record. When you change a record, the old value can stay in a cache until it expires, which makes it look as if the update did not happen.

Example:

A dig query for www.example.com through a public resolver. Notice the TTL in the ANSWER section:

$ dig www.example.com

;; ANSWER SECTION:
www.example.com.    3600    IN    CNAME    example.com.
example.com.        3600    IN    A        192.0.2.1

The same query a minute later:

;; ANSWER SECTION:
www.example.com.    3540    IN    CNAME    example.com.
example.com.        3540    IN    A        192.0.2.1

The resolver is counting down: it will keep serving the cached answer for another 3540 seconds (59 minutes). If you change the record now, this resolver may not show the change for up to an hour.

Note

Flushing the local DNS cache only clears the cache on the device you are using. It does not affect the cache stored by the upstream DNS resolver. If the upstream resolver is still holding outdated data, you will continue to receive the same old response even after flushing your local cache.

To find out where the old value is coming from, compare two queries:

  • dig www.example.com shows what your resolver returns, and how long it will keep caching it.
  • dig @ns1.dnsimple-edge.com www.example.com asks DNSimple’s name server directly, so it always shows the current value.

If DNSimple’s name server already returns the new value but your resolver does not, wait for the TTL to run out. If your resolver returns the new value but your browser or apps do not, clear your local cache with the methods below.

If you are experiencing DNS resolution issues after clearing your cache, see Troubleshoot Record Resolution Issues or Troubleshoot Domain Resolution Issues for additional help. You can also check your domain’s resolution status to verify your domain is properly configured.

Everyday methods

Before checking a record update, you can also:

  • Clear your browser cache (Settings > Clear browsing data > Cached images and files).
  • Restart your browser or computer to trigger a fresh lookup.
  • Try another device or network (for example, mobile data instead of Wi-Fi).
  • Use an online DNS lookup tool.

How to flush DNS cache by operating system

The command varies by operating system:

  • macOS:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Windows:
    ipconfig /flushdns
  • Linux (systemd-resolved):
    sudo resolvectl flush-caches
    • On older systems, the command is sudo systemd-resolve --flush-caches.

Have more questions?

If you have additional questions or need any assistance with your DNS cache, just contact support, and we will be happy to help. You can also read more about DNS hosting at DNSimple.