DNS records

Each domain's instructions · Part of Networking and infrastructure

Key idea

Practice

6 questions · about 3 min

Explained step by step

A record

A DNS record is a line of instructions living on the authoritative server, like a card in a filing cabinet. The most used one is the A record, which says 'example.com is at 93.184.216.34'. For IPv6 addresses there's AAAA, which holds a long address like 2606:2800:220:1::248. When the resolver asks about a domain, what it's after in the end is almost always one of these two.

MX record

Besides A there are many record types, each with a job. MX says which server receives a domain's email, like the address of a building's mailbox. TXT holds text notes, widely used for email security. NS says which name server handles the domain, and PTR is used for reverse DNS. They all have a TTL, the seconds they can be kept in cache.

CNAME

A CNAME is an alias: instead of an IP, it says 'this name equals this other name'. It's like call forwarding: you call the old number and get passed to the new one. For example, www.example.com can be a CNAME of example.com: that way, if the IP changes, it's updated in just 1 place. The cost is an extra lookup, because after reading the CNAME you have to find the other name's IP.

Subdomain

A subdomain is an extra part in front of the domain that splits a site into sections, like the floors of a building with a single address. In blog.example.com, blog is the subdomain, example the domain and .com the TLD. You can create many: support.example.com, careers.example.com, api.example.com. Each can point to a different server, for example the blog to 1 machine and the store to 10 others.

TTL

Every DNS record comes with a TTL (time to live): the seconds it can be kept in cache before asking again. It's like a yogurt's expiry date: until it expires you use it without thinking; when it expires, you throw it out and buy another. If a record has a TTL of 3,600, the saved copy is used for 1 hour. A long TTL saves queries; a short one makes an IP change show up sooner.

Reverse DNS

A normal lookup goes from name to IP: example.com → 93.184.216.34. Reverse DNS goes the other way: from the IP it gets the name, using PTR records. It's like seeing an unknown number on your phone and looking up whose it is. It's used mostly by email servers: before accepting a message, they check that the sending IP has a valid name, and if not, they reject it as possible spam.

DNS zone

A DNS zone is a part of the name system delegated to someone (a person or a company), who takes care of maintaining it. It's like a city neighborhood with its own residents' committee: it decides about its streets without asking the mayor. For example, the company that owns example.com manages example.com's zone and all its records: A, MX, CNAME. That way each company controls its own part in detail, without touching anyone else's.

Terms in this lesson

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.

Key idea

Each domain's instructions