What is the difference between DNS record types A, CNAME and MX?
Options
- A maps a name to an IPv4 address; CNAME is an alias; MX is for email (Correct option)
- A is used for email delivery and MX is used for IPv4 addresses
- CNAME maps a name to an IP, while A maps a name to another name
- They are all identical and any of them can replace the others
Answer
A maps a name to an IPv4 address; CNAME maps a name to another name (alias); MX tells where to deliver email
Why
DNS translates names into data:
- A (and AAAA for IPv6):
api.example.comto203.0.113.10. - CNAME:
www.example.comis an alias ofexample.com(or of a load balancer's DNS name). - MX: mail servers for the domain.
- TXT: free text such as domain verification and SPF.
A CNAME cannot sit at the zone apex (example.com itself); clouds provide alias records for that. Services: Route 53 (AWS), Azure DNS.
Remember
A = name to IP. CNAME = name to name. MX = mail.