DNS records are the beating heart of the domain name system and without them no domain can connect to a server, email or other services. When you register a domain, you need to set up a set of DNS records correctly in order for the site to come up or the corporate email to work. In this comprehensive guide, we explain in simple terms what DNS records are, what their important types, such as A, CNAME, MX, and TXT, do, and how to configure each to keep your services running smoothly.
What is DNS and how does it work?
DNS stands for Domain Name System; A system that translates readable domain names into numeric IP addresses. When a user types the address of your site in the browser, the browser first asks the DNS servers which IP address this domain refers to. By checking the domain records, the DNS server returns the correct address and the browser fetches the content from that server. This process is done in a fraction of a second.
Each domain has a zone where all its DNS records are kept. These records specify where to direct web traffic, email, subdomains, and authentication services. Proper management of these records is critical to the proper functioning of the site and email.
مفهوم TTL در رکوردهای DNS
In each DNS record, there is a value called TTL or Time To Live, which is expressed in seconds. TTL determines how long servers and browsers keep record information in temporary memory (cache). A lower value causes changes to take effect faster, but puts more load on the DNS server. A higher value improves response speed, but changes are slower to apply. A common value is 3,600 seconds (one hour).
The main types of DNS records
There are different types of DNS records, each of which has a specific purpose. The following table lists the most important records that every site administrator should know:
| Record type | Application | Example value |
|---|---|---|
| A | Bind domain to IPv4 address | 185.192.112.45 |
| AAAA | Bind domain to IPv6 address | 2a01:4f8::1 |
| CNAME | Introducing an alias for another domain | rapidoserver.com |
| MX | تعیین سرور دریافت ایمیل | mail.rapidoserver.com |
| TXT | Storing textual information and confirmations | v=spf1 include:... |
| NS | Introduction of domain servers | ns1.rapidoserver.com |
A and AAAA records
The A record is the most commonly used DNS record and binds a domain or subdomain to a version 4 IP address. Every time you want your site to go up on a specific server, you use an A record. The AAAA record does the same thing but for version 6 IP addresses. Example of setting these two records:
Type Name Value TTL
A @ 185.192.112.45 3600
A www 185.192.112.45 3600
AAAA @ 2a01:4f8:1c:2::1 3600
Here the @ symbol refers to the main domain itself and www is the common subdomain for the site. If your server only has IP version 4, no AAAA record is needed.
CNAME record
A CNAME or Canonical Name record creates an alias and points a domain to another domain instead of an IP. This record is useful when you want multiple subdomains to always point to the same root destination; For example, if the server IP changes, just change the A record of the main domain and all CNAMEs will be updated automatically.
Type Name Value TTL
CNAME blog rapidoserver.com 3600
CNAME shop rapidoserver.com 3600
Important note: According to the standard, you cannot define a CNAME record for the root (root or @) domain. A CNAME record is only allowed for subdomains and must not be placed at the same time as other records on the same name.
Email records
In order for corporate email to work on your domain, you need to set up a few specific records. Without these records, outgoing emails may end up in the spam folder or not be delivered at all.
MX record
The MX or Mail Exchange record specifies to which server emails sent to your domain should be delivered. Each MX record has a priority value; A smaller number is a higher priority. If you have multiple email servers, the server with the lowest priority number is tried first:
Type Name Priority Value TTL
MX @ 10 mail.rapidoserver.com 3600
MX @ 20 mail2.rapidoserver.com 3600
TXT record for email verification
The TXT record is used to store textual information, and its most important use is authentication and email security. Three common standards implemented with TXT records are SPF, DKIM, and DMARC. These help recipient servers recognize that the email is indeed from your domain and is not spoofed:
Type Name Value
TXT @ v=spf1 include:_spf.rapidoserver.com ~all
TXT _dmarc v=DMARC1; p=quarantine; rua=mailto:admin@rapidoserver.com
TXT default._domainkey v=DKIM1; k=rsa; p=MIGfMA0GCSq...
The TXT record is also used to verify domain ownership in various services such as Google Tools; In this case, you will be given a unique string that you will record as a TXT record to verify domain ownership.
NS records and DNS management transfers
NS or Name Server records specify which servers manage your domain's DNS records. When you register a domain, the registrar assigns it a set of default servers. If you want to outsource DNS management to another service (for example, a CDN service or cloud panel), you need to change the domain servers in the registrar panel.
Changing the server is a sensitive operation; Because until the changes are fully published, your site and email may be disrupted. After changing the NS, all A, CNAME, MX and TXT records must be redefined in the new admin panel, otherwise the services will fail.
Recommendation: Before switching servers, make a backup copy of all your current records so that you can restore everything exactly in the new panel.
Troubleshoot and propagate DNS changes
One thing that confuses novice users is the delay in applying DNS changes. When you change a record, the change is not immediately visible everywhere in the world; Because different servers keep the previous result in the cache until the end of the TTL time. This process is called propagation and may take from a few minutes to a few hours.
You can use command line tools to check the status of the records. For example, the following command displays the A record of a domain:
dig rapidoserver.com A +short
nslookup -type=MX rapidoserver.com
If you still don't see a new record after enough time, a high TTL value, a mistake in typing the record value, or setting the record in the wrong panel (instead of the active half-server panel) are common reasons. If you want to raise your site on a stable infrastructure, you can also benefit from domain registration a suitable virtual server purchase to integrate DNS management and hosting.
Additional and other useful records
In addition to the main records, there are some other records that are very useful in certain situations. Getting to know them will help you set up more advanced services on your domain.
SRV record
The SRV or Service record is used to indicate the location of specific services such as messaging servers, Internet telephony, or specific network services. In addition to the destination, this record also specifies the port number and service priority and is used in protocols such as SIP or XMPP. Its structure is more complex than normal records and includes service name, protocol, priority, weight and port.
Reverse PTR and DNS records
The PTR record works the opposite of the A record; That is, it translates an IP address to a domain name. This is called reverse DNS and is more important for email servers. Many receiving servers treat or reject email whose sender IP does not have a valid PTR record. Setting the PTR record is usually done through the server provider, not the domain's regular panel.
CAA record
The CAA or Certification Authority Authorization record specifies which certificate authorities are authorized to issue SSL certificates for your domain. This record provides an additional layer of security and prevents unauthorized authorities from issuing certificates for your domain. An example is as follows:
Type Name Value
CAA @ 0 issue "letsencrypt.org"
DNS management best practices
Correct management of DNS records not only makes services work better, but also increases the security and stability of your site. Following a few simple principles can prevent many common problems.
- Keep a backup: Always have a text backup of all your DNS records so you can quickly restore if something goes wrong.
- Logical TTL setting: Choose a high TTL for records that rarely change and a low TTL for those that you intend to change.
- Delete Unused Records: Delete old and unused records, as they can create an attack path or confusion.
- Documentation of changes: Make a note of any important changes in DNS along with the date and reason so that it can be tracked in the future.
Security tip: Enabling DNSSEC is an additional layer of security that prevents tampering and falsification of DNS responses by digitally signing records, and is recommended to be enabled for important domains.
DNS monitoring and checking tools
For professional DNS management, it is best to check the status of records regularly. In addition to the command line commands such as dig and nslookup that were introduced earlier, there are also several online tools that show the status of publishing records in different parts of the world. These tools are especially useful when migrating a server or changing a server.
To fully check all the records of a domain, you can use the following command, which displays all types of records at once:
dig rapidoserver.com ANY
dig +trace rapidoserver.com
دستور trace مسیر کامل حل نام دامنه را از سرورهای ریشه تا نیمسرور نهایی نشان میدهد و برای عیبیابی مشکلات پیچیده DNS بسیار ارزشمند است. اگر میخواهید مدیریت DNS و میزبانی خود را یکپارچه کنید، تهیه خرید سرور مجازی در کنار مدیریت دامنه گزینه مناسبی است. برای مطالعه بیشتر به مقالات رپیدو سرور مراجعه کنید.
Private DNS vs Public DNS
When managing a domain, you may be faced with a choice between using the registrar's DNS servers or an independent DNS service. Each approach has its advantages. Using the registrar's default DNS is simple and sufficient for most small sites; Everything is managed in one panel and there is no need for additional settings.
In contrast, specialized and independent DNS services offer features such as higher response speed, a global network of servers, load balancing, attack protection, and accurate statistics. For high-traffic sites or businesses where stability is critical, using a professional DNS service can make a noticeable difference in speed and stability. Choosing between the two depends on the scale and needs of your project.
The important thing is that in either case, the original A, CNAME, MX, and TXT records must be set correctly. The difference is only in the place of management and peripherals, not in the nature of the records. Therefore, a thorough understanding of the record types discussed in this article is essential, regardless of which DNS service you use, and is the foundation of successful domain management.
Frequently asked questions
What is the difference between A record and CNAME?
An A record links a domain directly to an IP address, but a CNAME record points the domain to another domain. The A record is used for the main domain and the CNAME is usually used for subdomains that should follow the same main destination.
Why are my emails going to spam?
One of the most common reasons is missing or incorrect SPF, DKIM, and DMARC records, all of which are set by the TXT record. These records confirm the identity of the sending server, and their absence makes the receiving servers untrustworthy.
How long do DNS changes take to take effect?
Depending on the record's TTL value, changes can take anywhere from a few minutes to a few hours to propagate. If you set the TTL to a low value before the change, the changes will be seen faster across the network.
Can I have multiple A records for one domain?
Yes, you can define multiple A records with different IPs for the same name. In this case, requests are distributed between servers, which is a simple load balancing, although specialized services are usually used for professional distribution.



