Skip to content

Appendix B — DNS Records Cheat Sheet

DNS is the city directory from Chapter 10. It maps a name to whatever answers for it. This page is the lookup table for that directory. Every example uses the lab domain pipeslab.in and documentation addresses only (203.0.113.0/24, 192.0.2.0/24, 2001:db8::/32).

Zone lines follow the standard layout: name, TTL in seconds, class IN, record type, then the data. A trailing dot means “this exact name, from the root”, and every example uses one.

Type What it points to Used for
A An IPv4 address A name that resolves to a server
AAAA An IPv6 address The same, for IPv6
CNAME Another name An alias below the zone apex
ALIAS, ANAME, flattening A name, resolved by the provider An alias at the apex (not standard DNS)
MX A mail host name, with a priority Where email for the domain goes
TXT Free text SPF, DKIM, DMARC, ownership proof
NS A name server name Who is authoritative for the zone
SOA Zone metadata Primary server, serial, timers
CAA A certificate authority name Which CAs may issue certificates
SRV Host and port, with priority and weight Services that need a port in DNS
PTR A name Reverse lookup, IP address to name
HTTPS, SVCB A target, plus service hints Advertising protocol features up front (newer)

Purpose. Maps a name to an IPv4 address. This is the record you will create most often.

app.pipeslab.in. 300 IN A 203.0.113.10

Gotchas.

  • An A record cannot share a name with a CNAME. Pick one.
  • When you rebuild a VPS and its IP changes, the old A record keeps sending traffic to an address that now belongs to someone else, or to nobody.

Purpose. The IPv6 equivalent. The address is 128 bits and looks like a row of colons.

app.pipeslab.in. 300 IN AAAA 2001:db8::10

Gotchas.

  • Publishing AAAA promises that the IPv6 path works. Check the firewall and the listener on v6 as well as v4.
  • Modern browsers race IPv4 and IPv6 (Happy Eyeballs), so a dead AAAA costs less than it once did. It still slows connections and confuses logs.

Purpose. Makes one name an alias for another. The target is then resolved in its own right.

staging.pipeslab.in. 3600 IN CNAME app.pipeslab.in.

Gotchas.

  • A CNAME cannot sit beside any other record with the same name. Not an A, not a TXT, not an MX.
  • It cannot live at the zone apex (the bare pipeslab.in). See the next section for the workaround.
  • The target must be a name, never an IP address.

Purpose. You want the bare domain to point at a hostname, such as a platform load balancer, but the apex cannot be a CNAME. Some providers offer a record type of their own. They resolve the target on their side and hand out plain A and AAAA answers.

pipeslab.in. 300 IN ALIAS lb.pipeslab.in. ; provider-specific, not standard

Gotchas.

  • It is not standard DNS. Providers call it ALIAS, ANAME, CNAME flattening, or a checkbox in a dashboard. Nothing outside that provider understands it.
  • Tools like dig show the flattened A records, not the alias, so you cannot see the wiring from the outside.
  • Moving DNS to another provider means redoing the trick there.
  • My opinion for a small production VPS: use a plain A record at the apex. Reach for ALIAS only when the target is a moving hostname you do not control.

Purpose. Says which hosts take email for the domain, and in what order. The number is a priority. Lower wins, and equal numbers share the load.

pipeslab.in. 3600 IN MX 10 mail.pipeslab.in.
mail.pipeslab.in. 3600 IN A 203.0.113.25

Gotchas.

  • The MX target should be a name with an A or AAAA record behind it. It should not be an alias, and it should never be a bare IP address.
  • The mail host’s name should match the PTR record for its IP. More on that under PTR.
  • Pointing MX at your web server because “it’s the same box” works until the day you add a mail server and forget. Give mail its own name, even when it lives on the same VPS. Chapter 13 has the longer story.

Purpose. Free text, which sounds useless and turns out to be how a good share of the internet proves who it is. Email authentication (SPF, DKIM, DMARC) and domain ownership checks all live here.

