DNS message format
This page shows the DNS message format. A DNS Message Format contains 5 sections (RFC 1035)
- Header - Includes:
- Bits 0-15 are the query identifier
- Bit 16 - QR bit, The message is a query if the value is 0. The message is a response if the value is 1/
- Bits 17-20 - Opcode values - Identifies the query type. The message is a standard query if 0, The message is an inverse query if 1, The message is a server status request if 2.
- Bit 21 - AA - Authoritative answer - If set, it indicates the responding name server is an aurhority for the domain name in question.
- Bit 22 - TC - Indicates the message was truncated.
- Bit 23 - RD - Recursion Desired - Set in a query and indicates the query should be persued recursively.
- Bit 24 - RA - Recursion Available - A bit that is set or cleared in a response indicating that recursion is available.
- Bit 25-27 - Z - Future use, required to always be 0
- Bit 28-31 - RCODE - Response code - No error if 0, Format error if 1, Server failure if 2
- Word 3 - QDCOUNT - Indicates the number of DNS querise (entries in the question section)
- Word 4 - ANCOUNT - Indicates the number of answers (Resource records in the answer section)
- Word 5 - NSCOUNT - The number of name server records in the authority records section.
- Word 6 - ARCOUNT - The number of resource records in the additional records section.
- Question - Includes:
- QNAME - Domain name strings with a length byte followed by a string of the designated length.
- QTYPE - Two bytes indicating the query type
- QCLASS - Two bytes indicating the class field such as IN for internet.
- Answer - Resource Records (RRs) answering the question
- NAME - domain name
- TYPE - Two bytes with resource record type.
- CLASS - Two bytes indicating the class of the data
- TTL - A 32 bit unsigned integer indicating the time interval in seconds that the may be stored on the DNS server.
- RDLENGTH - 16 bits indicating the length of the RDATA field in bytes.
- RDATA - This may be the IP address for a domain name but the information varies depending on the type and class of the resource record.
- Authority - Resource Records (RRs) pointing to an authority - The format is the same as the Answer section.
- Additional - Resource Records (RRs) holding additional information - The format is the same as the Answer section.
TYPE fields are used in resource records. Note that these types are a subset of QTYPEs. TYPE value and meaning
- A 1 a host address
- NS 2 an authoritative name server
- MD 3 a mail destination (Obsolete - use MX)
- MF 4 a mail forwarder (Obsolete - use MX)
- CNAME 5 the canonical name for an alias
- SOA 6 marks the start of a zone of authority
- MB 7 a mailbox domain name (EXPERIMENTAL)
- MG 8 a mail group member (EXPERIMENTAL)
- MR 9 a mail rename domain name (EXPERIMENTAL)
- NULL 10 a null RR (EXPERIMENTAL)
- WKS 11 a well known service description
- PTR 12 a domain name pointer
- HINFO 13 host information
- MINFO 14 mailbox or mail list information
- MX 15 mail exchange
- TXT 16 text strings
|
|