What is DNS
The Domain Name System (DNS) is the phone book of the internet. People use names such as example.com. Computers use IP addresses such as 203.0.113.10. DNS translates one to the other.
How the DNS process works
When you type a domain in your browser:
- The browser checks its own cache, then your operating system cache.
- If it does not know the answer, it asks a recursive resolver (usually run by your internet provider or a public service).
- The resolver asks a root server, which tells it which servers handle the top-level domain (
.com). - The resolver asks the TLD server, which tells it the authoritative name server of the domain.
- The resolver asks the authoritative server, which gives the IP address.
- The resolver returns the answer to your browser and keeps it in its cache for a while (the TTL).
- The browser connects to the IP address.

DNS servers
Authoritative DNS server
It holds the real records of a domain and gives the final answer.
Recursive name server
It does the searching for the user. It asks other servers and caches the answers.
DNS zones
A zone is a part of the DNS name space managed by one party, for example example.com and its records.
DNS zone file
A zone file is a text file (or database) with all the records of a zone.

DNS record types
A (Address) record
Points a name to an IPv4 address. (AAAA records do the same for IPv6.)
example.com. 3600 IN A 203.0.113.10

CNAME (Canonical Name) record
Makes a name an alias of another name.
www.example.com. 3600 IN CNAME example.com.

MX (Mail Exchanger) record
Says which servers receive email for the domain, with a priority. The lower number is tried first.
example.com. 3600 IN MX 10 mail.example.com.

TXT (Text) record
Holds text. It is used for SPF, DKIM, DMARC and for proof of domain ownership.
example.com. 3600 IN TXT "v=spf1 include:_spf.example.com ~all"

NS (Name Server) record
Lists the name servers that are authoritative for the domain.
example.com. 86400 IN NS ns1.example.com.

SOA (Start of Authority) record
The first record of a zone. It holds:
- The name of the primary DNS server.
- The email address of the person responsible for the zone.
- The serial number, used by secondary servers to see if the zone changed.
- The refresh interval.
- The retry interval.
- The expire interval.
- The minimum (default) TTL.

SRV (Service) record
Tells where a service runs. It has a host name, port, priority, weight and target.
_sip._tcp.example.com. 3600 IN SRV 10 60 5060 sip.example.com.
Here _sip is the service and _tcp is the protocol.

Check DNS yourself
dig example.com A
dig example.com MX
nslookup example.com
Quick recap
- A browser asks a resolver, which asks the root, the TLD and the authoritative server.
- A, CNAME, MX, TXT, NS, SOA and SRV records each have a job.