Free tech learning for everyone, from basics to pro

Network FundamentalsNetworking SecurityBeginner

DNS record types explained: A, AAAA, CNAME, MX, TXT, NS, SOA, PTR, SRV and CAA

In short: DNS stores different kinds of records for each name. A and AAAA records give IPv4 and IPv6 addresses, CNAME makes an alias, MX lists mail servers, TXT holds text such as SPF and verification codes, NS and SOA describe the zone itself, PTR maps addresses back to names, SRV locates services and CAA limits which certificate authorities may issue certificates.

A zone is a list of records

Every domain you own, such as example.com, is a zone held on authoritative DNS servers. The zone is simply a list of records. Each record has a name, a type, a time to live (TTL) and a value:

www.example.com.   3600  IN  A      203.0.113.10
www.example.com.   3600  IN  AAAA   2001:db8:10::10
shop.example.com.  3600  IN  CNAME  example.myshopify.com.
example.com.       3600  IN  MX     10 mail1.example.com.
Common DNS record typesAname to IPv4AAAAname to IPv6CNAMEalias to another nameMXmail serversTXTSPF, verificationNSwho answers for a zoneSOAzone settingsPTRIP back to nameSRVservice location
Figure 1. Each record type answers a different question about a name.

The records you will use most

  • A: maps a name to an IPv4 address. A name can have several A records, and clients pick one (simple load sharing).
  • AAAA: the same for IPv6. Clients that have IPv6 usually try it first.
  • CNAME: says "this name is really that other name". The client then looks up the target. A CNAME cannot sit alongside other records with the same name, which is why you cannot put a CNAME on the bare domain (the apex, example.com) where NS and SOA records must live. Many DNS providers offer ALIAS or "CNAME flattening" to work around this.
  • MX: lists the mail servers for a domain with a preference number. Lower numbers are tried first. MX must point to a name with A or AAAA records, not to an IP address or a CNAME.
  • TXT: free text. Used for SPF (which servers may send your email), DKIM public keys, DMARC policies and domain verification codes for services like Microsoft 365 and Google.
  • NS: names the authoritative servers for the zone. These must match what is registered with your domain registrar.
  • SOA: the "start of authority" record with the primary server, the admin contact, a serial number and timers for secondary servers.
  • PTR: reverse lookup, from an IP address to a name, stored in special zones such as 10.113.0.203.in-addr.arpa. Mail servers often check that a sending IP has a sensible PTR. The owner of the IP block (usually your ISP or cloud provider) controls it.
  • SRV: tells clients which host and port provide a service, for example _sip._tcp.example.com or Active Directory's _ldap._tcp.dc._msdcs.
  • CAA: lists which certificate authorities may issue certificates for the domain, a simple protection against mis-issued certificates.

TTL: how long answers are cached

The TTL (in seconds) tells resolvers how long they may keep an answer. A TTL of 3600 means up to an hour. Before moving a website to a new server, lower the TTL to 300 a day ahead, make the change, then raise it again. Otherwise some users keep visiting the old address for hours after the change.

Looking records up

  • Windows: nslookup -type=mx example.com or Resolve-DnsName example.com -Type MX.
  • Linux and macOS: dig example.com MX, dig +short www.example.com AAAA, dig -x 203.0.113.10 for a PTR.

Real-world example: email that bounced after a website move

A small business moved its website to a new host and replaced its whole DNS zone with the host's template. The website worked, but email stopped the same afternoon. The template had no MX records and the old SPF TXT record was gone, so other servers had nowhere to deliver mail and rejected what was sent. Re-adding the MX records for Microsoft 365 and the SPF record brought email back.

Practice

Which record type tells other servers where to deliver email for a domain?
MX.
Why can you not usually put a CNAME on the bare domain (apex)?
A CNAME cannot coexist with other records of the same name, and the apex must hold NS and SOA records.
What should you do with the TTL before moving a website to a new IP address?
Lower it (for example to 300 seconds) in advance, so cached answers expire quickly after the change.

Key takeaways

  • A and AAAA map names to IPv4 and IPv6 addresses.
  • CNAME creates an alias but cannot be used at the zone apex.
  • MX, TXT (SPF, DKIM, DMARC) and PTR records matter for email.
  • TTL controls caching; lower it before planned changes.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: