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
| Type | Description | Name | Value | Example |
|---|---|---|---|---|
| A | Hostname to IP address mapping | Hostname | IP address | (A, relay1.main.educative.io, 104.18.2.119) |
| NS | The hostname that is the authoritative DNS for a domain | Domain name | Hostname | (NS, educative.io, dns.educative.io) |
| CNAME | Mapping from an alias to a canonical hostname | Hostname | Canonical name | (CNAME, educative.io, server1.primary.educative.io) |
| MX | Mapping of a mail server from alias to canonical hostname | Hostname | Canonical 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 case | How CNAME enables it |
|---|---|
| CDN in front of your site | Your name points at the CDN's hostname; the CDN then resolves to whichever edge node is closest to the user |
| Managed / SaaS services | Point your subdomain at the vendor's hostname; they change their IPs freely without ever contacting you |
| Environment swaps | Repoint an alias from blue to green infrastructure without touching any A records |
| Multi-region failover | The 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:
| Type | Purpose |
|---|---|
| AAAA | Hostname to IPv6 address — the A record's IPv6 counterpart |
| TXT | Arbitrary text; used for domain ownership verification, SPF, DKIM |
| SRV | Locates a service by protocol and port, not just a host |
| PTR | Reverse lookup — IP address back to hostname |
| SOA | Start 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
| Level | What a strong answer sounds like |
|---|---|
| L4 | Knows A maps a name to an IP. |
| L5 | Uses 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.