DNS resource records
A DNS resource record (RR) is the data that maps a name to an IP address or other information, in areas that serve a structural purpose. This record, often abbreviated RR, is considered the fundamental information of a domain name.
A Fully Qualified Domain Name (FQDN) contains all the elements of a hostname up to its root zone, including the 'dot' zone. In the techmentor.com zone, for example, www.techmentor.com represents the www record, with the 'com' zone being the last zone prior to the 'dot' zone. The FQDN is typically represented by the literal 'dot' zone in cases when there is no ambiguity regarding its nature. Therefore, you receive www.techmentor.com. DNS server configuration files use this notation frequently and even essential.
There are several fields in each Resource Record, including:
- Name: The domain name associated with the Resource Record.
- Type: A code that identifies the type of data stored in a record. Some of the most common types include: A IPv4 address, AAAA address, MX address, CNAME address, NS address, and SOA address.
- Class: There are several classes of Resource Records. The most common and default class is IN (Internet).
- TTL: The TTL (Time To Live) of a Resource Record indicates how long it can be cached by resolvers or other DNS servers before being considered stale and having to be queried again.
- Data: Resource Record Data consists of the specific information associated with the Resource Record. For example, an A record contains an IPv4 address, while an MX record contains the hostname and priority of the mail server.
A (Address) Record
As part of the Domain Name System (DNS), an A (Address) Record maps a domain name to a human-readable IPv4 address.
A website such as http://www.techmentor.com has 'www' as an A-type record in the 'techmentor.com' zone, which corresponds to an IP address, the address of the web server hosting the website.
Example :
techmentor.com. IN A 162.144.1.46 www.techmentor.com. IN A 162.144.1.46
AAAA (IPv6 Address) Record
AAAA records are resource records that associate a domain name with a corresponding IPv6 address in the Domain Name System (DNS). By mapping a human-readable domain name to its corresponding IPv6 address, these records enable traffic to be routed over IPv6 networks.
In modern networks, AAA Records are essential for translating domain names into IPv6 addresses, which are essential to support the ever-increasing number of devices and services on the Internet.
Example :
techmentor.com. IN AAAA 2001:0db8:85a3:0000:0000:8a2e:0370:7334
CNAME (Canonical Name) Record
CNAME Records (Canonical Name Records) serve as aliases or canonical names for existing domain names in the Domain Name System (DNS). An alternate domain name (alias) pointing to the same IP address as the primary domain may be created using CNAME records. As a result, DNS management is simplified and multiple domain names can resolve to one location without the need for duplicate IP addresses in DNS records.
Example :
www.techmentor.com. IN CNAME techmentor.com.
It is common to create subdomain aliases that point to a primary domain using CNAME Records, such as "www" or "mail." DNS management is simplified by allowing multiple domain names to resolve to the same IP address, which simplifies the maintenance and updating of DNS records when IP addresses change.
MX (Mail Exchange) Record
This Resource Record specifies the mail servers that receive email on behalf of a domain as a part of the Domain Name System (DNS). A MX Record plays a critical role in email delivery, as it directs incoming email messages to the appropriate mail servers.
Email routing is highly dependent on MX Records, as they determine where incoming emails should be sent. Domain administrators can configure multiple mail servers with varying priorities to ensure redundancy and reliability if one mail server becomes unavailable. Using the priority values, the sending mail server selects the most appropriate mail server to deliver the email.
For example, if "techmentor.com" has two MX Records:
- Priority 10: mail1.techmentor.com
- Priority 20: mail2.techmentor.com
Emails are sent to "mail1.techmentor.com" first. If it is unavailable, email is sent to "mail2.techmentor.com." This provides a failover mechanism to ensure email delivery even if one of the mail servers is unavailable.
Example :
techmentor.com. IN MX 10 mail1.techmentor.com. techmentor.com. IN MX 20 mail2.techmentor.com.
SOA (Start of Authority) Record
A DNS zone file's Start of Authority (SOA) record provides essential information about the DNS zone, such as the primary name server, the email address of the responsible person or the administrator, and various timing parameters.
Example :
The following is an example of an SOA record within a Linux DNS zone file for the domain "techmentor.com":
techmentor.com. IN SOA ns1.techmentor.com. admin.techmentor.com. ( 2023103001 ; Serial number 86400 ; Refresh rate in seconds 7200 ; Retry rate in seconds 3600000 ; Expire time in seconds 172800 ; Minimum TTL in seconds )
- techmentor.com. - There is a dot at the end of the domain name to indicate that it is an absolute domain name for which the SOA Record is defined.
- IN - "IN" refers to the Internet class.
- SOA - This indicates that this is an SOA Record.
- ns1.techmentor.com. - This is the primary name server for the "techmentor.com" domain.
- admin.techmentor.com. - This is the email address of the administrator responsible for the DNS zone of "techmentor.com."
The following information is provided within parentheses as timing parameters:
- 2023103001: The serial number, which should be incremented each time the zone file is updated.
- 86400: The refresh rate, indicating how often secondary name servers should check for updates from the primary name server (in seconds).
- 7200: The retry rate, specifying how often secondary name servers should retry contacting the primary name server if a refresh request fails (in seconds).
- 3600000: The expire time, which indicates how long a secondary name server can continue to answer queries if it's unable to contact the primary name server (in seconds).
- 172800: The minimum Time To Live (TTL), which is the minimum amount of time a DNS resolver should cache the information before checking for updates (in seconds).
NS (Name Server) Record
A DNS zone file consists of an NS (Name Server) record, which specifies the name servers that are authoritative for a particular domain in the DNS zone file.
Example :
techmentor.com. IN NS ns1.techmentor.com. techmentor.com. IN NS ns2.techmentor.com.
In this example:
- techmentor.com.: The dot at the end indicates that this is an absolute domain name for which the NS Records have been defined.
- IN: For Internet, the class is specified as "IN".
- NS: In this case, the records are NS records.
- ns1.techmentor.com. and ns2.techmentor.com.: The following are the fully qualified domain names (FQDNs) of the authoritative name servers for the domain "techmentor.com".
As well as resolving queries for domain hosts, authoritative name servers provide DNS information about a domain.
TXT (Text) Record
A TXT (Text) Record in a DNS zone file is used for storing textual data associated with a domain name. These records can be used for domain verification, email authentication (SPF, DKIM, and DMARC records), and general text data.
Example :
techmentor.com. IN TXT "v=spf1 include:_spf.example.com ~all"
In this example:
- techmentor.com.: This is the domain name for which the TXT Record is defined. The dot at the end indicates that this is an absolute domain name.
- IN: The class is specified as "IN" for Internet.
- TXT: This indicates that this is a TXT Record.
- "v=spf1 include:_spf.example.com ~all": This is the textual information associated with the domain. In this case, it's an SPF (Sender Policy Framework) record used for email authentication.
As TXT records can contain a variety of text-based information, the content within the double quotation marks may vary depending on the purpose of the record.