What is inside a DNS reply?
01Open a reply like a packet with labeled compartments. Change its number or entry count and see why the receiver stops.
The bytes are a reply about www.example.org. What is inside?
A reply arrives for our waiting question
www.example.org. → address?00 11 81 80 00 01 00 01 00 00 00 00Let’s open the reply before trusting what it says.
What happens if you change this?
Make one change, then watch again. Restart restores the original example.
Use each count to locate the following record sections.
Key idea: A DNS reply carries an identifying number, section counts and typed facts; a count is not a byte length.
Terms
- wire format
- The exact byte arrangement the sender writes and the receiver reads.
- DNS header
- The first twelve bytes: a number, switches and four entry counts.
- Question section
- The name and kind of information being requested.
- Authority section
- Records naming a responsible keeper, not necessarily the answer.
- transaction ID
- A number copied into a reply to help match it to a waiting request.
Rules & examples
A header gives a reading guide; the receiver still checks the contents.
These reference examples may differ from the selected experiment.
- Question, Answer, Authority, and Additional are distinct sections.
- The ID helps correlate a response with its query; it is not cryptographic authentication.
The drawing is a simplified worked example. Follow the linked RFC and its updates for implementation requirements.
This fixed OPCODE=0, QR=1 reply has ID17 (or the deliberate wrong18), RD=1, RA=1, AA=0, TC=0, RCODE=0. QDCOUNT=1. A reply contains one A/IN answer or one NS/IN authority record; Additional is empty. The broken count says ANCOUNT=2 but supplies one. A real receiver also checks peer addresses, ports and question; an ID match alone neither authenticates data nor proves a reply safe. RFC9619 forbids QDCOUNT greater than1 for OPCODE=0. No general DNS parser or network exchange is simulated.
Sources
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.