NewHalo Edge 3 is here: HTTP/3 everywhere and 42 edge locations.Learn more
Docs / Domains and DNS

Understand DNS record types

Domains and DNS8 min readUbuntu 24.04 LTS

DNS is the internet's phone book: it turns names like example.com into the numbers computers use. Each entry in that book is a record. Once you know the common record types, most domain problems become easy to spot and fix.

Before you begin

  • Access to your domain's DNS settings, so you can see the records you have created.
  • The dig tool. It comes with macOS and most Linux systems. On the server, install it with sudo apt install -y dnsutils.
  • A domain to practice on. This guide uses example.com as a stand-in.

Step 1: Understand the parts of a record

Every DNS record has four parts: a name, a type, a value and a TTL (time to live). The name is the label being defined, the type says what kind of answer it gives, the value is that answer, and the TTL is how many seconds resolvers may cache the answer. For example, @ A 203.0.113.10 3600 means "the bare domain points to this IPv4 address, and the answer may be cached for one hour."

Step 2: Learn the common record types

These are the types you will meet most often:

  • A: maps a name to an IPv4 address, such as 203.0.113.10.
  • AAAA: maps a name to an IPv6 address, such as 2001:db8::10.
  • CNAME: makes one name an alias for another name. It cannot be used on the bare domain, and a name with a CNAME cannot have other records.
  • MX: names the mail servers that accept email for the domain, each with a priority number. Lower numbers are tried first.
  • TXT: stores free text. Services use it to verify ownership and to publish mail policies.
  • NS: lists the authoritative nameservers, the servers that hold the official answers for the domain.
  • SRV: points a service name to a host and a port. Some game clients use it so players can join with a plain domain name.

Step 3: Look up address records

The +short option makes dig print only the answer, which is easier to read. Start with the address records:

dig +short example.com A
dig +short example.com AAAA
203.0.113.10
2001:db8::10

Step 4: Look up mail and nameserver records

Next, check where email is delivered and which nameservers answer for the domain:

dig +short example.com MX
dig +short example.com NS
10 mail.example.com.
ns1.example.com.
ns2.example.com.

The number before the MX name is its priority. If you run your own mail server with Postfix, the MX record must point at a host name, not directly at an IP address.

Step 5: Look up text and service records

TXT records often contain verification strings, and SRV records describe where a service lives. A Minecraft SRV record, for example, lets players connect using a plain domain name instead of a port number:

dig +short example.com TXT
dig +short _minecraft._tcp.example.com SRV
"v=spf1 include:mail.example.com -all"
0 5 25565 mc.example.com.

In the SRV answer, the fields are priority, weight, port and target host. The port 25565 is the Minecraft default.

Step 6: Check a CNAME

If www is an alias for the bare domain, a CNAME shows that relationship:

dig +short www.example.com CNAME
example.com.

If the output is blank, www is either an A record or does not exist.

Careful: A CNAME cannot sit on the bare domain, and it cannot share a name with other record types. Many providers reject such combinations, so create an A or AAAA record for the bare domain instead.

Troubleshooting

  • The command prints nothing. Either the record does not exist, or you made a typo in the name or type. Check your DNS editor, then wait for the TTL if you just made a change.
  • Email bounces after you changed MX records. Confirm the MX value ends in a dot when shown by dig, that it points to a host name, and that the mail server answers on the expected addresses.
  • An old value keeps appearing. Caches keep answers until their TTL expires. Compare the TTL shown in full output with dig example.com A (without +short) to see how long the old answer may last.
  • Conflicting records. A name with a CNAME plus any other record is invalid. Remove one of them so the name has a single, consistent set of records.

Next steps

With the record types clear, you can point your domain at a server and build subdomains with confidence. Continue with the subdomain guide to serve a site under a name such as blog.example.com.

Something not working? Chat or email our support team and we will help you get unstuck.

Contact support