DNS and Common DNS Record Types Explained

By Ljubomir Jakimovski on Fri Jan 27 2023

A Brief History of DNS

The Domain Name System (DNS) was first introduced in 1983 as a way to translate human-friendly domain names (such as whatismyip.io) into the IP addresses that computers use to locate each other on the internet. Before DNS, IP addresses had to be looked up manually in a host file on each computer. DNS revolutionized the way we navigate the internet by allowing us to use easily-remembered domain names instead of complex IP addresses.

What is DNS?

DNS is the backbone of the Internet. Without it, we wouldn't be able to access websites and other resources using readable domain names. By design, it's a hierarchical, decentralized system, made up of many individual DNS servers, each of which contains a database of DNS records.

DNS Records

DNS records are a vital component of the DNS system.

Different types of records serve different purposes, such as mapping a domain name to an IP address (A record) or specifying a mail server for a domain (MX record). These records are stored in DNS servers and are used by clients, such as web browsers, to resolve domain names to IP addresses.

When a client requests a specific domain name, the request is sent to the DNS server that is responsible for that domain. The server looks up the requested information in its records and returns it to the client, allowing it to connect to the correct IP address.

To find the correct DNS server, the client uses a process called recursion. It starts by sending a query to a DNS server, and if it doesn't have the requested information, it sends the query to another server until the information is found. The process is hierarchical, starting from the Root name servers, then the TLD name servers, and so on.

In this way, DNS records function as a "telephone directory" for the internet.

DNS Records Syntax

DNS records have a specific syntax that must be followed for them to be properly understood by DNS servers.

NoteNote: DNS records are usually managed by the domain registrar or hosting provider, and the format and method for adding or modifying records may vary depending on the provider. The examples we provide use the standard format for DNS records, also known as the "zone file format" or "BIND format". This format is used by many DNS servers and is the most commonly used format for DNS records.

The format consists of several fields separated by spaces, in the following order:

  • The domain name or hostname associated with the record.
  • The time-to-live (TTL) in seconds.
  • The class of the record (usually "IN" for Internet).
  • The record type (e.g. A, MX, CNAME, etc.).
  • The record data, which is specific to the type of record being defined.

We should be aware of the different notations and formats that are used in DNS records, as they can vary depending on the provider and the software being used to manage the DNS.

Common DNS Record Types

A Record

website-example.com. 3600 IN A 192.0.2.1

An A (Address) record maps a domain name to an IPv4 address. This is the most basic type of DNS record and is used to direct traffic to a specific IP address. The domain "website-example.com" is being mapped to the IP address "192.0.2.1".

AAAA Record

website-example.com. 3600 IN AAAA 2001:0db8:85a3:0000:0000:8a2e:0370:7334


An AAAA (Quad A) record maps a domain name to an IPv6 address. It is similar to the A record, but for IPv6 addresses. This record is used to direct traffic to a specific IPv6 address. The domain "website-example.com" is being mapped to the IPv6 address "2001:0db8:85a3:0000:0000:8a2e:0370:7334".

It's worth noting that while IPv6 is becoming more widely adopted, not all DNS servers or clients support it yet, so it's important to have both A and AAAA records for your domain if you want to ensure that all users can connect to it.

CNAME Record

www.website-example.com. 3600 IN CNAME example.com.

A CNAME (Canonical Name) record maps an alias domain name to its true domain name. This record is commonly used to redirect "www" subdomains to "non-www" domain names. In this example, the "www.website-example.com" is an alias of "website-example.com" and that's where any requests will be directed.

MX Record

example.com. 3600 IN MX 10 mail.example.com.

An MX (Mail Exchanger) record specifies the mail server responsible for a domain and it's used to route email for a domain to the correct mail server. Here, the domain "example.com" is configured to use "mail.example.com" as its mail server, with a priority of 10.

NS Record

example.com. 3600 IN NS ns1.example.com.

An NS (Name Server) record specifies the name servers for a domain. This record is used to specify which DNS servers are authoritative for a specific domain. As we can see, the domain "example.com" is using "ns1.example.com" as its name server.

PTR Record

1.2.0.192.in-addr.arpa. 3600 IN PTR example.com.

A PTR (Pointer) record maps an IP address to a domain name and it's commonly used for reverse DNS lookups and determines the hostname associated with an IP address. In this example, the IP address "192.0.2.1" is mapped to the domain "example.com".

SRV Record

_sip._tcp.example.com. 3600 IN SRV 0 5 5060 sip.example.com.

An SRV (Service) record allows for the definition of a service and its hostname and port number. It's commonly used for services like SIP or XMPP. This record specifies that the service is sip, the protocol is TCP, the name of the service is example.com and the priority, weight, and port that the service is running on are 0, 5, and 5060 respectively and the target hostname is sip.example.com.

TXT Record

example.com. 3600 IN TXT "v=spf1 mx -all"

A TXT (Text) record is a type of DNS record that allows for arbitrary text to be associated with a hostname. It's used for things like SPF (Sender Policy Framework) records, which are used to prevent email spoofing.

For instance, the domain "example.com" has a TXT record with a value of "v=spf1 mx -all" which is an SPF record indicating that the domain's MX record is authorized to send emails for the domain.

Final Thoughts

When you type "what is my ip" into a search engine, you are essentially asking the Internet to tell you the address associated with your device. This is done through a process called IP lookup. The IP, or Internet Protocol address, is a unique label assigned to every device connected to a computer network that uses the Internet Protocol for communication. It serves two main functions: identifying the host or network interface and providing the location of the host in the network.

Naturally, this is where DNS and DNS records come into play. Several processes happen quickly and seamlessly in the background, allowing users to access the desired website or resource without even realizing that a DNS lookup has occurred.

DNS records play a crucial role in the functioning of the Internet, making it possible for users to access resources using easy-to-remember domain names. Without DNS, the Internet would be a vastly different place and much less user-friendly.

Below, you'll find a comprehensive summary of what we covered, as well as some other necessary knowledge bites:

  • DNS (Domain Name System) is a system that converts human-friendly domain names into IP addresses that computers can understand.
  • DNS records are the fundamental building blocks of the DNS system, and there are several different types of records that serve different purposes.
  • The most common DNS record types include A, MX, CNAME, and TXT records.
  • A records map a domain name to an IP address, MX records specify a mail server for a domain, CNAME records create aliases for a domain, and TXT records allow for the storage of arbitrary text data.
  • DNS records are stored in DNS servers and are used by clients (such as web browsers) to resolve domain names to IP addresses.
  • The process of querying DNS records is hierarchical, starting from the Root name servers and then the TLD name servers and so on.
  • DNS records function as a "telephone directory" for the internet, allowing humans to use easy-to-remember domain names instead of hard-to-remember IP addresses.
  • It's crucial to have a proper DNS record setup for your website or domain, as it can affect the accessibility, reliability, and security of your website.
  • Custom DNS Records can also be added to achieve specific functionality.
  • The process of DNS resolution relies on the communication between DNS clients and servers, and the correct configuration of DNS records.
  • DNS Records are a critical component of the infrastructure of the internet, allowing users to easily and quickly access the resources they need.