IT
🌐

Complete DNS Setup Guide — From A Record vs CNAME Differences to Hands-On Configuration

If you are new to domain DNS settings, this one guide is all you need. Learn the differences between A records, CNAME, MX, and TXT records with step-by-step Cloudflare setup instructions.

Key Takeaways

person holding paper near pen

DNS in One Sentence

low angle photo city high rise buildings during daytime

DNS (Domain Name System) is the internet's phone book that translates human-readable domain names (e.g., millionscode.com) into computer-readable IP addresses (e.g., 104.21.32.55).

When you type a URL in your browser, a DNS query asks "What's the IP for this domain?" and connects to the returned IP address — all within milliseconds.

DNS Record Types Explained

person putting money business finance

A Record — Map Domain Directly to IP

The A record is the most fundamental DNS record, mapping a domain name to an IPv4 address.

Example: millionscode.com -> 104.21.32.55

When to use: Connecting domains to VPS/dedicated servers, or pointing root domains to specific IPs.

CNAME Record — Domain Alias to Another Domain

CNAME creates an alias that redirects one domain to another domain name (not an IP).

Example: www.millionscode.com -> millionscode.com

When to use: Connecting subdomains to PaaS services (Vercel, CF Pages, Netlify) or CDNs.

Important: Standard DNS does not allow CNAME on root domains (@). Cloudflare's CNAME Flattening bypasses this limitation.

MX Record — Email Server Routing

MX (Mail Exchange) records specify which mail server handles incoming email. Lower priority numbers are tried first.

TXT Record — Text-Based Verification

TXT records store text information for domain verification and email authentication (SPF, DKIM, Google Search Console verification, etc.).

Step-by-Step: DNS Setup on Cloudflare

Step 1: Change Nameservers

Update your domain registrar's nameservers to Cloudflare's. Propagation takes up to 24 hours (usually 1-2 hours).

Step 2: Add DNS Records

Add required records in the Cloudflare dashboard. Use our DNS Lookup tool to verify current settings.

Step 3: Configure SSL/TLS

Set Cloudflare SSL/TLS to Full (Strict) for automatic HTTPS — no separate SSL certificate purchase needed.

TTL Settings Guide

TTLMeaningRecommended For
300s (5 min)Very shortBefore/after DNS changes
3600s (1 hour)StandardNormal operation
86400s (24 hours)LongStable, no changes planned
AutoCloudflare managedProxied records

Tip: Lower TTL to 300s 24 hours before planned DNS changes for faster propagation.

Common Mistakes and Fixes

  1. 1www not working — Missing CNAME: www -> @
  2. 2Email not receiving — Missing MX records
  3. 3SSL certificate error — Mismatch between Cloudflare proxy and origin server SSL settings

FAQ

Q1. Should I use A record or CNAME?

A: Use A record for fixed server IPs. Use CNAME for PaaS connections (Vercel, CF Pages) or when the target IP may change.

Q2. How long until DNS changes take effect?

A: Depends on TTL — typically 5 minutes to 24 hours. Pre-lowering TTL to 300s enables 5-minute propagation.

Q3. Do I need to enable Cloudflare Proxy (orange cloud)?

A: Not required but recommended for DDoS protection, CDN caching, and automatic SSL.

Q4. Can I set a CNAME on the root domain?

A: Not in standard DNS, but Cloudflare's CNAME Flattening enables this for root domains.

Q5. Can wrong DNS settings take my site down?

A: Yes. Incorrect A record IPs or invalid CNAME targets make your site inaccessible. Always backup existing settings before changes.

Q6. How can I check my current DNS settings?

A: Enter your domain in our DNS Lookup tool to instantly view all A/CNAME/MX/TXT records.

🔧 Related Free Tools

Related Products[Ad/Affiliate]

As an Amazon Associate, Coupang Partner, and AliExpress affiliate, I earn from qualifying purchases at no extra cost to you.

Related Posts

BlogToolsPicksFinance