100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What are the Common DNS Record Types?

Learn the common DNS record types — A, AAAA, CNAME, MX, TXT, NS — and what each does, with networking interview Q&A.

mediumQ71 of 224 in Computer Networks Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

DNS records are typed entries stored in a zone file that map a domain name to different kinds of information — most commonly an A record for an IPv4 address, AAAA for an IPv6 address, CNAME for an alias to another name, MX for mail servers, TXT for arbitrary text, and NS for the authoritative name servers of a zone.

An A record maps a hostname directly to an IPv4 address, while an AAAA record does the same for IPv6. A CNAME record points one hostname to another hostname rather than to an address directly, useful for aliasing (like www pointing to a root domain) but not allowed at the zone apex alongside other records. MX records list the mail servers responsible for accepting email for a domain, each with a priority value so senders know which server to try first. TXT records hold arbitrary text and are widely used for domain verification and email authentication schemes like SPF, DKIM, and DMARC. NS records declare which name servers are authoritative for a zone, and SOA records carry zone-wide metadata like the primary name server and refresh timers. Each record type also has a TTL controlling how long resolvers may cache it.

  • Different record types let one domain carry many kinds of information
  • CNAME enables clean aliasing without duplicating IP management
  • MX and TXT records support reliable, authenticated email delivery
  • TTLs on each record let operators tune caching versus propagation speed

AI Mentor Explanation

DNS record types are like the different entries in a team’s official handbook: one page lists a player’s current playing ground address (A record), another lists their alternate name if they play under a nickname (CNAME), and another lists which manager handles postal correspondence for the team (MX equivalent). A separate notes page carries verification codes proving the handbook is officially sanctioned by the board (TXT), and a cover page states which league office is authoritative for updating the handbook (NS). Each entry also has an expiry note for how long other clubs may rely on the copy they hold before requesting a fresh one, just like a TTL.

Step-by-Step Explanation

  1. Step 1

    A / AAAA records

    Map a hostname directly to an IPv4 (A) or IPv6 (AAAA) address.

  2. Step 2

    CNAME records

    Alias one hostname to another hostname, which is then resolved further.

  3. Step 3

    MX records

    List mail servers responsible for the domain, each with a priority for delivery order.

  4. Step 4

    TXT / NS / SOA records

    TXT carries verification/authentication text; NS names authoritative servers; SOA holds zone metadata.

What Interviewer Expects

  • Correctly explains at least A, AAAA, CNAME, MX, TXT, and NS records
  • Knows CNAME cannot coexist with other records at the zone apex
  • Understands MX priority values and how mail delivery order is chosen
  • Knows TXT records are used for SPF/DKIM/DMARC and domain verification

Common Mistakes

  • Confusing a CNAME record with an A record
  • Thinking MX records point to an IP address directly instead of a hostname
  • Not knowing TXT records are used for email authentication and ownership proofs
  • Forgetting that a lower MX priority number typically means higher preference

Best Answer (HR Friendly)

DNS records are like different labeled entries in a domain’s contact card — one entry gives its address (A/AAAA), another gives a nickname that points to the real name (CNAME), another lists who handles its mail (MX), and another holds verification text proving ownership (TXT). Together they let one domain name carry all the information needed to route traffic, email, and trust checks correctly.

Code Example

Querying different DNS record types
# Query the A record (IPv4 address)
dig example.com A +short

# Query the MX records (mail servers)
dig example.com MX +short

# Query TXT records (SPF/DKIM/domain verification)
dig example.com TXT +short

# Query the authoritative name servers
dig example.com NS +short

Follow-up Questions

  • Why can a CNAME record not be used at the zone apex alongside other records?
  • How does MX priority determine which mail server is tried first?
  • What role do TXT records play in SPF, DKIM, and DMARC?
  • What is the difference between an NS record and a SOA record?

MCQ Practice

1. Which DNS record type maps a hostname to an IPv4 address?

An A record maps a hostname directly to an IPv4 address.

2. Which record type is commonly used to hold SPF and DKIM data?

TXT records hold arbitrary text, widely used for SPF, DKIM, and DMARC authentication data.

3. What does an MX record specify?

MX records list mail servers for a domain along with a priority value.

Flash Cards

What does an A record do?Maps a hostname directly to an IPv4 address.

What does a CNAME record do?Aliases one hostname to another hostname instead of an address.

What is an MX record for?Lists mail servers for a domain with priority values.

What is a TXT record commonly used for?Domain verification and email authentication (SPF, DKIM, DMARC).

1 / 4

Continue Learning