Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
A bit more explanation would make this a better answer. –  Dave M Apr 25 '13 at 16:35
    
There really isn't much to tell. /NodeDelete is well documented, and "..Cache" is ZoneName for all cached lookups. –  dusan.bajic Apr 25 '13 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 '13 at 17:47
    
OK, point taken. –  dusan.bajic Apr 25 '13 at 20:24
    
Awesome! It works perfectly. Thanks for figuring this out. –  natxo asenjo Apr 26 '13 at 21:11
add comment

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

share|improve this answer
    
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. –  natxo asenjo Apr 25 '13 at 8:02
    
by the way, I had already indicated that I could do it from the mmc but thanks anyway –  natxo asenjo Apr 25 '13 at 11:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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