How do I flush my Pi-hole cache?

#1

Why Do We Need Cache?

Cache plays an important role with Pi-hole. This is part of the reason Pi-hole can make your network perform faster. Once a queried domain name has been cached, future replies for that same domain name will be much faster since Pi-hole already knows about it.

Problems When White Or Black Listing

However, you can run into issues if you decide to white or blacklist a domain that is already cached. For example, if you saw ads on a site and decided to blacklist wsp.mgid.com, you may not immediately see the ads disappear. This is most often due to caching.

Since Pi-hole already responded to a query for wsp.mgid.com, it doesn’t know that this domain should be blocked until you flush the cache–even though it exists on the blacklist. Pi-hole won’t know about this change until the cache is flushed (or the cache expires, which is defaulted to 300 seconds).

Flushing The Cache

But running

pihole restartdns

will flush the cache and allow a newly-blacklisted (or whitelisted) domain to be answered correctly (see below).

More Complexity

You may find that running that command still does not make whatever site you are visiting to display properly. This is because cache exists in several other places:

  • your browser may cache content
  • your operating system may cache DNS queries
  • other apps or systems used to access your domain may use cache along the way

because of this, you may need to flush cache in one or more of the above places before you see an effect (in addition to restarting Pi-hole’s DNS server).

4 Likes
Poor performance compared to Ublock
Spotify for iOS not working?
PiHole on a synology nas ignoring blacklist?
Pi-hole blocking websites on mobile, working fine on desktop
Why won't Pi-hole work with DNS rebind protection enabled?
URL in whitelist is still blocked
Still able to access blacklisted website
Boston.com
Pi-hole blocking websites on mobile, working fine on desktop
Pihole query log doesn't work after update to 3.3
Blocked although whitelisted and not found in blocklists
How to unblock these redirect sites?
Pihole Block Wired but not wireless network
Log shows endless processing
Pihole still blocking google play store
Whitelist issue
Pihole is blocking whitelisted website
Only 2 Clients Appear on the Admin Console
How to sort out site issues?
#2

for windows to permanently disable the DNS caching service use these steps

  1. Click the start button.
  2. Type services.msc in the search box.
  3. Click on services.msc in the search results.
  4. Scroll down until you see “DNS Client” in the “Name” column.
  5. Double click on “DNS Client.”
  6. Click the Stop button.
  7. To re-enable DNS caching, you can click the Start button found by repeating steps 1-5.

to Easily view and clear the chrome DNS Cache go to this address in chrome chrome://net-internals/#dns

3 Likes
#3

A question on flushing the DNS cache, dealing with a Whitelist issue. If temporarily halting Pi-Hole causes the expected behavior and resuming Pi-Hole causes the whitelist entry to again be ignored, does that point away from an issue with the browser or device/OS cache?

#4

Well if you’re having issues in 3.3, look here:

Otherwise, I would say it could be either one or a combination of both.

#5
assigned jacob.salmela #6
#7

Any idea why the stop and run buttons are greyed-out and cannot be “clicked” for this service?
Other services have the start/stop options.

I have tried to run services.msc as admin and the usual window to allow didn’t appear, it started normal. Windows 10 here.