DNS is a very critical part of the Linux operation world. We will cover the most common DNS records today. All domains are required to have at least a few essential DNS records for a user to be able to access their website using a domain name.
Table of Contents
Here are 4 commonly used DNS records.
- A record – A record is used to map a domain (e.g., mystunningwebsite.com) or a sub-domain (e.g., blog.mystunningwebsite.com) to an IP address or many ips.
- PTR record – Provides a domain name in reverse-lookups. eg. (184.108.40.206 — www.howtouselinux.com)
- CNAME record – also known as canonical name records, are used to create aliases that point to other names. They are commonly used to map WWW, FTP and MAIL sub-domains to a domain.
- MX record – MX (Mail Exchange) records control how incoming email is routed for your domain.
DNS A Record
A record is the most commonly used record type. If we have ever set up a website, we most likely configured an A record before. These records are the most basic form of a DNS record and almost all other record types we will discuss are based off of A record functionality.
When we set up an A record, we will specify an FQDN (Fully Qualified Domain Name) to be pointed to an IP address. If we are creating a website, then the IP address will usually be given to you by our DNS registrar when we purchased our domain name.
DNS CNAME Record
CNAME records, also known as alias records, point a hostname to another hostname or FQDN. These records are typically used to point multiple hosts to a single location, without having to specifically assign an A record to each hostname.
For example: if we moved our blog from news.example.com to blog.example.com, then we would use a CNAME record. CNAME records can also be used to point a hostname to another domain or external hostname.
To resolve a CNAME record, the name server must behave slightly different than it would with a normal query of another record type. When a name server looks up a name and finds it is a CNAME record, it replaces the name with the canonical name (the target of the CNAME) and looks up the new name. In a sense, a CNAME lookup performs two queries to reach the final resolution.
DNS MX record
A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is possible to configure several MX records, typically pointing to an array of mail servers for load balancing and redundancy.
DNS PTR Record
DNS PTR records are used in reverse DNS lookups. When a user attempts to reach a domain name in their browser, a DNS lookup occurs, matching the domain name to the IP address. A reverse DNS lookup is the opposite of this process: it is a query that starts with the IP address and looks up the domain name.
More DNS Records
Here are 6 more DNS records.
- TXT record – TXT (text) records are used to provide textual information about a domain (like the name of the host and contact details) to external sources.
- SPF record – Sender Policy Framework (SPF) is an email validation system designed to prevent email spam by verifying sender IP addresses.
- NS record – NS records define which name servers contain the DNS records for a domain.
- SOA record – Stores admin information about a domain.
- SRV record – SRV records (also known as service records) are responsible for localizing specific domain-related services such as FTP, HTTP, and SIP.
- AAAA record – maps a domain name to the IP address (Version 6) of the computer hosting the domain. An AAAA record is used to find the IP address of a computer connected to the internet from a name.
DNS TXT Record
The Text record (TXT) allows us to add both human and machine-readable instructions. This record type serves a variety of purposes, including email spam prevention, domain ownership verification, and framework policies, as well as providing point-of-contact and general information about the domain.
DNS SRV Record
SRV records help with service discovery. For example, SRV records are used in Internet Telephony to define where a SIP service may be found.
An SRV record typically defines a symbolic name and the transport protocol used as part of the domain name. It defines the priority, weight, port, and target for the service in the record content.
DNS AAAA Record
AAAA records are DNS records that use an IP address to connect a domain to a website, and can be added to your domain at any time. They are similar to A records, but AAAA records point to 128–bit/IPv6 addresses, instead of the IPv4 addresses used by A records.