DNS Record
- In Turkish
- DNS Kaydı
In short
A DNS record is an entry in a domain's DNS zone that maps a name to information, such as an IP address (A, AAAA), another name (CNAME) or mail servers (MX).
What is a DNS record?
When a browser looks up www.example.com, DNS servers answer from the domain's records. Each record has a name, a type, a value and a TTL that says how long resolvers may cache it. Together, a domain's records form its zone, managed through the DNS provider or registrar.
The common types each do one job. A maps a name to an IPv4 address and AAAA to an IPv6 address. CNAME makes a name an alias for another name, as hosting platforms often ask for www. MX lists the servers that receive email. TXT holds text used for ownership checks and email security (SPF, DKIM, DMARC). NS names the authoritative servers for the zone, and CAA limits which certificate authorities may issue certificates for it.
Changes are not instant everywhere. Resolvers keep the old answer until its TTL expires, which is why a change can take minutes or hours to be seen worldwide. Lowering the TTL a day before a planned migration makes the switch faster, and tools such as dig show exactly what a resolver returns.
A common misconception is that a CNAME can be used at the root of a domain alongside other records. The standard forbids a CNAME on a name that has other records, and the bare domain always has NS and SOA records, so providers offer workarounds called ALIAS, ANAME or CNAME flattening for pointing example.com itself at a hostname.
Key takeaways
- A DNS record maps a name to data, with a type, value and TTL.
- A and AAAA point to IPv4 and IPv6 addresses; CNAME points to another name.
- MX handles email; TXT holds verification and email security data.
- Changes spread as cached answers expire, according to the TTL.
- A bare domain can't use a plain CNAME; providers offer ALIAS records.
Example
dig +short example.com A # IPv4 address
dig +short example.com AAAA # IPv6 address
dig +short www.example.com CNAME
dig +short example.com MX # mail servers, with priorities
dig +short example.com TXT # SPF, verification codes…
# Full answer, including the remaining TTL in seconds
dig example.com A +noall +answer
# example.com. 3600 IN A 93.184.215.14Readers ask
What is the difference between an A record and a CNAME?
An A record points a name directly to an IPv4 address. A CNAME points a name to another name, which is then resolved to an address. CNAMEs are useful when the target's address may change, such as a hosting provider's hostname.
How long do DNS changes take?
Up to the record's previous TTL, since resolvers may keep the old answer until it expires. With a TTL of 300 seconds, most users see a change within five minutes; with a day-long TTL it can take a day.
What is a TXT record used for?
Storing text that other systems read, most often to prove you own a domain for services like Google Search Console, and for email authentication records such as SPF, DKIM and DMARC.
See also
- DNSDevOps & Cloud, p. 16DNS is the internet's naming system that translates human-readable domain names like example.com into the numeric IP addresses computers use to connect.
- Domain NameWeb Development, p. 14A domain name is the human-readable address of a website, such as example.com, which the DNS system translates into the IP address of the server that hosts it.
- IP AddressNetworking, p. 10An IP address is a numeric label assigned to each device on a network so that data can be routed to it, much like a postal address for a house.
- IPv6Networking, p. 12IPv6 is the newest version of the Internet Protocol, using 128-bit addresses that give every device a unique address and replace the exhausted IPv4 pool.
- TTLNetworking, p. 34TTL (time to live) is a limit on how long data stays valid: router hops left for an IP packet, or seconds a DNS or cached answer may be reused.
- SMTPNetworking, p. 26SMTP is the internet's standard protocol for sending email, used by apps to submit messages and by mail servers to relay them to the recipient's mail server.
Spotted a mistake or something missing on this page?Suggest an edit