0

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?

EDIT

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

Motivated
  • 155
  • 3
  • 8

1 Answers1

3

caching

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.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • 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 restart`followed by `sudo /etc/init.d/networking force-reload` – Motivated Jan 31 '15 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 '15 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 01 '15 at 00:38