The header is exactly 12 bytes long and is exactly the same for a DNS query or DNS response. The Header Format is illustrated graphically in the following diagram:
As the preceding diagram illustrates, the DNS message header contains 13 fields—ID, QR, OPCODE, AA, TC, RD, RA, Z, RCODE, QDCOUNT, ANCOUNT, NSCOUNT, and ARCOUNT:
- ID is any 16-bit value that is used to identify the DNS message. The client is allowed to put any 16 bits into the DNS query, and the DNS server copies those same 16 bits into the DNS response ID. This is useful to allow the client to match up which response is in reply to which query, in cases ...