The TCP/IP Guide - Version 3.0 (Contents) ` 1056 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
DNS Messaging and Message, Resource Record and Master File Formats
Networking is all about the communication of information between connected devices. In
the case of the Domain Name System, information about names and objects on the inter-
network is exchanged during each of the many types of operations DNS performs. This
involves sending messages between devices. Like most protocols, DNS uses its own set of
messages with distinct field formats, and follows a particular set of rules for generating them
and transporting them over the internetwork.
In this section I explain how messages are generated and sent in DNS, and also describe
the formats used for messages and resource records. I begin with an overview discussion
of DNS messages and how they are generated and transported. I provide an overview of
the general DNS message format, and the five sections it contains. I describe the notation
used for names and the special compression method that helps keep DNS messages down
in size. I then show the fields in the DNS message header and question section. I illustrate
the common field format used for all resource records, and the specific fields in the most
important record types. I conclude with a description of the format used for DNS text master
files.
DNS Message Generation and Transport
In the preceding sections we have explored the many different tasks that DNS servers and
resolvers perform: regular name resolution, reverse name resolution, e-mail resolution,
zone transfers, and more. Each of these operations requires that information be exchanged
between a pair of DNS devices. Like so many other TCP/IP protocols, DNS is designed to
accomplish this information transfer using a client/server model. All DNS exchanges begin
with a client sending a request, and a server responding back with an answer.
DNS Client/Server Messaging Overview
In the overview topic on TCP/IP's client/server nature, I explained a potential source of
confusion regarding these terms: the fact that they refer to hardware roles, software roles
and transactional roles. This issue definitely applies when it comes to DNS. We've already
seen that DNS implementation consists of two sets of software elements: resolvers that act
as clients and name servers that are of course the servers. Resolver software usually runs
on client machines like PCs, while name server software often runs on dedicated server
hardware.
However, these designations are based on the overall role of the hardware and software.
From a messaging viewpoint, the “client” is the initiator of the communication, regardless of
what type of machine does this initiating, and the “server” is the device that responds to the
client. A resolver usually acts as a client and a name server as a server. However, in a
particular exchange a DNS name server can in fact act as a client, in at least two cases.
First, in recursive name resolution, a server generates requests to others servers and
therefore acts as a client. Second, in administrative functions like zone transfers, one server
acts like a client and sends a request to another server. (There are no cases in DNS that I
know of where a resolver acts as a server, incidentally.)