DNS: read the answer, not just the address
Interpret DNS status, record types, resolver choice and cache evidence.
By the end of this lesson
- Distinguish A, AAAA and MX questions
- Separate NXDOMAIN, SERVFAIL and an empty successful answer
- Record the resolver and response status when diagnosing DNS
Your environment: dig is supplied by distribution-specific DNS utility packages. Use the offline fixture if it is unavailable. Setup help
Ask a precise DNS question
DNS is a distributed database, not simply a hostname-to-IP list. An A query asks for IPv4 addresses, AAAA for IPv6, and MX for mail exchangers. A successful query for one record type does not prove every other record exists. Record the name, type and resolver used so the test can be repeated.
dig normally uses the configured resolver unless you select one with @server. Read the response status, flags, answer and server fields before shortening output with +short. Short output is convenient once you understand the result, but an empty display alone cannot distinguish several different situations.
Keep failure meanings separate
NXDOMAIN indicates that the queried name does not exist according to the returned DNS response. NOERROR with no answer for the requested type can mean that the name exists but has no record of that type. SERVFAIL is a resolution failure, which can have multiple causes including upstream or validation problems. A timeout means no usable response arrived within the query’s limits.
Caches mean that two resolvers can temporarily return different data. The TTL gives a remaining lifetime for a returned cached record, not a promise that every user will see a change at the same instant. Compare the same name and type, note the responding server and time, and avoid changing records before identifying which layer is wrong.
See it in context
Worked example
Run only if your lab has normal DNS access.
dig example.com A
dig example.com AAAA
dig example.com MXThe response can change over time. Do not expect a fixed address from this lesson; identify the status, type and responding server.
Your turn
Practical lab
Classify three fictional DNS results and propose a useful next check for each.
Run commands in your own lab. This website displays instructions; the practice terminal below helps you rehearse the syntax.
1. Prepare your workspace
mkdir -p "$HOME/training4linux/dns"
cd "$HOME/training4linux/dns"
printf "%s\n" "A: status=NXDOMAIN; query=missing.example A" "B: status=NOERROR; answers=0; query=host.example AAAA" "C: status=SERVFAIL; query=mail.example MX" > responses.txt2. Complete the task
- Explain why result A and result B do not mean the same thing.
- For C, write a next step that preserves the resolver and query details.
- Explain why +short alone would lose evidence needed for this exercise.
3. Check your result
- A is a name-not-found response; B can be an existing name without AAAA.
- C is treated as a resolution failure requiring more evidence.
- Your next steps name the resolver, record type and timestamp.
Need a hint?
Focus on the response code before the answer count.
Reveal a worked solution
Compare this with your approach after trying the task. More than one valid solution may exist.
cat responses.txt
printf "%s\n" "A: check name spelling and the intended zone." "B: verify whether IPv6 publication is intended; compare A and AAAA." "C: repeat the full query and inspect resolver/upstream evidence." > diagnosis.txtAfter the lab: All .example names in the fixture are fictional. No DNS records were changed.
Common mistakes to avoid
- Do not interpret every empty +short result as NXDOMAIN.
Check your understanding
Knowledge check
Answer all 3 questions correctly to pass. Retry as often as you need; your best score is kept.
Your lesson progress
Not started · Best score: 0% · Attempts: 0
Practical completion is self-reported. Progress is linked to a private cookie in this browser and stored on the site. Clearing that cookie loses access to it. Manage or erase progress.