Pages

DNS Messages Format

DNS has two types of messages: query and response. Both types have the same format. The query message consists of a header and the question records; the response message consisits of a header, question records, answer records, authoritative records, and additional records.

Header
 Both query and response messages have the same header format with some fields set to zero for the query messages. the header is 12 byte and its format is as follows:

Identificationflags
Number of question recordsNumber of answer records(All os in query message
Number of authoritative records(All os in query message)Number of additional records(All os in query message)
The header fields are as follows:
  • Identification.  16 bit field used by the client to match the response with the query. The client uses ientification number each time it sends a query. the server duplicates this number in response.
  • Flags. 16 bit field consisting of other subfields as shown below.
  1. QR (query/response). If set (1) means message is a response , if 0 it means message type is query.
  2. OpCode. 4-bit defines type of query or response (0-standard, 1-inverse, 2-server status required).
  3. AA (authoritative answer). (1-bit and used inly in response message. Set (1)-means Authoritative server).
  4. TC (truncated) . if set means value of 1, means messgae was more than 512 bytes and is truncated.
  5. RD (recursion desired). A 1-bit field, when set means client desires reursive answer. It is repeated in both request and response.
  6. RA (recursion available). 1-bit, and it is set only in response message to indiacate that recursion is available.
  7. Reserved. A 3-bit subfield set to 000.
  8. rCode. A 4-bit field which shows the status of error in the response. Of course, only an authoritative server can make such judgement.
Values of rCode:
  1. 0 - No error
  2. 1 - Format error.
  3. 2 - Problem at name server.
  4. 3 - Domain reference problem.
  5. 4 - Quert type not supported.
  6. 5 - Administratively prohibited.
  7. 6-15 - Reserved
  • Number of Question Records. This is a16-bit field consisting of number of queries in question section of message.
  • Number of Answer Records. This is a 16-bit field containing the number of answer records in the answer section of response message. Its value is 0in the query message.
  • Number of authoritative records. A sixteen bit field which tells the number of authoritative records in the authoritative section of the response message. Its value is zero in the query message.
  • Number of additional records. This is a 16 bit fieldcontaining the number of additional recordsin the additional section of the response message.
Question Section
 This is a section consisting of one or more question records. It is present on both query and response messsages

Answer Section
This is section consisting of one or more resource records. It is present only in response messages. This section includes answer from the server to the client (resolver).

Authoritative Section
 This section is also contained only in response messages of DNS, and gives information about domain names regarding authoritative servers for the query.

Additional Information Section
 This section provides additional information to help the resolver and present only in response part of DNS message format.

This was discussion about the format of DNS message. We discussed about various sections of Domain Name System message format like header, question section, answer section, authoritative section, and Additional infor mation section of Domain Name System (DNS) messages.

4 comments: