Free — no signup required

The Basic Records: A, AAAA, and CNAME

2 min read

Mapping names to numbers — and to other names

DNS is not a single flat list. It is composed of different record types, each serving a specific purpose. Think of them as different columns in a spreadsheet, each column holding a different kind of information about a domain.

A Record (Address Record)
The most fundamental record type. It maps a domain name directly to an IPv4 address — a 32-bit number written in four dot-separated octets (e.g., 93.184.216.34). When your browser resolves a website, it almost always ends up at an A record.

example.com.    3600    IN    A    93.184.216.34

AAAA Record (Quad-A Record)
The IPv6 equivalent of the A record. It maps a domain name to a 128-bit IPv6 address, written as eight groups of four hexadecimal digits. It is called "Quad-A" because IPv6 addresses are four times the length of IPv4 addresses.

example.com.    3600    IN    AAAA    2606:2800:220:1:248:1893:25c8:1946

Most modern domains publish both A and AAAA records. A client that supports IPv6 will prefer the AAAA record; a client that only supports IPv4 will use the A record.

CNAME Record (Canonical Name Record)
A CNAME is an alias. Instead of pointing to an IP address, it points to another domain name — the "canonical" (true) name. The resolver follows the chain until it reaches an A or AAAA record.

www.example.com.    3600    IN    CNAME    example.com.
example.com.        3600    IN    A        93.184.216.34

CNAMEs are useful when you want multiple names to resolve to the same destination without duplicating IP address records. If the IP changes, you update only the A record; all CNAMEs pointing to it automatically follow.

Critical CNAME restriction: A name that has a CNAME record cannot have any other record types at the same level. You cannot have a CNAME and an MX record for example.com simultaneously. This is why CNAMEs are almost never used at the zone apex (the bare domain, example.com) — because the apex must have an SOA and NS record. Many DNS providers work around this with a proprietary "ALIAS" or "ANAME" record type that behaves like a CNAME but is resolved server-side.

Interview Tip

A common interview question: "Why can't you use a CNAME at the root of your domain?" The answer is the RFC restriction that a CNAME cannot coexist with other record types, and the apex must have NS and SOA records. The follow-up is: "How do you point a bare domain to a load balancer hostname?" — the answer is provider-specific ALIAS/ANAME records (Route 53, Cloudflare, etc.) that flatten the CNAME at query time.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free