DNS Records Explained

What Are DNS Records

If you own a domain name, you may have heard about DNS records. You may have even had to modify or create some. Let’s understand what these DNS records are all about.

A DNS record is a piece of text served by a DNS (Domain Name System) server and providing some information about a domain name.

When a program has to interact with a domain name, it first queries a DNS server to retrieve information needed for the interaction. Often, that’s the domain IP address.

DNS records have types, designated by a few uppercase letters. Listing them all here wouldn’t be relevant because most are used in rare cases, but you can see the full list here.

Instead, we’ll mention the types most commonly used:

RecordRole
ASpecifies an IP address for the domain.
CNAMESpecifies an alias for the domain.
MXSpecifies a mail server for the domain.
TXTCan be used to specify many different things, like SPF, DKIM, DMARC, a verification code to prove domain ownership, …
NSSpecifies an authoritative DNS server for the domain, i.e. a server hosting the reference DNS records.

Note

There are authoritative DNS servers because the DNS records of a domain are replicated to many DNS servers around the world. The non authoritative ones regularly refresh their records from the authoritative ones.

Each type has specific properties, which are actually just words and numbers in the textual record. This will be made clearer in the examples below.

How to Change a DNS Record

When you want to make a website or a business email address for instance, you’ll have to set some DNS records.

Usually domain owners can edit DNS records from their domain provider website. Each provider has its own DNS editing interface, but they’re all really variation of the same thing.

Under the hood DNS editors change the DNS records stored in the servers designated by the NS record(s). As mentioned previously, those are the authoritative servers for your records.

There are many other DNS servers around the world, and those which had a copy of the previous records for your domain will soon refresh their records with the new values pulled from the authoritative servers. Your changes will propagate like that to the Internet.

DNS propagation

Example 1: The A Record

A common use case is when you type a domain name into your browser, or click a link on Google search results.

When you do that, your browser asks the closest DNS server for the domain IP address. That information is given in the A record. Armed with the IP address, your browser can now ask to the web server running at that IP for the web page you want to see.

For those familiar with the command line, we can query DNS servers for a particular record using the dig command. Here’s an example with google.com’s A record:

peter@home:~$ dig A google.com

; <<>> DiG 9.16.1-Ubuntu <<>> A google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23599
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		149	IN	A	142.250.178.142

;; Query time: 8 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: mer. avril 20 15:54:28 CEST 2022
;; MSG SIZE  rcvd: 55

Let’s break down the ANSWER section:

google.com.		149	IN	A	142.250.178.142
  1. The first part is the “host”, or “name”. That’s just the domain name, terminated by a dot; In this case it’s google.com., because that’s what we requested.
  2. The number 149 is the TTL (Time To Live). All DNS records have a TTL. It specifies how many seconds DNS servers should keep the record before refreshing its value from the authoritative DNS servers. Thus, the lower the TTL, the faster DNS changes propagate.
  3. The IN word is just DNS record syntax, it always precedes the record type.
  4. A is the record type.
  5. The last part of an A record is often called the “value” or “target”, and is always an IP address; In this case: 142.250.178.142.

So here we are: the A record of google.com gave us the IP address 142.250.178.142 for that domain.

Go ahead and copy/paste that IP into your browser search bar, it’ll open google.com (assuming that’s still a google.com IP when you read this).

Example 2: The MX Record

Let’s see how you would configure an MX record on your domain provider DNS editor with a concrete example. That’s another common use case, for when you want to make domain email addresses.

An MX record has 4 properties, explained in detail in our post The MX Record Explained: host, value, priority, and TTL. It indicates which mail server handles emails for email addresses based on the domain name.

We’ll reuse our domain name myshinynewdomain.com from our guide on creating domain email addresses. The domain provider is Namecheap. We login to Namecheap, go to the DNS editor, and enter the following properties:

  • Host: @.
  • Value: mail.postale.io..
  • Priority: 0.
  • TTL: 1 min.
Setting the MX record on Namecheap
Setting the MX record on Namecheap.

We wait a minute or two for the change to propagate…Ok, now let’s see if that worked. A quick check on the handy website whatsmydns.net gives us:

DNS propagation on whatsmydns.net.

And the command line gives us similarly:

peter@home:~$ dig MX myshinynewdomain.com

; <<>> DiG 9.16.1-Ubuntu <<>> MX myshinynewdomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62272
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;myshinynewdomain.com.		IN	MX

;; ANSWER SECTION:
myshinynewdomain.com.	60	IN	MX	0 mail.postale.io.

;; Query time: 16 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: mer. avril 20 16:59:56 CEST 2022
;; MSG SIZE  rcvd: 80

It worked! We find all of our properties in the answer section:

myshinynewdomain.com.	60	IN	MX	0 mail.postale.io.

Over to You

Hopefully this quick introduction to DNS makes things a little clearer. What do you think? Is there a particular record we haven’t covered yet you’d like an article on? Let us know!

Get help

If you’re a postale.io user and you’re having difficulties setting up your MX record, drop us an email at support@postale.io, we’ll be happy to help!

  • The MX Record Explained

    The MX Record Explained

    What Is an MX Record Did you have to set your domain MX record at some point when creating a business email address but didn’t understand it well? In this post we’ll explain what an MX record is and how to set it up. The MX record is a type of DNS record. Don’t know […]

  • The SPF Record Explained

    The SPF Record Explained

    If you’re here you’ve probably been asked to configure your domain SPF record while setting up a business email address. If you’re not sure what that is, you’re in the right place! In this post we’ll explain what the SPF record is, and how to set it up correctly. What Is an SPF Record SPF […]