pipeslab.in. 3600 IN TXT "v=spf1 mx ip4:203.0.113.25 -all"
selector1._domainkey.pipeslab.in. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq...(truncated)"
_dmarc.pipeslab.in. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@pipeslab.in"
pipeslab.in. 3600 IN TXT "provider-verify=7f3c9a"
  • SPF lists the servers allowed to send mail for the domain. -all means anything else fails. ~all is the softer version. Start soft while you learn, then tighten.
  • DKIM is a public key your mail provider uses to sign outgoing mail. The selector (selector1 here) says which key to fetch. Your provider gives you the exact record. You paste it, and you do not edit it.
  • DMARC tells receivers what to do when SPF and DKIM both fail, and where to send reports. Start with p=none so you read the reports before anything gets rejected.
  • Verification records are one-off tokens that prove to a third party that you control the domain. Keep them. Deleting one can quietly unlink a service.

Gotchas.

  • Only one SPF record per name. Two of them and the check fails outright.
  • SPF allows about ten DNS lookups. Every include: and mx counts. Stack three SaaS senders and you can hit the limit without noticing.
  • A single TXT string holds at most 255 characters. Longer values must be split into chunks. Most DNS panels do this for you. Check that yours did.
  • Quoting varies between editors. A stray quote or semicolon can break a DKIM key that looked perfect in the panel.

Purpose. Names the servers that are authoritative for the zone. It answers the question “who holds the real directory for this domain?”

pipeslab.in. 86400 IN NS ns1.pipeslab.in.
pipeslab.in. 86400 IN NS ns2.pipeslab.in.

Gotchas.

  • There are two copies. One sits at your registrar, in the parent zone, as the delegation. The other sits in your zone. They must match. When they don’t, some resolvers get one answer and some get the other. Chapter 11 covers the registrar side.
  • A name server inside the zone it serves needs glue. The registrar must also hold its IP address. Without glue, a resolver asking for ns1 would have to ask the very zone it is trying to reach.
  • A lame delegation is an NS record pointing at a server that does not answer for the zone. Resolvers wait, time out, and blame you.
  • NS changes take as long as the parent’s TTL, often a day or two. Plan for that before you move anything.

Purpose. The start-of-authority record. Every zone has exactly one. It holds the zone’s bookkeeping: the primary server, a contact mailbox, a version number, and the timers that secondary servers use to copy the zone. Most people never touch it, which is why it surprises them on the day it matters.

pipeslab.in. 3600 IN SOA ns1.pipeslab.in. hostmaster.pipeslab.in. 2026112001 7200 3600 1209600 300
Field Example What it means
MNAME ns1.pipeslab.in. The primary name server for the zone
RNAME hostmaster.pipeslab.in. Contact mailbox. The first dot reads as @, so this is hostmaster@pipeslab.in
Serial 2026112001 Version number. Secondaries copy the zone when it goes up
Refresh 7200 Seconds between checks for a new serial
Retry 3600 Seconds a secondary waits after a failed check
Expire 1209600 Seconds a secondary keeps answering after it loses the primary (14 days)
Minimum 300 Negative-caching time. Per RFC 2308, the smaller of this and the SOA TTL governs how long “no such name” answers stay cached

The serial is usually written as date plus a counter (YYYYMMDDnn), which makes it easy to read in a hurry.

Gotchas.

  • The serial must go up on every change. Secondaries compare numbers, not contents. An edit that leaves the serial alone can be invisible to them.
  • RNAME is a mailbox, not a link. Nobody reads it until someone at an abuse desk needs to reach you. Keep it real.
  • Your DNS provider usually writes the SOA for you. Check its values; do not fight them.
  • Negative caching bites after a fix. If a missing record was looked up and cached as “no such name”, some clients keep seeing that answer until the minimum runs out.

Purpose. A guest list for certificate authorities. It says which CAs may issue certificates for your domain. Chapter 9 explains why a certificate needs a CA at all. CAA is the lock on the issuer’s side of that door.

pipeslab.in. 3600 IN CAA 0 issue "letsencrypt.org"
pipeslab.in. 3600 IN CAA 0 issuewild ";"
pipeslab.in. 3600 IN CAA 0 iodef "mailto:security@pipeslab.in"

The issue value is the CA’s published issuer domain. Look it up in the CA’s own documentation rather than guessing. issuewild ";" means no CA may issue a wildcard certificate. iodef is where a CA sends reports of refused requests.

Gotchas.

  • No CAA record at all means any CA may issue. Adding one restricts future issuance only. It does not revoke anything already issued.
  • A CAA lookup climbs the tree. A subdomain with no CAA of its own inherits the nearest one above it, so one record at the apex often covers everything.
  • A typo in the CA name is silent until a renewal fails. Check it again whenever you change certificate providers.

