Technology

What Is DNS? A, CNAME and MX Records

We explain with examples how a domain name points to a server, the core DNS records such as A, CNAME, MX and TXT, and TTL and propagation time.

Aurora YazılımEditorial team 6 min read
What Is DNS? A, CNAME and MX Records
What is DNS?

DNS (Domain Name System) is a global address book that translates domain names into the IP addresses of servers. When you type yourcompany.com into the browser, DNS finds which IP address the server behind that name sits at. A and CNAME records are used for the website, MX for email, and TXT records for verification and security.

What Is DNS Used For?

Every server on the internet has a numeric IP address such as 203.0.113.10. Remembering these numbers is hard for people; DNS makes the internet usable by translating memorable domain names into them. Think of a phone book: you look up a name and get a number.

DNS does not only show the website. DNS records also carry which server mail should be delivered to, the codes that verify which services a domain belongs to, and email security policies. That is why a DNS error can take down your site, your email or both.

How Does a DNS Lookup Work?

When you type an address into the browser, a chain that takes milliseconds runs in the background. Because answers are cached at every step, most lookups finish without walking the whole chain.

  1. The browser and operating system first check their own cache.
  2. If there is no answer, the question goes to your internet provider's or your chosen resolver server.
  3. The resolver asks the root servers; the root servers point to the servers for the extension, such as .com or .tr.
  4. The extension's server reports the domain's authoritative nameservers.
  5. The authoritative nameserver returns the actual record (for example, the IP address); the resolver stores this answer for the specified time and passes it to the browser.

What Are DNS Records?

A domain's DNS records are kept in a zone file. Each record consists of a name, a type, a value and a TTL. The table below summarizes the most commonly used types.

RecordPurposeExample value
APoints a name to an IPv4 address203.0.113.10
AAAAPoints a name to an IPv6 address2001:db8::10
CNAMERedirects a name to another namewww → yourcompany.com
MXThe server mail is delivered to10 mail.yourcompany.com
TXTFree text: SPF, DKIM, verification codesv=spf1 include:... ~all
NSThe domain's authoritative nameserversns1.saglayici.com
CAAWhich authorities may issue SSL certificates0 issue letsencrypt.org
SRVThe server and port of a specific servicePhone and chat services

A and AAAA Records

The A record points the domain name to the IPv4 address of the server hosting the site and is the core record of a website. The AAAA record does the same job for an IPv6 address. This is usually the record you need to update when you change hosting.

What Is a CNAME?

A CNAME points a name to another domain name instead of an IP. It is used to redirect www.yourcompany.com to yourcompany.com, or to point a store subdomain to the address given by your service provider. Even if the target's IP changes, you don't need to update the CNAME.

An important rule: a CNAME cannot be used on the root domain (yourcompany.com), and a name that has a CNAME cannot have any other record. Some DNS providers get around this limit with features such as ALIAS or CNAME flattening.

MX Record

The MX record tells which server email sent to your domain should be delivered to. The server with the lower priority number in front is tried first. A wrong or missing MX record causes email not to arrive even though the site works; we described the setup steps in our business email setup article.

TXT Record

TXT records carry free text that machines read. Domain verification for Google Search Console or your email provider, the SPF sender list, the DKIM signing key and the DMARC policy are all defined with these records.

An Example DNS Zone

The DNS zone of a typical business website looks like the one below. The site runs on one server and email at another provider, and the two do not affect each other. The IP addresses in the example come from ranges reserved for documentation. Preparing this table before launch in a new web design project makes migration day smooth.

textyourcompany.com zone
firmaniz.com.        3600  IN  A      203.0.113.10
firmaniz.com.        3600  IN  AAAA   2001:db8::10
www.firmaniz.com.    3600  IN  CNAME  firmaniz.com.
firmaniz.com.        3600  IN  MX     10 mail.firmaniz.com.
mail.firmaniz.com.   3600  IN  A      203.0.113.20
firmaniz.com.        3600  IN  TXT    v=spf1 mx ~all
firmaniz.com.        3600  IN  CAA    0 issue letsencrypt.org

TTL and DNS Propagation

TTL (Time To Live) specifies how many seconds a record will be cached by resolvers. A value of 3600 means one hour. When the TTL is long, queries are answered quickly and the load on nameservers drops; but a change you make also won't reach everyone until that time is up.

The waiting period commonly called DNS propagation is really just these caches expiring. When you change an A record, some visitors see the new server right away, while others keep going to the old server until the old TTL runs out. For nameserver changes the time can be longer, because the extension servers' cache also comes into play.

TTL Tip Before Migrating

A day before changing servers, lower the TTL of the relevant records to a short value such as 300 seconds. When you update the record on migration day, the change spreads within minutes; once everything goes well, return the TTL to its old value. For the whole server migration process, see our hosting migration guide.

How to Look Up DNS Records

You can check from the command line how a record looks to the world. nslookup comes ready on Windows, and dig on macOS and Linux. Querying a specific resolver avoids mistakes caused by the local cache.

powershellWindows
nslookup firmaniz.com
nslookup -type=MX firmaniz.com
nslookup -type=TXT firmaniz.com 1.1.1.1
ipconfig /flushdns
bashmacOS / Linux
dig +short A firmaniz.com
dig +short MX firmaniz.com
dig +short NS firmaniz.com
dig @8.8.8.8 +short TXT firmaniz.com

DNS and Site Speed

On every new visit, the browser's first job is a DNS lookup; a slow nameserver adds delay before the page even starts loading. DNS providers with a global network shorten this time by answering queries from a point close to the visitor.

Every font, script or image called from a different domain on a page means an extra DNS lookup. Reducing third-party resources and using preconnect hints for the necessary ones deliver small but measurable gains in speed and performance optimization work.

Common DNS Mistakes

DNS settings are especially important in industry software that runs on subdomains, such as reservation, listing or order systems; the panel, the API and the website must each point to the right record. When launching a new corporate website, listing and keeping these records will make your life easier later.

  • Changing records in a panel that is not authoritative: if the nameservers point elsewhere, the change has no effect.
  • Forgetting the MX records when moving hosting: the site works but email stops.
  • Trying to add a CNAME to the root domain.
  • Creating more than one SPF record; there must be only one SPF per domain.
  • Not backing up the old DNS zone during a domain transfer; details in our domain transfer article.
  • Not using two-step verification on the management panel account; if the DNS panel is taken over, all traffic can be redirected elsewhere.

Frequently Asked Questions

01How long does a DNS change take to take effect?

Record changes usually propagate within minutes to a few hours; the previous TTL value determines the time. For nameserver changes it can stretch to 24–48 hours. If you still see the old result on your own computer, clear the local cache and query with a different resolver.

02Should I use a free public DNS resolver?

Using public resolvers such as Cloudflare (1.1.1.1) or Google (8.8.8.8) on your computer or router can give faster and more consistent answers in some cases. This setting affects only your own queries; it has nothing to do with where your site's DNS records are hosted.

03What is DNSSEC, and should I enable it?

DNSSEC verifies DNS responses with a digital signature, making it harder to inject forged answers. If both your registrar and your DNS provider support it, enabling it improves security. Remember to turn it off before changing nameservers; otherwise the domain may fail to resolve.

DNS is the invisible layer that connects your domain to your site, your email and every service you use; knowing a few core records lets you solve most problems in minutes. To speed up your site's infrastructure end to end, explore our speed and performance optimization service, and for applications built for your business, our software solutions; if you need help with DNS settings, contact us.