Running the command dig against a particular domain, returns the previous name server details. For example;

domain.com.     41068   IN  NS  ns1.nameserver1.com.

Now if i run the command dig +nssearch host.example.com, followed by the command `dig domain.com', i get a different result.

domain.com.     41068   IN  NS  chad.ns.cloudflare.com.
  • Why is that?
  • If i run the dig command i.e.dig domain.com several times, it returns the previous name server details. Why is that?


The name server details had been changed however running the commands in the same window of time produces to different results.

  • 1
    What changes did you make to the domain recently? Jan 31, 2015 at 19:39
  • Can you include the actual domain name? Jan 31, 2015 at 19:42
  • 1
    @Michael Hampton - The name server had been changed. I would expect it to change however not with every attempt.
    – Motivated
    Jan 31, 2015 at 20:04
  • @Motivated Do you have more than one name server? Are you consistently querying the same exact name server every time?
    – Mike B
    Jan 31, 2015 at 20:40
  • @Mike B - No. Yes i am.
    – Motivated
    Jan 31, 2015 at 21:26

1 Answer 1



The name server your system is using as a resolver (/etc/resolv.conf) is supposed to cache DNS responses.

By using the +nssearch switch you bypass the cached records from your resolver (which in Name server jargon is also called a recursive name server ) and directly query the authoritive DNS server(s) and you get records that do not come from cache.
As phrased in the manual:

+[no]recurse Toggle the setting of the RD (recursion desired) bit in the query. This bit is set by default, which means dig normally sends recursive queries. Recursion is automatically disabled when the +nssearch or +trace query options are used.
+[no]nssearch When this option is set, dig attempts to find the authoritative name servers for the zone containing the name being looked up and display the SOA record that each name server has for the zone.

An additional complication may be that your resolver is not a single server, but a cluster of recursive DNS servers, each with different cached and/or fresh records.

  • I have attempted purging the DNS cache however it still results in the same output. I purged the cache running the command sudo /etc/init.d/dns-clear restartfollowed by sudo /etc/init.d/networking force-reload
    – Motivated
    Jan 31, 2015 at 21:25
  • 1
    Are responses you are getting simply old (and therefore cached) or completely wrong then. - If you manage your own DNS , could you have omitted updating the zone sequence number?
    – HBruijn
    Jan 31, 2015 at 21:37
  • The zone sequence has been updated. How do i ensure that the DNS cache has been purged? Having used a site such as http://centralops.net/ indicates that the DNS has definitely changed.
    – Motivated
    Feb 1, 2015 at 0:38

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.