DNS: Records and Messages
Let's now get into what DNS records and messages look like.
We'll cover the following
Resource Records#
The DNS distributed database consists of entities called RRs, or Resource Records.
Format#
RRs contain some or all of the following values:
- Name of the domain.
- Resource data (RDATA) provides information appropriate for the type of resource record.
- Type of the resource record. We will discuss these shortly.
- Time-to-live (TTL) is how long the record should be cached by the client in seconds.
- DNS Class. There a many types of classes but we’re mainly concerned with
INwhich implies the ‘Internet’ class. That’s what all of our upcoming examples use so we won’t be discussing it again. Another common value for the DNS Class isCHfor ‘CHAOS’. The CH class is mostly used for things like querying DNS server versions.
Types of resource records#
- Address type or
Aaddresses contain IPv4 address to hostname mappings. They consist of:- The
nameis the hostname in question. - The
TTLin seconds. - The
typewhich isAin this case. - The
RDATAwhich in this case is the IP address of the domain. - Example:
educative.io. 299 IN A 104.20.7.183whereeducative.iois the name, 299 is the TTL in seconds,INis the class,Ais the type of the RR, and104.20.7.183is theRDATA.
- The
- Canonical name or
CNAMErecords are records of alias hostnames against actual hostnames. For example if,ibm.comis reallyservereast.backup2.com, then the latter is the canonical name ofibm.com.- The
nameis the alias name for the real or ‘canonical’ name of the server. - The
RDATAis the canonical name of the server. - Example:
bar.example.com. CNAME foo.example.com.
- The
- Mail Exchanger or
MXrecords are records of the server that accepts email on behalf of a certain domain. We have seen this one before!- The
nameis the name of the host. - The
RDATAis the name of the mail server associated with the host. - Example:
educative.io IN MX 10 aspmx2.googlemail.com.
- The
These resource records are stored in text form in special files called zone files.
DNS Messages#
There are a few kinds of DNS messages, out of which the most common are query and reply, and both have the same format. Study the following slides for a detailed overview of a DNS message.
There are also zone transfer request and response. But, those are not used by common clients. Backup or secondary DNS servers use them for zone transfers, which are when zone files are copied from one server to another. This takes place over TCP.
Which of the following are valid DNS record entry types?
A)
A
B)
M
C)
CNAME
D)
A and C
E)
A and B
