Bitzu

CPSA ยท Open source information gathering

DNS queries and responses

Recursive vs iterative resolution, query tools, response codes and caching.

Key points

  • A client (stub resolver) sends a recursive query: it asks the resolver to deliver the final answer.
  • The resolver then queries iteratively, following referrals from the root to the TLD to the authoritative server.
  • Responses carry an RCODE (0 NOERROR, 2 SERVFAIL, 3 NXDOMAIN, 5 REFUSED) and a TTL that lets resolvers cache the answer.
  • Tools such as dig and nslookup let a tester ask specific servers specific questions.

Source: https://www.rfc-editor.org/rfc/rfc1035

Practice questions

Single choice

What does the response code NXDOMAIN (RCODE 3) tell you?

  1. The server refused to answer for policy reasons
  2. The queried name does not exist
  3. The server hit an internal failure
  4. The query was malformed
Show answer

Answer: B. The queried name does not exist

RCODE 3 (name error) from an authoritative server means the queried name does not exist. SERVFAIL (2) is a server-side problem and REFUSED (5) is a policy denial; neither says anything about the name itself.

Select all that apply

Which statements about DNS response codes are correct?

  1. RCODE 3 means the name does not exist
  2. RCODE 5 means the server declined for policy reasons
  3. RCODE 2 means the server could not process the query due to its own problem
  4. RCODE 0 means the name does not exist
  5. RCODE 1 means the server refused the query
Show answer

Answer: A. RCODE 3 means the name does not exist, B. RCODE 5 means the server declined for policy reasons, C. RCODE 2 means the server could not process the query due to its own problem

Per RFC 1035, RCODE 2 is a server failure, 3 is a name error (name does not exist) and 5 is refused. RCODE 0 means no error, and 1 is a format error, not a refusal.

True or false

True or false: dig +trace asks your configured recursive resolver to do the whole resolution and just shows you its answer.

Show answer

Answer: False

With +trace dig itself follows the referrals starting at the root servers (and turns recursion off), so you see every delegation step. The statement describes a normal lookup, not a trace.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More CPSA topics in this module