How to Set Up DNS for Your Website: A Complete Guide

A Record, CNAME, MX, TXT — each record has a purpose. We cover DNS setup from scratch: domain pointing and email configuration.
What Is DNS?
The Domain Name System (DNS) is the internet's directory. When a user types an address like cloud.net.sa into their browser, the device needs to know the actual IP address of the server hosting the website. DNS translates the human-readable name into a number the internet understands.
Without DNS, no website would work unless you typed IP numbers directly. Understanding DNS setup is essential for anyone managing a website or server.
How DNS Works: The Full Path
- The user types cloud.net.sa in the browser
- The device queries the local DNS server (usually from the ISP)
- If the answer is not in cache, it queries a root DNS server
- The root server directs to the .sa server (Saudi domains)
- The .sa server directs to the domain's registered Nameservers
- The Nameservers respond with the actual IP address (e.g., 185.70.22.15)
- The browser connects to the IP address and displays the website
This process happens in under 100 milliseconds. But if DNS settings are wrong, nobody reaches your site.
Essential DNS Record Types
| Record Type | Function | Example |
|---|---|---|
| A | Maps domain to IPv4 address | cloud.net.sa → 185.70.22.15 |
| AAAA | Maps domain to IPv6 address | cloud.net.sa → 2001:db8::1 |
| CNAME | Points subdomain to another domain | www.cloud.net.sa → cloud.net.sa |
| MX | Specifies mail receiving servers | mail.cloud.net.sa (priority: 10) |
| TXT | Contains text for verification and security | v=spf1 include:_spf.google.com ~all |
| NS | Specifies authoritative name servers | ns1.cloud.net.sa, ns2.cloud.net.sa |
| SRV | Defines specific services on specific ports | _sip._tcp.cloud.net.sa |
| CAA | Specifies allowed SSL certificate authorities | letsencrypt.org |
Setting Up DNS for a New Website: Step by Step
1. Set the Nameservers
When you purchase hosting, the provider gives you Nameserver addresses (usually at least two). Enter them in the control panel of the registrar where you registered the domain.
2. Create an A Record
The A record points the root domain to the server's IP address:
- Host: @ (means the root domain)
- Type: A
- Value: Server IP address
- TTL: 3600 (one hour) or 300 (5 minutes for testing)
3. Create a CNAME Record for www
To point www.yourdomain.com to the root domain:
- Host: www
- Type: CNAME
- Value: yourdomain.com
4. Configure Mail Records (MX)
If you use business email:
- Host: @
- Type: MX
- Value: Mail server address
- Priority: 10 (for the primary server)
Add SPF, DKIM, and DMARC records to protect your email from spoofing and ensure delivery to the inbox.
5. Add Security Records
TXT records are essential for email security and service ownership verification:
- SPF: Defines which servers are allowed to send email on behalf of your domain
- DKIM: A digital signature proving the message was not altered during transit
- DMARC: Defines the policy for handling messages that fail SPF or DKIM checks
TTL: Cache Duration
TTL (Time To Live) determines how many seconds an intermediate DNS server keeps a record before refreshing it. Common values:
| Value | Duration | Use Case |
|---|---|---|
| 300 | 5 minutes | During changes and testing |
| 3600 | 1 hour | Normal operation |
| 86400 | 24 hours | Stable records |
Tip: Before changing DNS, lower the TTL to 300 seconds one day before the change. After the change is confirmed and working, set TTL back to 3600.
DNS Diagnostic Tools
- dig (command line): Advanced DNS lookup tool — dig cloud.net.sa A
- nslookup: Simple lookup tool available on Windows and Linux
- MXToolbox: Comprehensive DNS, MX, SPF, and DKIM checking
- DNS Checker: Verifies DNS propagation across servers worldwide
- Google Admin Toolbox: DNS diagnostic tools from Google
Common DNS Problems
| Problem | Symptoms | Solution |
|---|---|---|
| Slow DNS propagation | Site works from some locations but not others | Wait up to 48 hours — lower TTL beforehand |
| Incorrect A record | Site shows error page or wrong website | Verify the IP address in the A record |
| Nameservers not updated | Domain does not resolve | Update Nameservers at the registrar |
| Missing MX record | Email does not arrive | Create an MX record with correct settings |
| Incorrect SPF | Emails land in spam | Review SPF record and ensure your servers are included |
Best Practices
- Use at least two DNS servers (Primary + Secondary) for high availability
- Document all DNS records in an external file
- Do not change DNS and Nameservers at the same time
- Test changes with diagnostic tools before finalizing
- Monitor DNS records periodically to detect unauthorized modifications
Conclusion
DNS setup is a technical process, but it is not complicated once you understand the fundamentals. The four most important records: A for the website, CNAME for www, MX for email, and TXT for security. CLOUD (cloud.net.sa) provides full DNS management from a single control panel with technical support if you need help with setup.
Get Started
Want to try it yourself? Choose the right hosting plan or build your custom server with the specs you need.
