DNS Configuration Tutorial: From Basics to Advanced Setup
10 min readNameProbe
## How DNS Works
The Domain Name System (DNS) is like the internet's phone book. It translates human-readable domain names (like example.com) into IP addresses (like 93.184.216.34) that computers use to communicate.
## Essential DNS Record Types
### A Record
Maps a domain name to an IPv4 address. This is the most fundamental DNS record.
```
example.com. A 93.184.216.34
```
### AAAA Record
Maps a domain name to an IPv6 address.
```
example.com. AAAA 2606:2800:220:1:248:1893:25c8:1946
```
### CNAME Record
Creates an alias from one domain to another. Cannot be used on the root domain (use A record instead).
```
www.example.com. CNAME example.com.
```
### MX Record
Directs email to the correct mail server. The priority number determines the order of preference.
```
example.com. MX 10 mail.example.com.
example.com. MX 20 backup.example.com.
```
### TXT Record
Stores text data, commonly used for email verification (SPF, DKIM, DMARC) and domain ownership verification.
```
example.com. TXT "v=spf1 include:_spf.google.com ~all"
```
### NS Record
Specifies the authoritative nameservers for a domain.
```
example.com. NS ns1.example.com.
example.com. NS ns2.example.com.
```
## Common Configuration Scenarios
### Pointing to a Web Server
Set an A record for your root domain and a CNAME for www:
- example.com → A → Your server IP
- www.example.com → CNAME → example.com
### Setting Up Email
Add MX records pointing to your email provider:
- For Google Workspace: MX priorities 1, 5, 5, 10, 10
- For Microsoft 365: single MX record to your tenant
### Verifying Domain Ownership
Add a TXT record with the verification code provided by the service (Google, Microsoft, etc.).
## TTL (Time to Live)
TTL determines how long DNS records are cached. Lower TTL values mean changes propagate faster but increase DNS query load. Recommended values:
- **300 seconds (5 min)** — When making changes
- **3600 seconds (1 hour)** — For stable records
- **86400 seconds (24 hours)** — For rarely changing records
## Troubleshooting
Use tools like NameProbe's DNS lookup, dig, or nslookup to verify your DNS configuration. DNS changes can take up to 48 hours to propagate globally, though most changes are visible within minutes.