DNS: Records and Messages

Let's now get into what DNS records and messages look like.

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 IN which 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 is CH for ‘CHAOS’. The CH class is mostly used for things like querying DNS server versions.

Types of resource records

  • Address type or A addresses contain IPv4 address to hostname mappings. They consist of:
    • The name is the hostname in question.
    • The TTL in seconds.
    • The type which is A in this case.
    • The RDATA which in this case is the IP address of the domain.
    • Example: educative.io. 299 IN A 104.20.7.183 where educative.io is the name, 299 is the TTL in seconds, IN is the class, A is the type of the RR, and 104.20.7.183 is the RDATA.
  • Canonical name or CNAME records are records of alias hostnames against actual hostnames. For example if, ibm.com is really servereast.backup2.com, then the latter is the canonical name of ibm.com.
    • The name is the alias name for the real or ‘canonical’ name of the server.
    • The RDATA is the canonical name of the server.
    • Example: bar.example.com. CNAME foo.example.com.
  • Mail Exchanger or MX records are records of the server that accepts email on behalf of a certain domain. We have seen this one before!
    • The name is the name of the host.
    • The RDATA is the name of the mail server associated with the host.
    • Example: educative.io IN MX 10 aspmx2.googlemail.com.

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.

Press + to interact
Here is a generic DNS message
Here is a generic DNS message
1 of 10

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.

Feel free to ask any questions related to the lesson in the following widget. Our AI will answer them and help you better understand the topic

Powered by AI
3 Prompts Remaining
Prompt AI WidgetOur tool is designed to help you to understand concepts and ask any follow up questions. Ask a question to get started.
1

Which of the following are valid DNS record entry types?

A)

A

B)

M

C)

CNAME

D)

A and C

E)

A and B

Question 1 of 30 attempted

Get hands-on with 1400+ tech skills courses.