I modified the TTL value for a particular Host Record of type A in the dns management --right click that record-->properties--> changed TTL vale. But when I called the DNSQuery() function to retieve the modified TTL value of that record I am getting the same default TTL value.

But when I viewed that record's TTL value in the dns management it is displaying the modified value only..

After changing the TTL of a particular dns record do I need to restart DNS service??

plz correct me if I missed anything step while changing TTL.......

thanks for your concern. Steps I followed:

changed ttl for a RR from 20minutes to 24 minutes, after more than 20min I called the below query

  ulRet = DnsQuery(
    cout<<"Current DNS TTL value"<<dnsTTL<<"\n";

but still Iam getting the output as Current DNS TTL value 1200( means 20 minutes in sec) instead of 1440 sec(means 24 min)

1 Answer 1


If you have Active Directory enabled DNS, are you sure you're querying the same DNS server as you're writing the change to? If not, make sure you allow time for replication.

If it's not AD-enabled, are you closing the DNS console before querying? I'm pretty sure I read something about changes not being committed until you close it - sounds nuts, doesn't it, but I've never had non-integrated DNS so I've never been able or needed to test this.


Is this what you're using? It says this "When the DNS_QUERY_STANDARD option is set, DNS uses the resolver cache, queries first with UDP, then retries with TCP if the response is truncated, and requests that the server to perform recursive resolution on behalf of the client to resolve the query."

If you've looked up the record before making the change, it'll be in your local DNS cache. If you're using this option, the function will check your cache and won't go to the server if it finds the record in there.

ipconfig /flushdns 

should clear your cache.

ipconfig /displaydns

will show you all cached records.

If this doesn't solve it, it gets more complicated as DNS servers can cache records as well, depending on their configuration.

If you've made the change and the (original) TTL period has expired (by which time it should be out of all of the caches) and you're still not seeing it in DNSQuery, I'd talk to your DNS Admins.

  • yes it is active directory enabled dns and iam querying the same DNS server on which I changed the record's TTL
    – Anonymous
    Commented Oct 20, 2009 at 6:58
  • After changing the TTL of a particular dns record do I need to restart DNS service??
    – Anonymous
    Commented Oct 20, 2009 at 7:28
  • Updated main post with DNS Cache thoughts. Commented Oct 20, 2009 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .