0
10kviews
Explain the resource record format of DNS.
2 Answers
1
329views

Each domain name (each node on the tree) is associated with a record called the resource record. The server database consists of resource records. The figure shows the format of a resource record.

Resource record format of DNS

Domain name:

This is a variable-length field containing the domain name. It is a duplication of the domain name in the question record. Since DNS requires the use of compression everywhere a name is repeated, this field is a pointer offset to the corresponding domain name field in the question record.

Domain type:

This field is the same as the query type field in the question record except the last two types are not allowed.

Domain class:

This field is the same as the query class field in the question record.

Time-to-live:

This is a 32-bit field that defines the number of seconds the answer is valid. The receiver can cache the answer for this period of time. A zero value means that the resource record is used only in a single transaction and is not cached.

Resource data length:

This is a 16-bit field defining the length of the resource data.

Resource data:

This is a variable-length field containing the answer to the query (in the answer section) or the domain name of the authoritative server (in the authoritative section) or additional information (in the additional information section). The format and contents of this field depend on the value of the type field. It can be one of the following:

  • a. A number: This is written in octets. For example, an IPv4 address is a 4-octet integer and an IPv6 address is a 16-octet integer.
  • b. A domain name: Domain names are expressed as a sequence of labels. Each label is preceded by a 1-byte length field that defines the number of characters in the label. Since every domain name ends with the null label, the last byte of every domain name is the length field with the value of 0.
  • c. An offset pointer: Domain names can be replaced with an offset pointer. An offset pointer is a 2-byte field with each of the 2 high-order bits set to 1 (11).
  • d. A character string: A character string is represented by a 1-byte length field followed by the number of characters defined in the length field. The length field is not restricted like the domain name length field. The character string can be as long as 255 characters (including the length field).
Please log in to add an answer.