Purpose. Says which host and port serve a named service, with priority and weight for sharing load. Web browsers do not use it. They ask for port 443 directly. SRV is for protocols that were designed to ask DNS where to go, such as SIP, XMPP and several game servers.

_sip._tcp.pipeslab.in. 3600 IN SRV 10 60 5060 sip.pipeslab.in.

The four data fields are priority, weight, port and target. Lower priority is tried first. Among records with equal priority, weight splits traffic in proportion.

Gotchas.

  • The underscores are deliberate. The name is _service._protocol and then the domain, which keeps service names from colliding with real hostnames.
  • The target must be a name with an address record behind it. It must not be an IP address, and it must not be a CNAME.
  • A target of a single dot, with port 0, means “this service is not offered here.” It is a clear no, not a silent failure.
  • Some dashboards hide SRV behind a generic form. Paste the four fields exactly, in order.

Purpose. The reverse of an A record. Given an IP address, it names a host. The data lives under in-addr.arpa for IPv4 and ip6.arpa for IPv6, with the address written backwards.

25.113.0.203.in-addr.arpa. 3600 IN PTR mail.pipeslab.in.

Gotchas.

  • You do not control it. The owner of the IP block does, which for a VPS usually means the provider. You set it in their panel or ask them through a ticket.
  • Mail receivers often check forward-confirmed reverse DNS. The PTR name should resolve forward to the same IP. A mismatch is a common reason a fresh mail server lands in spam.
  • The PTR name should match the mail host’s name in your MX setup. That is the point of the two records agreeing.
  • Check it with dig -x 203.0.113.25 +short. Traceroutes and log tools use the same lookup, so a good PTR also makes your logs readable.

Purpose. Newer record types that let a server advertise what it supports before the first connection. Examples are which HTTP versions to try and, in some setups, hints for encrypted client hello. The HTTPS record was standardized around 2023, and support has been growing since. Treat it as an optional speed-up, not a requirement.

pipeslab.in. 3600 IN HTTPS 1 . alpn="h2,h3"

Here 1 is the priority, . means “this same name”, and alpn lists the protocols the server offers.

Gotchas.

  • Adding one can change how clients connect. Test with a real browser and curl before you rely on it.
  • Some hosting platforms and proxies create this record on your behalf. If one appears in dig and you did not add it, check the provider’s settings before you touch it.
  • If your stack does not use it, leave it out. Nothing breaks when it is absent.

The TTL is how long a resolver may keep an answer before it asks again. Set it for the job the record is doing today, and change it before you need to change the record.

Situation TTL to set Why
Normal running 3600 to 86400 seconds Caches keep answers, your name server gets fewer lookups, and a mistake ages out within hours
Before a planned move Lower to 300 Caches forget the old answer quickly once the change lands
During the move 300 A wrong new address gets corrected in minutes
After it settles Raise back to 3600 or more Fewer lookups, and less risk if you forget

Lower the TTL at least one old TTL before the change. If the old TTL was 86400, that means a day ahead. Otherwise the caches still hold the long answer when you flip the record, and the short TTL helps nobody.

Gotchas.

  • A TTL of 0 or 60 is not free. Every visitor’s resolver asks again, and so does every bot. Keep it short only while you are moving.
  • The TTL you see in dig is a countdown, not the value in the zone. A resolver that answered 40 seconds ago shows you 40 seconds less.
  • NS and glue records follow the parent zone’s TTL. Lowering the TTL in your own zone does not speed up a change at the registrar. Chapter 11 covers that side.

dig asks DNS a question and prints the answer with its TTL. Most of the time you want the short form. Use the long form when something is strange.

dig app.pipeslab.in A # full answer: header, question, answer, authority
dig app.pipeslab.in A +short # the bare answer, nothing else
dig app.pipeslab.in A +noall +answer # only the answer section, with TTLs
dig @ns1.pipeslab.in pipeslab.in SOA # ask the zone's own name server, skip caches
dig pipeslab.in MX +short # mail hosts and their priorities
dig pipeslab.in TXT +short # SPF, DKIM, DMARC and verification strings
dig pipeslab.in NS +short # the name servers the zone publishes
dig -x 203.0.113.25 +short # reverse lookup, the PTR for an address
dig pipeslab.in A +trace # walk from the root down, one hop at a time

