How to configure DNS records for a domain
· Category: Networking
Short answer
DNS records map domain names to IP addresses, mail servers, and verification strings. Configuring them correctly is essential for website availability, email delivery, and service authentication.
Steps
-
Log into your DNS provider: Access the management console for your domain registrar or third-party DNS host.
-
Add an A record: Point your root domain (@) or subdomain to an IPv4 address. For IPv6, use an AAAA record.
-
Add a CNAME record: Create aliases so subdomains like www point to your main domain or another hostname.
-
Configure MX records: Specify mail servers responsible for receiving email, prioritized by preference numbers.
-
Add TXT records: Include SPF, DKIM, and DMARC entries for email security, or verification strings for third-party services.
-
Set TTL values: Use short TTLs during migration for faster propagation, and longer TTLs for stability.
Tips
- Avoid CNAME conflicts at the root domain; use ALIAS or ANAME if your provider supports them.
- Always include a PTR record for mail servers to improve deliverability.
- Test changes with dig or nslookup before considering them final.
Common issues
- Typos in hostnames or IP addresses.
- Missing SPF records causing emails to land in spam.
- Long TTLs delaying critical changes.