2

in bind9 I can use rndc flushname zone.tld from a shell.

In the Windows DNS mmc I can select the zone and delete it.

With dnscmd I can flush the whole cache, but I just need to flush a zone's cache every now and then.

Is it possible and how? TIA

2 Answers 2

3

DNSCmd.exe is used to display and change the properties of DNS servers, zones, and resource records. You can find detailed syntax here. As much as I would like to give proper reference and explanation for this, I found it by random googling, trial and error: cached lookups seem to be internally stored in Zone called ..Cache, and each cached zone is only a node under "..Cache", so the right switch to use is /NodeDelete:

dnscmd dnsserver.local /NodeDelete ..Cache whatever.com [/Tree] [/f]

 /tree    Specifies to delete all of the child records.
 /f       Executes the command without asking for confirmation.

Still, it would be cool if anyone could find "..cache" in MS official documentation.

5
  • A bit more explanation would make this a better answer.
    – Dave M
    Apr 25, 2013 at 16:35
  • There really isn't much to tell. /NodeDelete is well documented, and "..Cache" is ZoneName for all cached lookups. Apr 25, 2013 at 16:38
  • 1
    Answers that consist of a blind command are not really "good" answers. The standard on Server Fault is that an answer should explain both the "How" and the "Why". That includes providing a few words summarizing the "well documented" flags.
    – voretaq7
    Apr 25, 2013 at 17:47
  • OK, point taken. Apr 25, 2013 at 20:24
  • Awesome! It works perfectly. Thanks for figuring this out. Apr 26, 2013 at 21:11
3

I'm afraid that programatically, you'll have to resort to /clearcache.

dnscmd doesn't have that functionality builtin, and there's nothing obvious in the API spec that suggest such a operation is exposed

You can do it from the GUI, though I doubt that's any help
To view and remove cached entries from a Windows DNS Server:

  1. Open the DNS Management Console (dnsmgmt.msc)
  2. Go to the View menu, and select Advanced
  3. Expand your DNS Server entry in the left pane
  4. Expand Cached Lookups
  5. To remove a cached record or an entire zone, simply right-click and choose "Delete"

For authoritative Servers, you can either refresh or reload zone data, depending on the source type.
For secondary name servers to refresh zone data from the master server:

dnscmd dns1.domain.tld /zonerefresh my.zone.domain.tld

For active directory integrated zones, reload the zone data from AD:

dnscmd dns1.domain.tld /zonereload my.zone.domain.tld

assuming that the fqdn of your dns server is dns1.domain.tld. and my.zone.domain.tld. is the fqdn of the zone

2
  • Thanks for your answer. I am afraid my question regarded a caching DNS server, not an authoratitive one. I have edited the title of the question to reflect this. Apr 25, 2013 at 8:02
  • by the way, I had already indicated that I could do it from the mmc but thanks anyway Apr 25, 2013 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.