Reading the output:

  • status: NOERROR with an empty answer section means the name exists but has no record of that type. status: NXDOMAIN means the name does not exist at all.
  • status: SERVFAIL means the server could not answer, often because a delegation is broken. Try +trace to see where the walk stops.
  • @server skips your local resolver. Use it to ask the authority directly, and to ask a public resolver to see what the rest of the world gets.
  • +trace is the best single tool for “where did this answer come from?” It shows the root, the top-level domain, and the zone, in order.
pipeslab.in. 2871 IN MX 10 mail.pipeslab.in.

That 2871 is the time left on the cached copy. Run the same query again in a minute and it will be smaller.

The CNAME is the most useful record in the zone and the most misused. Five rules catch nearly every mistake.

  1. A CNAME stands alone. A name that has a CNAME may hold no other record. Not an A, not a TXT, not an MX.
; works: a plain alias
staging.pipeslab.in. 3600 IN CNAME app.pipeslab.in.
; broken: one name cannot be an alias and an address at once
app.pipeslab.in. 3600 IN CNAME lb.pipeslab.in.
app.pipeslab.in. 3600 IN A 203.0.113.10
  1. Never at the apex. The bare domain, pipeslab.in itself, always carries SOA and NS records, so it cannot be a CNAME. Use A and AAAA there, or the provider’s ALIAS-style record if it has one.
  2. Point at a name, never at an IP. The target has to be a hostname that resolves to an address.
  3. Keep chains short. A CNAME may point at another CNAME, but each hop is another lookup, and resolvers give up after a limit. One hop is the goal. Two is tolerable. Longer is a smell.
  4. Keep it out of MX and SRV targets. Mail and service targets should resolve straight to an address. Some servers cope with a CNAME there and some do not. Do not test your luck.

A CNAME also hands control of your name to whoever owns the target. If that host is retired, your name points at nothing, and visitors meet a failure you did not cause on the day you did not touch anything.

Nothing is pushed out to the world when you save a zone. The new answer sits on your name server, and every cache keeps the old one until its TTL runs out. So the checklist proves four things: the authority has the change, the delegation points at that authority, the caches are turning over, and the new server answers correctly before anyone depends on it.

  1. Ask the authority, not a resolver. Find the servers that hold the zone, then query one of them directly.
Terminal window
dig pipeslab.in NS +short
dig @ns1.pipeslab.in app.pipeslab.in A +noall +answer
  1. Check the delegation if you moved name servers. dig pipeslab.in NS +trace shows what the parent zone says. If the parent still names the old servers, your edit does nothing for most of the world, however correct it is.
  2. Ask two public resolvers. Query @1.1.1.1 and @8.8.8.8. When they agree with the authority, the caches have turned over, or never held the old answer.
  3. Read the countdown, then wait for it. The TTL in a normal answer is the seconds left on the cached copy. Wait for the old TTL to reach zero. A widely told story says DNS takes a day or two to propagate. That is folklore. The real number is the old TTL, and you can read it.
  4. Test the new address before the flip. curl --resolve pins a name to an IP for one request and skips DNS entirely. It is the single best habit in this appendix.
Terminal window
curl -I --resolve app.pipeslab.in:443:203.0.113.10 https://app.pipeslab.in/
  1. Flush your own machine. Your laptop and browser keep caches too. Flush commands vary by OS and version, so check yours. Two that work on recent systems:
Terminal window
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder # macOS
sudo resolvectl flush-caches # Ubuntu with systemd-resolved
  1. Check the certificate last. The name can resolve and the handshake can still fail, because the new server holds no certificate for that name. Chapter 9 explains why, and the fix is usually on the server, not in DNS.

Gotchas.

  • Lowering the TTL helps only if you do it early. Lower it at least one old TTL ahead of the change, as the TTL guidance above says.
  • Some caches ignore the TTL and hold answers longer. Those are rare, and they are the reason a change can look finished on one network and wrong on another.
  • Do not change the record again while you are still waiting. Every new value restarts the caches’ clock from a different starting point, and you end up debugging two answers at once.

Book 2 of a series. Book 1: The Glue.