There are a lot of DNS records out there – and you may be wondering, “WAIT! What is the DNS records’ role in all of this?!” That is a very good question. DNS records basically act as instructions within each DNS server; for example, ‘A records’ are behind what we know DNS to do – connect IP addresses to domain names! DNS records are written in .TXT files. All DNS records also have a ‘TTL’, which stands for time-to-live, and indicates how often a DNS server will refresh that record.
TYPES OF DNS RECORDS
A Records: Address records, or A records, are the most common DNS records used. They create a direct connection between an IPv4 address and a domain name.
The “@” symbol in this example indicates that this is a record for the root domain, and the “14400” value is the TTL (time to live), listed in seconds. The default TTL for A records is 14,400 seconds. This means that if an A record gets updated, it takes 240 minutes (14,400 seconds) to take effect. A records are for IPv4; AAAA records are for IPv6 – it works the same way.
CNAME Records: CNAME (Canonical Name) records are used to create aliases for domain names, allowing multiple domain names to resolve to the same IP address. For example, instead of creating two A records for www.example.com and product.example.com, you could link product.example.com to a CNAME record that is then linked to an A record for example.com. The value is that if the IP address changes for the root domain, only the A record will have to be updated and the CNAME will update accordingly.
All CNAME records must point to a domain, never to an IP address. If a CNAME were allowed to point directly to an IP address, it would conflict with this process. A CNAME is meant to provide an alias for a domain name, not for an IP address. Allowing CNAMEs to point directly to IP addresses could lead to inconsistencies and complications in DNS resolution.
NS Records: NS stands for ‘nameserver,’ and the nameserver record indicates which DNS server is authoritative for that domain (i.e. which server contains the actual DNS records). Authoritative nameservers contain the final information about a specific domain and its corresponding IP address. When a DNS resolver needs to resolve a domain name to an IP address, it queries the authoritative name servers specified in the NS records for that domain. An NS record points to all of the different records your domain holds. Without NS records, no one would be able to access your website!
NS records can never point to a CNAME record.
NS records are used to delegate authority for subdomains. For example, if you own the domain example.com and want to delegate authority for a subdomain (e.g., subdomain.example.com) to another set of name servers, you would create NS records for the subdomain pointing to the name servers that should handle DNS resolution for that subdomain.
A domain can have multiple NS records, specifying multiple authoritative name servers. This redundancy provides fault tolerance and improves reliability. If one name server is unreachable, DNS resolvers can attempt to query the next available name server listed in the NS records.