nslookup vs dig for DNS troubleshooting on Network+
Both tools send a DNS query of a chosen type to a name server and print the answer. nslookup has an interactive mode for several lookups in a row; dig is a command-line tool whose options, such as +trace and +norecurse, control how it queries. If a Windows host still uses an old answer, ipconfig /flushdns clears its local resolver cache.
nslookup
The BIND manual says nslookup has two modes. Interactive mode starts when no arguments are given, or when the first argument is a hyphen and the second is a name server. Non-interactive mode is used when the name or address to look up is the first argument.
In interactive mode, set type (or set querytype) chooses the record type, such as MX. The recursion setting tells the server to query other servers if it does not have the information; the default is recurse. set norecurse makes the server answer only from data it holds.
Microsoft's nslookup reference explains its messages. No records: the server has no records of the queried type, although the name is valid. Nonexistent domain: the name does not exist. Timed out: no response after the set time and retries. No response from server: no DNS server is running on that computer.
Example: you query MX for a host that has only an A record. The name is valid but has no MX record, so nslookup says No records, not Nonexistent domain.
dig
The BIND manual describes dig as a flexible tool for interrogating DNS servers. The usual form is dig @server name type. Without @server it uses the servers in /etc/resolv.conf. Without a type it looks up an A record, and -x performs a reverse lookup.
+trace follows the delegation path from the root servers, making iterative queries and showing the answer from each server used. +short prints a terse answer. +norecurse clears the recursion desired bit, which dig sets by default; recursion is turned off automatically with +trace.
The local cache
Microsoft's ipconfig reference says /flushdns flushes and resets the DNS client resolver cache, including negative entries. /displaydns shows the cache.
Example: a server's name moves to a new IP address, but one workstation keeps connecting to the old one. Its cached answer is stale. ipconfig /flushdns makes it ask DNS again.
Where the exam catches people
Believing No records means the name does not exist: the name is valid but has no record of that type; Nonexistent domain means the name does not exist.
Believing nslookup's default is norecurse: the default is recurse, so the server queries others unless you set norecurse.
Believing dig +trace asks your resolver to do the work: it follows referrals itself from the root servers with iterative queries.
Believing ipconfig /renew clears stale DNS answers: /renew is for DHCP leases; /flushdns clears the resolver cache.