How to Setup DNS
About to configure the DNS for your website or email server? You have landed at just the right place. In this guide, you’ll learn a simple and straightforward way to set up DNS directly from your dashboard. Even if you have no prior experience, the steps are easy to follow and will help you get things up and running quickly.
Before you get started, if you’d like a deeper dive into the world of DNS, check out our detailed blog on “What is DNS”.
Table of Contents
What You Need Before Setting Up DNS
Here are the prerequisites of setting up a DNS:
- A registered domain name: You’ll need an active domain that you own or manage.
- Access to DNS settings: You must be able to access the DNS settings in your hosting provider or domain registrar account.
- IP Address of your web server: This is where your domain will point, so you’ll need the correct IP address from your web hosting provider.
- Nameservers information: If you’re using third-party DNS hosting, you’ll need the nameservers provided by that service.
- Email server details (optional): If you’re setting up email for your domain, gather the mail server information, such as MX records.
- DNS record information: For every DNS record you create, you’ll need to know:
- Record type (The type of DNS record)
- Host name (The subdomain or hostname)
- Points to (The IP address or domain name the record should point to)
- TTL (Time to Live, i.e. the amount of time before a DNS client should query the server again for the same record)
Steps to Setup DNS
With the prerequisites sorted, we’ll now turn to the business end of this guide: how to setup DNS. This section will provide a detailed and easy-to-follow walkthrough of the entire process.
Find Your Domain Registrar or Hosting Provider
First up, you need to locate where your domain is registered or hosted. Here’s how you can do that:
- Check your email: Look for the confirmation email from when you purchased your domain. This will usually include details about your domain registrar.
- Use WHOIS lookup: If you’re unsure where your domain is registered, use a WHOIS lookup tool. It will display the domain registrar and contact information.
- Log into your hosting provider account: If your domain is managed through your hosting provider, sign in and navigate to the “My Domains” or “DNS Settings” section. For example, here’s how the “My Domains” section looks like on HOSTAFRICA:
Access the DNS Management Dashboard
Next, you need to access the DNS management area:
- Visit the website of your domain registrar or hosting provider and sign in with your credentials.
- Look for a section like “Manage Domains”, “Domain Management”, “DNS Settings”, or something similar, depending on your provider.
- Here, you should be able to update information as needed. For example, here’s a screenshot from HOSTAFRICA’s “DNS Manager” section:
Understanding DNS Records
As you learn how to setup DNS, you’ll come across different types of records that control how your domain connects to several services. Here’s a quick overview of the most common ones:
- A Record: This points your domain to an IP address. It’s used to connect your domain name to your website’s server.
- CNAME Record: This redirects one domain to another. For example, you may use it to send “www.yourdomain.com” to “yourdomain.com.”
- MX Record: This is for email. It tells email servers where to deliver messages sent to your domain.
- TXT Record: These are used for verifying domain ownership or improving security, such as for email authentication.
Adding A and CNAME Records
Here are the steps you need to follow to add A records:
- Navigate to the “DNS Manager” dashboard.
- Select the zone where you want to add or modify records. There should be a way to open the zone for editing. See the following screenshot from the HOSTAFRICA dashboard as an example.
- Once you have opened the DNS zone for editing, you should see an interface that allows you to add new records.
- Choose to add a new record and then select “A” from the drop-down menu of record types.
- Enter the host name. Typically, you will use “@” to represent your main domain (e.g., “yourdomain.com”) or specify a subdomain if needed.
- Add the IP address of your web server where the domain should point.
- Leave this at the default value unless your provider specifies otherwise.
- Double-check the information, and click “Save” to update the record.
For CNAME records, follow these steps:
- Choose “CNAME” from the list of record types.
- Enter the alias. For example, enter “www” to make “www.yourdomain.com” redirect to “yourdomain.com.”
- Add the domain name to which the alias should point, such as “yourdomain.com.”
- Again, leave the TTL at the default setting unless instructed otherwise.
- Make sure everything is accurate and save your CNAME record.
A note on accuracy:
Be sure to enter everything correctly, especially the IP addresses and domain names. A single typo can prevent your site or services from working properly. Always double-check before saving.
Setting Up MX Records for Email
MX (Mail Exchange) records are used to direct emails sent to your domain to the correct mail servers. Be careful while setting these up, because a mistake can lead to lost emails or failed deliveries. Here are the steps:
- In your DNS settings, find the section to add a new record, similar to how you added A and CNAME records.
- Choose “MX” from the list of available record types.
- You should now be prompted to enter the mail server info:
- Hostname: You’ll typically leave this blank or use “@” to represent your main domain.
- Mail server address: Here, you should enter the mail server provided by your email hosting service. For example: “mail.yourdomain.com”
- Set the priority. A lower number indicates a higher priority. Typically, the first MX record should have a priority of 1, and subsequent records should have higher priorities.
- Leave the TTL at the default setting unless your provider suggests otherwise.
- Double check that everything is in order and then save.
Adding TXT Records for Verification
TXT records are often used to verify domain ownership or enhance security, especially when setting up services like Google Workspace or Microsoft 365. Here’s how to go about adding them:
- Log in to the cPanel dashboard associated with your account.
- From the search bar, look up “zone editor”
- Find the domain for which you want to add records, and click the “Manage” button. You should now see all the DNS records associated with your domain.
- Click the “Add Record” button.
- From the drop-down menu, select “TXT” as the record type.
- You can either leave the “Name” field blank, use “@” for the main domain, or specify a subdomain.
- In the “Record” field, paste the verification code or text string provided by the service you’re setting up (e.g., Google Workspace, Microsoft 365).
- You can leave the default value for TTL unless you’re instructed to use a specific time.
- Double-check the information, then click “Add Record” to save your TXT record.
Propagating DNS Changes
When you make changes to your DNS settings, it can take some time for these updates to be reflected on DNS servers across the world. This process, known as DNS propagation, can take up to 24-48 hours to complete.
Why does it take time?
There are two reasons:
- Caching: DNS servers cache information to speed up the resolution process. When changes are made, these caches need to be updated, which can vary by server.
- Global spread: Your DNS changes need to be communicated to servers globally, and the speed at which this happens can differ.
How to track DNS propagation?
Here are a couple tools that you can use to check DNS propagation:
- WhatsMyDNS: Enter your domain and record type to see how the changes are propagating across different locations worldwide.
- DNS Checker: Provides a similar service, allowing you to check DNS propagation from multiple servers around the globe.
Common DNS Setup Mistakes to Avoid
It’s easy to make mistakes while configuring DNS, especially if you are still learning how to setup DNS. Here are some common errors and how to avoid them:
Entering incorrect IP addresses
Mistake: If you use the wrong IP address while creating A records, it can cause your site to become unreachable.
Avoid: Double-check the IP address provided by your hosting service and enter it correctly.
Misconfiguring records
Mistake: If you misconfigure CNAME, MX, or TXT records, it can cause issues with email delivery or domain verification.
Avoid: Follow the exact aforementioned instructions along with platform-specific advice from your service provider. Use correct values and don’t forget to check for typos.
Forgetting to update TTL
Mistake: Too high a TTL value can delay the propagation of your changes.
Avoid: Set a lower TTL value if you’re making frequent changes. You can increase it later once changes are confirmed.
Overlooking record priorities
Mistake: Incorrect priority settings for MX records can affect email routing.
Avoid: Make sure that you set the correct priority numbers as specified by your email service provider.
Not saving changes
Mistake: Forgetting to hit save after making changes can result in no updates being applied.
Avoid: Always confirm and save your changes before exiting the DNS management dashboard.
Selecting the wrong record type
Mistake: Choosing the wrong type of record (e.g., adding an A record when a CNAME is needed) can cause functionality issues.
Avoid: Verify the type of record you need based on the instructions provided by your hosting or email service, and make sure you select the right one from the dropdown.
Testing and Verifying Your DNS Setup
After setting up DNS, it’s important to verify that everything is configured correctly. Here are some tools that you can use for this:
WhatsMyDNS
- Go to the website.
- Enter your domain name in the search box.
- Select the type of DNS record you want to check (e.g., A, CNAME, MX).
- Click “Search” to see if your changes have propagated globally.
DNS Checker
- Visit the site.
- Enter your domain name and select the record type.
- Click “Search” to check the status from multiple locations around the world.
MXToolbox
- Navigate to the website.
- Enter your domain name and choose “DNS Lookup” from the dropdown.
- Click the “DNS Lookup” button to see the results.
How to Update DNS in the Future
DNS configurations aren’t a one-time task. As your online needs change, you may need to update your DNS settings to reflect new requirements. Here are some common scenarios where a DNS refresh is often necessary:
- Website migration: If you move your website to a new hosting provider, you’ll need to update the A record with the IP address of the new server.
- Adding subdomains: To create subdomains (e.g., blog.yourdomain.com), you’ll need to add new CNAME or A records pointing to the appropriate destination(s).
- Changing email providers: If you switch email services, you will have to update your MX records with the information of the new mail servers.
- Security updates: Sometimes, DNS records need to be updated to address security vulnerabilities or implement new security measures.
How to update DNS records?
Here are the steps you’d follow to update your DNS configurations:
- Access the DNS management dashboard through your domain registrar or hosting provider.
- Find the records you need to update (e.g., A, CNAME, MX).
- Click the record you want to modify and update the necessary information (e.g., new IP address, new mail server).
- Hit save to apply the changes.
- Use DNS checking tools to verify that the updates are propagating correctly.
Conclusion
A properly configured DNS setup is crucial for the availability and smooth functioning of your online ecosystem. We hope that you found this guide easy to follow, and that you’re now equipped with the knowledge and skills to manage your DNS setup with confidence. If ever you need to find out more information regarding any domain, don’t forget to try out HOSTAFRICA’s WHOIS lookup tool.