TECH / Servers & Websites 4 min read

How to Flush Domain DNS Cache on Google Public DNS and Cloudflare

Antonio NEMCD Author
Published Jun 6, 2015 · 4 min

Recently, while migrating websites to a new server and a new IP address, I moved all files cleanly and updated the domain DNS records. During propagation, I kept an eye on how quickly visitors would start reaching the site on the new server.

DNSDomain Name System (DNS): caching and record propagation

Yandex’s public DNS servers (77.88.8.8) updated almost immediately and started returning the new IP (possibly helped by my 3600-second TTL expiring right around then). Google Public DNS (8.8.8.8), however, stubbornly kept serving the old IP. I even removed Google’s resolvers from my local unbound caching DNS config on one server and kept only Yandex (latency to 77.88.8.8 was also 2–4x lower from my ISP than to 8.8.8.8).

Why DNS Resolvers Return the Old IP: How TTL Works

Every DNS record (A, AAAA, CNAME, MX, TXT) carries a TTL (Time To Live) value – the number of seconds recursive resolvers (Google 8.8.8.8, Cloudflare 1.1.1.1, or ISP DNS servers) are allowed to cache an answer before querying your authoritative nameservers again.

If your zone uses a TTL of 3600 (1 hour) or 86400 (24 hours), some users will continue hitting the old server until their resolver’s cache expires. Before a planned migration, it helps to lower TTL to 300 seconds (5 minutes) a day ahead of time, then raise it back after the move.

Flushing Cached Records on Google Public DNS (8.8.8.8)

At the time of that migration, I did not yet know Google provides an official web tool to force-purge cached DNS records – using it right after switching the IP would have sped up the cutover considerably, since so many people rely on 8.8.8.8, 8.8.4.4, or 4.2.2.2.

Google Public DNS Flush Cache toolGoogle Flush Cache web tool for purging DNS records

To clear stale records on Google Public DNS immediately:

  • Open the tool: go to the official Google Public DNS Flush Cache page (dns.google/cache).
  • Enter your domain: type the hostname (such as example.com or www.example.com) into the Domain Name field.
  • Pick the RR Type: select the record type that changed (A for IPv4, AAAA for IPv6, CNAME, MX, TXT, etc.).
  • Click Flush Cache: Google drops the cached entry right away and fetches fresh records from your authoritative nameservers on the next lookup.

If multiple record types changed (for example both A and MX), flush each RR type separately.

Purging Cache on Cloudflare 1.1.1.1 and OpenDNS

Other major public resolvers offer similar cache purge tools (in fact, I later moved both my site DNS and personal resolver settings to 1.1.1.1 for faster response times):

  • Cloudflare 1.1.1.1: visit 1.1.1.1 Purge Cache, enter the domain name, choose the record type (A, AAAA, CNAME, MX, TXT), and click Purge Cache.
  • OpenDNS (Cisco): use OpenDNS Cache Check to inspect what OpenDNS nodes currently cache and click Refresh the cache to update it.

Flushing Local OS DNS Cache (Windows, Linux, macOS)

Even after purging 8.8.8.8 and 1.1.1.1, your local operating system or browser may still hold the old IP in memory. Flush your local DNS cache with the appropriate command below.

On Windows (Command Prompt or PowerShell):

ipconfig /flushdns

On Linux using systemd-resolved (Ubuntu, Debian, Fedora, etc.):

resolvectl flush-caches

On older systemd releases, use:

systemd-resolve --flush-caches

If you run a local caching resolver such as unbound, you can flush a single domain with:

unbound-control flush example.com

On macOS (in Terminal):

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Verifying That the Domain Resolves to the New IP

To check which IP Google Public DNS is currently returning, query it directly with dig or nslookup:

dig @8.8.8.8 example.com A +short
nslookup example.com 8.8.8.8

To trace the full delegation path from the root nameservers down to your authoritative DNS server and confirm where any stale answer originates:

dig +trace example.com

Purging both public resolvers and your local OS cache makes server IP migrations much smoother without waiting hours for old TTLs to expire.

Related posts:

Leave a Comment