Skip to main content
Back to Category

Pointing a Domain to a Server: A, AAAA and CNAME Guide

Point your domain to a server: A, AAAA, CNAME, MX and TXT record types, DNS propagation time, testing with dig/nslookup, and common mistakes.

Read time: 12 min Network & DNS
dnsdomain pointinga recordcnameaaaa recorddns recordsnameserverdns propagation

Table of Contents

Pointing a Domain to a Server: A, AAAA and CNAME Guide

After purchasing a domain, the most fundamental task is pointing it to your server's IP address. This is done through DNS (Domain Name System) records. In this guide, we'll cover A, AAAA, CNAME and other DNS record types, how to configure them, and common mistakes to avoid.

DNS Record Types

A Record (IPv4)

An A record maps a domain name to an IPv4 address. It's the most basic and commonly used DNS record.

example.com.    IN  A    203.0.113.50
www             IN  A    203.0.113.50
  • TTL (Time to Live): Specifies how long the record is cached in DNS resolvers. Typically set to 3600 (1 hour) or 86400 (1 day).
  • @ symbol: Represents the root domain (example.com).
  • Subdomains: You can create separate A records for subdomains like www, mail, api.

AAAA Record (IPv6)

The AAAA record is the IPv6 equivalent of the A record. Add this if your server has an IPv6 address.

example.com.    IN  AAAA  2001:db8::1
www             IN  AAAA  2001:db8::1

IPv6 support is increasingly widespread. Adding both A and AAAA records ensures your site is accessible over both IPv4 and IPv6.

CNAME Record (Canonical Name)

A CNAME record redirects one domain name to another domain name, using a hostname instead of an IP address.

www     IN  CNAME  example.com.
blog    IN  CNAME  example.com.
shop    IN  CNAME  store.example.com.

CNAME usage rules:

  • CNAME cannot be used for the root domain (@) — use an A record instead.
  • A domain with a CNAME record cannot have other record types (MX, A, etc.).
  • Avoid CNAME chains (CNAME → CNAME → A).

MX Record (Mail Exchange)

MX records specify the mail server for a domain. Required to receive email.

example.com.  IN  MX  10  mail.example.com.
example.com.  IN  MX  20  mail2.example.com.

The server with the lower priority value (10, 20) is tried first. Use a higher priority value for backup servers.

TXT Record

TXT records store text information about a domain. Used for SPF, DKIM, DMARC and domain verification.

example.com.  IN  TXT  "v=spf1 ip4:203.0.113.50 ~all"
example.com.  IN  TXT  "google-site-verification=abc123"

NS Record (Name Server)

NS records specify the authoritative DNS servers for a domain. Usually managed by your domain registrar.

example.com.  IN  NS  ns1.rexe.tr.
example.com.  IN  NS  ns2.rexe.tr.

Steps to Point a Domain to a Server

1. Find Your Server's IP Address

You can find your server's IP address in the REXE customer panel. Alternatively, connect via SSH and run:

hljs bash
# Get the server's external IP address
curl -s ifconfig.me
# or
ip addr show eth0 | grep 'inet ' | awk '{print $2}'

2. Access Your DNS Management Panel

Log in to the management panel of the registrar where you purchased your domain. Common registrars:

  • Namecheap: Advanced DNS → Add New Record
  • GoDaddy: DNS Management → Add Record
  • Cloudflare: DNS → Add Record

3. Create an A Record

Type:  A
Host:  @  (or leave blank — for root domain)
Value: 203.0.113.50  (your server's IP address)
TTL:   3600

For the www subdomain:

Type:  A
Host:  www
Value: 203.0.113.50
TTL:   3600

4. Optional: Add an AAAA Record

If your server has an IPv6 address:

Type:  AAAA
Host:  @
Value: 2001:db8::1  (your server's IPv6 address)
TTL:   3600

DNS Propagation Time

DNS changes don't take effect immediately. Propagation time depends on several factors:

  • TTL value: Old records remain cached until the old TTL expires.
  • ISP DNS caches: Internet service providers use their own caches.
  • Geographic location: Propagation happens at different speeds in different regions.

Typical propagation times:

  • Minimum: 15-30 minutes
  • Average: 2-4 hours
  • Maximum: 24-48 hours

Before making DNS changes, lower the TTL to 300 (5 minutes). You can raise it again after the change is complete. This significantly reduces propagation time.

DNS Testing

Testing with dig

dig (Domain Information Groper) is the most powerful tool for testing DNS queries.

hljs bash
# Query A record
dig example.com A

# Query AAAA record
dig example.com AAAA

# Query CNAME record
dig www.example.com CNAME

# Query MX record
dig example.com MX

# Query TXT record
dig example.com TXT

# Query a specific DNS server
dig @8.8.8.8 example.com A

# Short output
dig +short example.com A

# List all records
dig example.com ANY

Reading dig output:

;; ANSWER SECTION:
example.com.    3600    IN    A    203.0.113.50
  • 3600: TTL value (seconds)
  • IN: Internet class
  • A: Record type
  • 203.0.113.50: IP address

Testing with nslookup

nslookup is an alternative DNS testing tool available on Windows and Linux.

hljs bash
# Basic query
nslookup example.com

# Specific record type
nslookup -type=MX example.com
nslookup -type=TXT example.com

# Use a specific DNS server
nslookup example.com 8.8.8.8

# Interactive mode
nslookup
> server 8.8.8.8
> set type=A
> example.com

Online DNS Tools

  • whatsmydns.net: Checks DNS propagation from different geographic locations.
  • dnschecker.org: Shows DNS propagation status worldwide.
  • mxtoolbox.com: Tests MX, SPF, DKIM records.

Common Mistakes and Solutions

Mistake 1: Using CNAME on Root Domain

# WRONG
@    IN  CNAME  another-domain.com.

# CORRECT
@    IN  A      203.0.113.50

Mistake 2: Missing Trailing Dot

Fully qualified domain names in DNS records end with a dot. Without the dot, the domain name is appended to the current zone.

# WRONG (appended to zone: mail.example.com.example.com)
MX  10  mail.example.com

# CORRECT
MX  10  mail.example.com.

Mistake 3: Conflicting Records

Creating both A and CNAME records for the same hostname causes conflicts.

hljs bash
# Check existing records
dig www.example.com ANY

Mistake 4: High TTL Value

A high TTL value causes changes to propagate slowly. Lower the TTL before making changes.

hljs bash
# Check current TTL value
dig +nocmd example.com A +noall +answer

DNS Management with Cloudflare

Cloudflare offers free DNS management and CDN services. To move your domain to Cloudflare:

  1. Create a Cloudflare account and add your domain.
  2. Set Cloudflare's NS servers at your domain registrar.
  3. Manage A, CNAME and other records from the Cloudflare DNS panel.
hljs bash
# Check Cloudflare NS servers
dig example.com NS
# Output: ns1.cloudflare.com, ns2.cloudflare.com

When Cloudflare's proxy feature (orange cloud) is enabled, your real server IP is hidden. If SSL/TLS settings are not configured correctly, you may experience connection issues.

Conclusion

Domain pointing is the cornerstone of web infrastructure. Use A records for IPv4, AAAA for IPv6, and CNAME for alias redirects. DNS changes take time to propagate; test your changes with dig and nslookup. Proper TTL management and record type selection are critical for a smooth DNS experience.