DNS Records Guide
Hosting Guide

DNS Records Guide: What Are Nameserver, A, CNAME, MX and TXT Records?

The DNS records needed to point your domain to hosting or a server: nameserver, A, AAAA, CNAME, MX, TXT (SPF, DKIM, DMARC) and propagation time.

  • MerkezHost Technical Team
  • 6 min read
  • Level: Starter
  • Updated:

You've bought your domain and your hosting or server is ready, but the site won't open or emails aren't arriving. The cause is almost always the DNS settings. In this guide we explain step by step how DNS works, the most commonly used record types, and how to point your domain correctly to hosting or a VDS.

What is DNS and how does it work?

DNS (Domain Name System) is the phone book of the internet. When you type merkezhost.com into your browser, your computer first asks the DNS servers "what is the IP address of this domain?" and then connects to the IP address it receives. The answer to this query is determined by the records defined on your domain's authoritative DNS servers (nameservers).

Nameserver (NS) records

Nameservers determine on which server your domain's DNS records are kept. They are changed in the control panel of the company you bought the domain from. You have two options:

  • Use the hosting company's nameservers: All DNS management happens on the hosting side; you edit records in cPanel with the "Zone Editor". This is the easiest way for beginners.
  • Use external DNS (e.g. Cloudflare): You point the nameservers to Cloudflare and send traffic to your hosting or server with A and MX records. For details, see our Cloudflare setup guide.
Warning

When you change nameservers, all records at the old DNS provider (including MX and TXT) stop being used. Before switching, make sure you have added your email records in particular to the new provider.

A and AAAA records

An A record links a domain to an IPv4 address, and an AAAA record to an IPv6 address. This is the basic record for pointing your site to a VDS.

NameTypeValueDescription
@A203.0.113.10Root domain (alanadiniz.com)
panelA203.0.113.10The panel.alanadiniz.com subdomain

CNAME records

A CNAME points a name to another domain name instead of an IP. Its most common use is linking the www subdomain to the root domain:

NameTypeValue
wwwCNAMEalanadiniz.com
Rule

A CNAME cannot be defined for the root domain (@), and a name that has a CNAME cannot have any other records (MX, TXT). Always use an A record for the root.

MX records: where should email go?

An MX (Mail Exchanger) record determines which server emails sent to your domain are delivered to. The server with the lowest priority value is tried first.

NameTypePriorityValue
@MX0mail.alanadiniz.com

The mail.alanadiniz.com name that the MX record points to must also have an A record. If you use email through a service such as Google Workspace or Microsoft 365, enter the MX values they provide.

TXT records: SPF, DKIM and DMARC

TXT records contain free text and today are mostly used for email security and domain verification. If these three records are missing, the emails you send will very likely end up in spam.

  • SPF: Specifies which servers may send email on behalf of your domain. Example: v=spf1 +a +mx include:_spf.example.com ~all
  • DKIM: Adds a digital signature to outgoing emails. The public key is published as a TXT record under a name such as default._domainkey. cPanel creates this record automatically.
  • DMARC: Tells receivers what to do with emails that fail SPF/DKIM checks. To start with: v=DMARC1; p=none; rua=mailto:[email protected] under the name _dmarc
The single-SPF rule

A domain can have only one SPF record. If you use several services, combine the include: mechanisms in a single record; two separate SPF records invalidate both.

Other record types

  • CAA: Restricts which certificate authorities may issue SSL certificates for your domain.
  • SRV: Defines the port and server for specific services (e.g. some game servers, VoIP).
  • PTR (reverse DNS): Resolves an IP address to a domain name; it is important for anyone running their own mail server and is set by the owner of the IP (your server provider).

TTL and propagation time

TTL (Time To Live) specifies, in seconds, how long a record is cached by DNS servers. A value of 3600 means a change may take up to an hour to become visible worldwide.

Migration tip

If you plan to change servers, lower the TTL of the relevant A record to 300 (5 minutes) a day in advance. When you enter the new IP at cutover time, your visitors will reach the new server within minutes.

Checking DNS records

You can check from the command line whether your changes have propagated:

# Linux / macOS
dig alanadiniz.com A +short
dig alanadiniz.com MX +short
dig alanadiniz.com NS +short

# Windows (PowerShell / CMD)
nslookup -type=A alanadiniz.com
nslookup -type=MX alanadiniz.com 8.8.8.8

Common mistakes

  • Forgetting to add email records to the new provider after changing nameservers.
  • Having an A record for the root domain but not creating the www record (the www address won't open).
  • Creating two separate SPF records.
  • Routing the mail subdomain through the proxy (orange cloud) when using Cloudflare.

Conclusion

Setting up DNS correctly is the foundation for your site and email working smoothly. On MerkezHost cPanel hosting plans, web, email, SPF and DKIM records are created automatically as soon as you point your domain to our nameservers. Next, to set up your business email, take a look at our business email guide.

Frequently Asked Questions

How long does a DNS change take to propagate?

Depending on the records' TTL values, changes usually propagate within a few minutes to a few hours. For nameserver changes, this can take up to 24-48 hours.

Should I change nameservers or add an A record?

If you want to leave all DNS management to your hosting company, change the nameservers. If you want to keep your DNS elsewhere, such as Cloudflare, just update the A and MX records.

Should both the www and non-www addresses work?

Yes. It's recommended to create an A record for the root domain and a CNAME record for www pointing to the root domain, then redirect one to the other on the server.

  • #dns
  • #nameserver
  • #a record
  • #mx record
  • #spf
  • #domain name
Share:
Read More

Related Guides