Fix a DNS cache that is wrong

We'll confirm the wrong IP with dig or nslookup, flush the DNS cache on your OS, and verify resolution—or tell you when to change DNS or call support.

Category
Troubleshooting · Wi‑Fi & networking
Time
2–5 min
Last reviewed
What you'll need
  • Terminal or Command Prompt (with admin/sudo)
  • The domain that resolves wrong

Step-by-step diagnostic

Step 1 of 7
Show full guide

Steps

Goal: Confirm the wrong IP, flush the cache, and verify resolution.

  • Run dig example.com and dig @8.8.8.8 example.com (replace example.com with the domain). If the IPs differ, your DNS cache has the wrong value.
  • Good: Local resolution differs from 8.8.8.8—cache is the cause. Proceed to flush.
  • Bad: Both match—check the hosts file or other causes.

Windows — flush

Goal: Clear the DNS cache on Windows.

  • Open Command Prompt as Administrator (right-click, Run as administrator).
  • Run ipconfig /flushdns. You should see “Successfully flushed the DNS Resolver Cache.”
  • Good: Flush succeeds. Proceed to Verify.
  • Bad: Error—ensure you ran as Administrator.

Mac — flush

Goal: Clear the DNS cache on Mac.

  • Open Terminal. Run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Enter your password when prompted.
  • No output usually means success. The cache is cleared.
  • Good: Command completes. Proceed to Verify.
  • Bad: Permission denied—ensure you have sudo access.

Linux — flush

Goal: Clear the DNS cache on Linux.

  • If using systemd-resolved: sudo systemctl restart systemd-resolved.
  • If using nscd: sudo systemctl restart nscd or sudo service nscd restart.
  • Good: Service restarts. Proceed to Verify.
  • Bad: Service not found—your distro may use a different resolver; check documentation.

Verify

Goal: Confirm the cache returns the correct IP after flush.

  • Run dig example.com or nslookup example.com again. The ANSWER section (dig) or output (nslookup) should show the correct IP.
  • Compare to dig @8.8.8.8 example.com—they should match.
  • Good: IPs match. The cache is fixed.
  • Bad: Still wrong—change DNS to 8.8.8.8 or 1.1.1.1, flush again, or call support.

When to get help

Contact your ISP or network admin if:

  • Flush succeeds but resolution stays wrong.
  • dig @8.8.8.8 shows the correct IP but your resolver keeps returning the wrong one (upstream DNS issue).
  • You cannot run admin or sudo commands and need help.

Verification

  • dig example.com and dig @8.8.8.8 example.com return the same IP.
  • nslookup example.com shows the correct IP.
  • The site loads correctly in the browser.

Escalation ladder

Work from the device outward. Stop when the problem is fixed.

  1. Confirm wrong IP Use dig or nslookup to compare local vs 8.8.8.8.
  2. Flush cache ipconfig /flushdns (Windows), dscacheutil + mDNSResponder (Mac), or restart resolved/nscd (Linux).
  3. Verify Run dig or nslookup again—IP should match.
  4. Change DNS server Use 8.8.8.8 or 1.1.1.1 if cache keeps repopulating wrong.
  5. Call support ISP or network admin if resolution stays wrong.

What to capture if you need help

Before calling support or posting for help, have these ready. It speeds everything up.

  • Domain that resolves wrong
  • IP from dig/nslookup before flush
  • IP from dig @8.8.8.8 (expected correct)
  • OS and flush command used
  • Steps already tried

Does dig or nslookup show the wrong IP?

Compare local resolution to a known-good resolver.

Run `dig example.com` and `dig @8.8.8.8 example.com`. If the IPs differ, your DNS cache has the wrong value. Good: you confirmed the wrong IP. Bad: both match—the issue may be elsewhere (hosts file, firewall).

You can change your answer later.

Check hosts file or other causes

If dig and 8.8.8.8 match, the cache is not the cause. Check the hosts file (see fix-hosts-file-blocks-site) or firewall. The wrong IP may come from another source.

Which OS are you on?

Flush command differs by OS.

Windows: `ipconfig /flushdns`. Mac: `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder`. Linux: `sudo systemctl restart systemd-resolved` or `sudo systemctl restart nscd`. Good: flush succeeds. Bad: error—run as admin/sudo.

You can change your answer later.

Run as Administrator or with sudo

Windows: right-click Command Prompt, Run as administrator. Mac/Linux: ensure you have sudo. Retry the flush command.

Does dig or nslookup show the correct IP now?

Verify the cache has fresh data.

Run `dig example.com` or `nslookup example.com` again. Compare to `dig @8.8.8.8 example.com`. Good: IPs match—cache fixed. Bad: still wrong—try different DNS server (8.8.8.8) or call support.

You can change your answer later.

Change DNS server and flush again

Set device or router DNS to 8.8.8.8 or 1.1.1.1. Flush again. If resolution stays wrong, the wrong data may come from upstream—call ISP or network admin.

DNS cache fixed

The cache now returns the correct IP. Resolution should work for the domain.

Reviewed by Blackbox Atlas

Frequently asked questions

Why does the DNS cache return wrong results?
The device stores DNS results locally to speed up lookups. When a site moves to a new IP or you change DNS records, the cache can hold the old IP until it expires or you flush it.
How do I check what the DNS cache has?
Use `dig example.com` or `nslookup example.com` to see what your system resolves. Compare to `dig @8.8.8.8 example.com` to see what Google DNS returns—if they differ, your cache may be wrong.
Does flushing DNS cache affect anything else?
No. Flushing only clears stored DNS results. The next lookup fetches fresh data from your DNS server. No data loss or connection change.

Rate this guide

Was this helpful?

Thanks for your feedback.

Continue to