Comprehensive explanations, examples, and best practices for all DNS record types
DNS (Domain Name System) records are instructions that live in authoritative DNS servers and provide information about a domain including what IP address is associated with that domain and how to handle requests for that domain. These records consist of a series of text files written in what's known as DNS syntax. DNS syntax is just a string of characters used to communicate with DNS servers and tell them how to respond to queries.
DNS records are essential for the functioning of the internet, helping to connect domain names (like example.com) to the servers that host them. Different types of DNS records serve different purposes, from mapping domain names to IP addresses to specifying mail servers, verifying domain ownership, and implementing security measures.
Maps a domain name to an IPv4 address
The A record (Address record) is one of the most fundamental DNS record types. It maps a domain name to a 32-bit IPv4 address. When users type a website address into their browser, an A record provides the server IP address where that website is hosted.
example.com. 3600 IN A 93.184.216.34
Field | Description |
---|---|
example.com. | The domain name (note the trailing dot indicating fully qualified domain name) |
3600 | TTL (Time To Live) in seconds - how long the record can be cached |
IN | Class of the record (IN for Internet) |
A | The record type |
93.184.216.34 | The IPv4 address this domain resolves to |
Maps a domain name to an IPv6 address
The AAAA record (pronounced "quad-A") serves the same purpose as the A record but for IPv6 addresses. It maps a domain name to a 128-bit IPv6 address, enabling websites and services to be accessible over IPv6 networks.
example.com. 3600 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
Field | Description |
---|---|
example.com. | The domain name |
3600 | TTL (Time To Live) in seconds |
IN | Class of the record (IN for Internet) |
AAAA | The record type |
2606:2800:220:1:248:1893:25c8:1946 | The IPv6 address this domain resolves to |
Creates an alias from one domain to another
The CNAME (Canonical Name) record creates an alias pointing from one domain name to another. When a DNS lookup encounters a CNAME record, it replaces the original name with the canonical name and performs a new lookup. This is particularly useful for creating subdomains that point to the same location as the primary domain.
www.example.com. 3600 IN CNAME example.com.
Field | Description |
---|---|
www.example.com. | The alias domain name |
3600 | TTL (Time To Live) in seconds |
IN | Class of the record (IN for Internet) |
CNAME | The record type |
example.com. | The canonical (target) domain name |
Specifies mail servers for receiving email
The MX (Mail Exchange) record specifies the mail servers responsible for accepting email on behalf of a domain. It includes a priority value that indicates the order in which mail servers should be tried if multiple servers are specified.
example.com. 3600 IN MX 10 mail.example.com. example.com. 3600 IN MX 20 mail2.example.com.
Field | Description |
---|---|
example.com. | The domain for which mail service is defined |
3600 | TTL (Time To Live) in seconds |
IN | Class of the record (IN for Internet) |
MX | The record type |
10, 20 | Priority values (lower numbers have higher priority) |
mail.example.com, mail2.example.com | Hostnames of the mail servers |