In the Domain Name System (DNS), the DNS records are the instruction sets. They give information about a host (computer, domain name, etc.) or a service to browsers, devices, and servers. There are several DNS record types that simplify various aspects of browsing and communicating on the internet. 🌐
📚 This guide will explain what the most important types of DNS records are and how they work, complete with examples.
We’ll discuss the following DNS record types:
Let’s get into it! 😎
Most popular DNS record types
First in our list of the most popular DNS record types is the A record. It links a domain name to an IPv4 address. The IPv4 addresses are 32-bit addresses and look like this “188.8.131.52”.
Thanks to the A records, users don’t need to remember these long strings of numbers. Instead, you can simply type the domain name of a site, and your computer will find its IP address. Your computer will then connect to the web server and provide you with the site’s content.
Example of an A record
domainwheel.com A 184.108.40.206 300
DomainWheel.com uses this A record to direct users to its web server. When a person types “domainwheel.com” in their browser, his or her computer will search for our A record and will be redirected to its IP – 220.127.116.11.
💡 Read our full-length article about the A record.
The AAAA records are the connection between domain names and their IPv6 addresses. The IPv6 addresses are 128-bit addresses and look like this “2606:4700:3034::6815:3683”.
Just like the A record, this one links names to their addresses, but the difference is the type of address. IPv6 is the newer standard, as it has many more combination possibilities, allowing for the creation of many more IP addresses.
We are in the process of a slow migration to IPv6-only. For now, most of the devices on the internet can be identified with both IPv4 and IPv6 addresses at the same time.
Example of an AAAA record
domainwheel.com AAAA 2606:4700:3032::ac43:8ab7 300
DomainWheel.com uses AAAA records to direct users to its web server so they can see the content of the site. Usually, IPv6 has priority over IPv4. This means that when you search for a domain name, you’ll usually get the AAAA record first and you’ll connect to the IPv6 address of the web server. In our case, the IPv6 is “2606:4700:3032::ac43:8ab7”.
💡 Read our full-length article about the AAAA record.
CNAME record is the canonical name record. Its purpose is to specify that one domain (subdomain) is just an alias to another one (the canonical domain). In simple words, it redirects to a parent domain for simplicity. That way, a DNS lookup for the subdomain will be redirected to the canonical domain name and the next query will get the needed DNS record from there. That saves a lot of time for a DNS administrator as they can simply create a single CNAME record for each subdomain, and direct to the canonical domain.
Example of a CNAME record
mail.domainwheel.com CNAME ghs.google.com 7200
Domain Wheel uses CNAME for its “mail” subdomain, which allows us to use Google Workspace for our emails. If you want to use Google services for your emails, you’ll need to follow Google instructions and add a CNAME subdomain to your DNS records.
Another reason to use a CNAME record is to link the subdomain “www” to the canonical domain. An example of this is linking www.example.com to example.com.
💡 Read our full-length article about the CNAME record.
The NS record is a type of DNS record that indicates the authoritative name servers for a domain. Using them, administrators delegate authority for a domain or subdomain to specific name servers.
When somebody types a domain name, their device will need to resolve the domain. The root domain will answer with a top-level domain. The top-level domain will answer with the authoritative name server for the domain (provide the NS record), and the name server will finally answer with an IP address (A or AAAA record).
Example of a NS record
domainwheel.com NS marek.ns.cloudflare.com 21600
This NS record points to the authoritative name server that can answer queries for domainwheel.com. This is the main DNS server for DomainWheel: it distributes DNS changes to the secondary DNS servers. Other DNS servers (like your ISP’s DNS server) will get information about the domain from this name server as well.
Next up in our list of essential DNS record types is the SOA record, which marks the Start Of Authority. It stores very important information about the DNS zone:
- Authoritative name server of the domain.
- Serial number of the zone file. This number increases, each time you make changes inside the DNS zone.
- DNS admin email.
- Refresh rate – this is the time that each of the secondary DNS servers must wait before checking for changes.
- Retry – if a secondary server fails to complete a zone transfer (get the updates from the authoritative), this is the time it must wait until it tries to update again.
- Expire – this is the time a secondary server will keep trying to finish a zone transfer. If the time comes, before a zone transfer is complete, the secondary DNS server will expire and won’t answer queries.
- TTL – the time this record is valid.
The secondary DNS servers use the SOA record to know if they need to update their cache memory. They compare the serial number inside their SOA records, and if they can SOA records with lower numbers, they will update to the latest version and update all the DNS changes.
Example of a SOA record
merek.ns.cloudflare.com dns.cloudflare.com. 2325716184 10000 2400 604800 1800
In our SOA record, we show which is the authoritative name server. Then, because we use the DNS service of Cloudflare, we skipped adding the DNS administrator’s email. The numbers after that are the following: serial number, refresh rate, retry interval, expire, and finally TTL.
TXT record is a text record that can contain all kinds of information about the domain. The most popular use cases of the TXT records are different domain authentications like SPF, DKIM, and DMARC. You can use these records to indicate which mail servers can send emails on behalf of your domain, encrypt emails, and add additional verification and reporting processes.
The goal of these security mechanisms is to lower phishing and man-in-the-middle attacks and provide more secure email communication.
Example of a TXT record
domainwheel.com TXT v=spf1 include:_spf.google.com ~all 300
We use a TXT for Sender Policy Framework (SPF) to authorize which mail servers can send emails on behalf of DomainWheel.com. Inside this TXT record, “include_spf.google.com” adds the SPF policies of Google (spf.google.com domain). This allows Google to send emails on our behalf. The “~all” is used for soft fail, and that indicates to the receivers of an email from us that if the emails are not coming from Google’s servers they should be treated with suspicion, but not directly rejected.
PTR record is short for Pointer record. It is the opposite of the A or AAAA records. The PTR record points an IP address to a domain name and proves that one IP address is truly linked to a particular domain name. This can be used to track down the origin of an email see if it’s using the IP address corresponding to the domain it claims to be from.
Without PTR records you can have trouble sending emails. The incoming servers of the recipients might reject your emails or mark them as spam.
Example of a PTR record
18.104.22.168.in-addr.arpa PTR mail.example.com 3600
Since we are not managing our own mail server this is just an example. The PTR records need to be created inside special reverse DNS zones. When somebody looks for the IP address (IPv4 or IPv6), this record will indicate the correct domain name that corresponds to it.
Next up in our list of DNS record types is the MX record (Mail exchanger), which indicates the email servers that should receive email on behalf of the domain. Inside the MX record you’ll see a priority number that shows which email server should receive emails first. The lower the number is, the higher the priority is.
The MX record has a vital role, because without it the sender won’t know where exactly the emails should be sent.
Example of a MX record
domainwheel.com MX 1 aspmx.1.google.com. 300
domainwheel.com MX 10 alt3.aspmx.1.google.com. 300
Here we have 2 MX records, one with higher priority (1) and another with lower priority (10). When somebody tries to send an email to domainwheel.com, their message will be directed to the first one. If it is down for some reason, then the sender will try to send it to the second one.
💡 Read our full-length article about the MX record.
Web redirect record
This record does exactly what it says: redirects users from one domain to another. You can use it to redirect traffic from your old domain to your new domain if you have changed it. That way, visitors who try to visit your old domain will automatically be redirected to the new domain.
You can also redirect pages from the old domain and keep their SEO value.
There are two types of web redirect records. The first one is permanent redirect 301 and the second one is temporary redirect 302. The first is used when the site or page is moved forever, and the second is when there are just some problems that require a temporary redirect.
Example of a web redirect record
domain1.com WR https://domain2.com 3600
This example shows somebody redirecting domain1.com to domain2.com with a web redirect. That way, the WR record will automatically send all visitors attempting to visit domain1.com to domain2.com.
The ALIAS record is very similar to the CNAME record in one regard. You can use the ALIAS record to show that one domain or subdomain is an alias of another. In difference to the CNAME, the ALIAS won’t resolve to another name; it will resolve directly to the IP address of the domain instead.
Another key difference is that the ALIAS records can coexist with other DNS record types inside the same DNS zone. You can use it for the root too. These characteristics make them very useful and DNS admins often use them to point to content delivery networks (CDN).
Example of an ALIAS record
blog.example.com ALIAS example.com 3600
This example ALIAS record connects the subdomain blog.example.com to the example.com domain. That way, people who are trying to access blog.example.com will get the ALIAS record, which will respond to the A or AAAA record for example.com.
SRV is short for service. This DNS record type specifies the location of servers that provide a specific service within the domain. When a client makes a query this record will answer with essential information such as domain/hostname, port number, priority, and weight for protocols or applications.
Example of a SRV record
_service._sip SRV sipserver.example.com 3600
In this example, this is an SRV record for SIP (Session Initiation Protocol) service, which is hosted on sipserver.example.com (this is the hostname). The SIP protocol is used in communication. It can initiate, maintain, modify, and terminate multimedia sessions like video calls. You use SIP every time you communicate with somebody over VoIP applications like WhatsApp, Zoom, Skype, etc.
DNS record types in a nutshell 🐿️
All of these DNS record types are essential to the internet running smoothly. They tell your browser or device how to interact with various websites, tell your email provider how to respond to various communications, and more.
Next, check out our guide DNS propagation to find out more about how changes to these DNS record types work and how long they take.