Skip to main content
Create your own

DNS Record Configuration and Propagation

Hello! Welcome back to our course on designing high-load distributed systems.

In our last lesson, we traced the entire DNS resolution path, from a client's request to the final query at the authoritative name server. We established that this server is the ultimate source of truth for a domain.

Today, we'll focus on the information that this authoritative server provides. This lesson addresses the learning outcome: Configure DNS A, AAAA, CNAME, and MX records and verify their propagation.

We will explore the most common types of DNS records that form the backbone of web and email services. You will learn what each record does, how to configure it in a typical domain registrar's interface, and how to confirm that your changes are live on the internet.

1. The Building Blocks: Core DNS Record Types

Once a DNS resolver finds the correct authoritative name server for a domain (as we discussed in the previous lesson), it asks that server for specific information. This information is stored in a set of records within the domain's "zone file." While many record types exist, four are fundamental for most applications.

Understanding and Setting Up DNS Records

This article from Cloudways provides clear and concise definitions for the essential DNS record types. It's a great reference for understanding their distinct purposes.

Please read the section 'Understanding Different Types of DNS Records', focusing on the descriptions for A, AAAA, CNAME, and MX records.

Let's summarize the key records you just read about:

  • A (Address) Record: This is the most basic and crucial record. It maps a hostname directly to an IPv4 address (e.g., 192.0.2.1). When you enter example.com in a browser, the resolver ultimately seeks an A record to find the server's IP.
  • AAAA (Quad-A) Record: This is the IPv6 equivalent of the A record. It maps a hostname to an IPv6 address (e.g., 2001:0db8::1). As IPv6 adoption grows, having AAAA records is essential for modern network compatibility.
  • CNAME (Canonical Name) Record: This record acts as an alias, mapping a hostname to another hostname instead of an IP address. For example, you can have www.example.com be a CNAME pointing to example.com. The resolver then performs a second lookup for example.com to find its A/AAAA record. This indirection is powerful for managing services.
  • MX (Mail Exchange) Record: This record specifies which mail servers are responsible for accepting email on behalf of your domain. It includes a priority value, which tells sending mail servers which server to try first (lower number = higher priority).

2. Practical Configuration

Configuring these records is typically done through the web interface of your domain registrar (the company where you bought the domain, like Namecheap, GoDaddy, or Route 53). While the UIs differ, the core concepts are the same.

The following video provides a practical walkthrough of adding these records in the Namecheap dashboard.

[New] How to Add DNS Records - A, CNAME, TXT, MX to point Namecheap Domain (Shopify, VPS, Hosting)

This video provides a clear, step-by-step demonstration of how to add A, CNAME, and MX records. Pay attention to the fields required for each record type.

Watch the following segments to see how each record is configured: A Record: 02:47 - 03:28 CNAME Record: 03:10 - 04:14 MX Record: 05:00 - 06:05 Notice the common fields: Host (the subdomain, or @ for the root domain), Value (the IP address, target hostname, or mail server), and Priority (for MX records).

The Architectural Advantage of CNAMEs

Your experience with system architecture will make the value of CNAMEs immediately apparent. An A record creates a tight coupling between a hostname and a specific IP address. If that IP changes (due to a server migration, load balancer update, etc.), you must update the DNS record.

A CNAME record introduces a layer of indirection. For instance, when using a Platform-as-a-Service (PaaS) like Heroku or a CDN like CloudFront, you often point your subdomain (e.g., app.mycompany.com) via a CNAME to a hostname managed by the provider (e.g., app-123.herokuapp.com). This decouples your domain from the provider's underlying infrastructure. The provider can change their server IPs freely, and as long as their hostname resolves correctly, your service continues to work without any DNS changes on your end.

This video explains this benefit well.

What is DNS? Setup for my domain? MX, CNAME, A Records Explained

This segment explains why a CNAME is often preferable to an A record from a maintenance and flexibility standpoint.

Watch from 06:48 to 07:41. The speaker clearly articulates the advantage of letting a third-party service manage the IP address behind a stable hostname.

3. Verifying DNS Propagation

After you save a DNS record change, it doesn't update instantly across the globe. The process of this change spreading through the internet's DNS resolvers is called propagation.

The speed of propagation is determined by the Time-To-Live (TTL) value of the previous record. Resolvers cache DNS records for the duration of their TTL. They will only request a new copy from the authoritative server after the cache expires. This can take anywhere from a few minutes to 48 hours.

There are two primary ways to check the status of your changes.

Method 1: Global Checkers (Visual)

Web-based tools provide a great visual overview of how your DNS record is resolving from different locations around the world. This is useful for getting a general sense of the propagation status.

[New] How to Add DNS Records - A, CNAME, TXT, MX to point Namecheap Domain (Shopify, VPS, Hosting)

Let's revisit the first video, which demonstrates using an online tool to verify a DNS change.

Watch the segment from 06:05 to 07:06. The presenter uses a tool (similar to whatsmydns.net) to check the A record for his domain from multiple geographic locations.

A popular tool for this is whatsmydns.net. You can enter your domain, select the record type (A, CNAME, MX, etc.), and see which IP or hostname is being returned by DNS servers worldwide.

Method 2: dig (Precise)

For a more precise and immediate check, the command-line tool dig is indispensable. Unlike web checkers, which query their own set of public resolvers, dig allows you to query any server directly, including the authoritative name server itself, bypassing any caching layers.

To use dig, you can run the following commands in your terminal:

  1. Check an A record:
    dig yourdomain.com A
    
  2. Check an MX record:
    dig yourdomain.com MX
    
  3. Check a CNAME record for a subdomain:
    dig www.yourdomain.com CNAME
    

In the output, look for the ANSWER SECTION. This will show you the record returned by the DNS server you queried (by default, your system's configured resolver).

To bypass your local resolver's cache and check what a public resolver like Google's (8.8.8.8) sees, you can specify it with @:

dig @8.8.8.8 yourdomain.com A

Even better, you can query your domain's authoritative name server directly to confirm the change has been saved correctly at the source, eliminating any doubt about propagation delays. First, find your authoritative name servers (NS records), then query one of them.

# 1. Find the authoritative name servers
dig yourdomain.com NS

# 2. Pick one of the servers from the answer (e.g., ns1.yourregistrar.com)
#    and query it directly for the A record.
dig @ns1.yourregistrar.com yourdomain.com A

This two-step process confirms that your configuration is correct at the source, even if propagation is still in progress.

Conclusion

In this lesson, we moved from the theory of DNS lookups to the practical application of configuring and verifying DNS records.

Key Takeaways:

  • A and AAAA records are the fundamental pointers that link hostnames to IPv4 and IPv6 addresses, respectively.
  • CNAME records provide a valuable layer of indirection, aliasing one hostname to another, which is critical when integrating with third-party services.
  • MX records are essential for email routing, directing mail to the correct servers with a priority system.
  • After configuring a record, you must verify its propagation. Visual tools like whatsmydns.net show global status, while dig offers precise, cache-bypassing checks against specific name servers.

Preview of the next lesson: We've mentioned Time-To-Live (TTL) as the mechanism controlling cache duration and propagation speed. In the next lesson, we will dive deep into configuring DNS TTL values and analyze the critical trade-offs between high availability (requiring fast changes) and cache performance (benefiting from longer TTLs).

Can't find a good explanation? Sign up and we'll make it for you

Sign up