Free preview

Resource Records: The DNS Database

Why this matters: "DNS maps names to IPs" is only the most common case. The record types are how DNS delegates authority, points at mail servers, and lets you swap infrastructure without telling anyone — and one of them is the reason you can put a CDN in front of your site at all.

Key takeaway

The DNS database stores mappings as resource records (RR). An RR is the smallest unit of information requested from name servers, and it contains three key fields: type, name, and value. The type determines how to interpret the other two.

Name servers hold the records

DNS is a distributed infrastructure, not a single server. The servers that respond to queries are called name servers, and collectively they hold the records that make up the DNS database. No single machine has all of it; each name server is authoritative for its own slice.

The record structure

Every record answers: for this name, of this type, here is the value.

(type, name, value)

The type is what tells a resolver what kind of question is being answered — and therefore what to do with the value.

The four record types to know

TypeDescriptionNameValueExample
AHostname to IP address mappingHostnameIP address(A, relay1.main.educative.io, 104.18.2.119)
NSThe hostname that is the authoritative DNS for a domainDomain nameHostname(NS, educative.io, dns.educative.io)
CNAMEMapping from an alias to a canonical hostnameHostnameCanonical name(CNAME, educative.io, server1.primary.educative.io)
MXMapping of a mail server from alias to canonical hostnameHostnameCanonical name(MX, mail.educative.io, mailserver1.backup.educative.io)

Read them as four different jobs:

  • A is the actual answer — the address you connect to.
  • NS is delegation. It says "I am not authoritative for this; ask that server instead." This record is what builds the hierarchy in the next lesson.
  • CNAME is indirection. It says "this name is really that other name; go resolve that one."
  • MX is a service pointer, specifically for mail, so email routing can be configured independently of the website.

Only A terminates the lookup. The other three send you somewhere else — which is exactly why a single resolution can require several queries.

Why CNAME matters more than it looks

CNAME is the record with the most architectural consequence, because indirection is what lets someone else's infrastructure answer for your name.

Use caseHow CNAME enables it
CDN in front of your siteYour name points at the CDN's hostname; the CDN then resolves to whichever edge node is closest to the user
Managed / SaaS servicesPoint your subdomain at the vendor's hostname; they change their IPs freely without ever contacting you
Environment swapsRepoint an alias from blue to green infrastructure without touching any A records
Multi-region failoverThe target hostname resolves differently depending on health or geography

The general principle: an A record couples you to an address; a CNAME couples you to a name someone else controls. That indirection is what makes modern infrastructure swappable.

Beyond the core four

Worth recognizing, even though the four above cover most designs:

TypePurpose
AAAAHostname to IPv6 address — the A record's IPv6 counterpart
TXTArbitrary text; used for domain ownership verification, SPF, DKIM
SRVLocates a service by protocol and port, not just a host
PTRReverse lookup — IP address back to hostname
SOAStart of authority — zone metadata including default TTLs

Key takeaway

Records are how DNS expresses both answers (A) and structure (NS delegation, CNAME indirection). The structural records are what turn a flat lookup table into a distributed, delegated, swappable system.

Interview signal by level

LevelWhat a strong answer sounds like
L4Knows A maps a name to an IP.
L5Uses the right record: "the subdomain CNAMEs to the CDN so they can change edge IPs without us redeploying anything."
Staff+Reasons about indirection and its limits: "CNAME decouples us from their addressing, but it can't sit at the apex — that needs an ALIAS record. And every hop of indirection is another resolution, so I'd watch the added latency on a cold lookup."

Next: how these records are spread across a global hierarchy.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue