If you're new to the world of networking or website management, you've probably heard the term "DNS" thrown around quite a bit. DNS stands for Domain Name System, and it's a fundamental part of how the Internet functions. In this blog post, we will talk more about DNS records, explain what they are, and provide an overview of the most important types of DNS records. We'll also introduce you to how to query DNS worldwide using your terminal and the Globalping network testing CLI.
Understanding DNS in a Nutshell
Before diving into DNS records, let's quickly grasp the essence of what DNS is.
When you type a website's URL into your browser (e.g., www.example.com), your computer doesn't understand it in the form of words; it needs an IP address to reach the website's server. Here's where DNS (Domain Name System) comes to the rescue. DNS acts as the internet's address book, translating user-friendly domain names into IP addresses (like "192.168.1.1"). Think of DNS as the postal service for the internet, helping route your request to the right destination.
To understand this process better, let's break it down into a few key steps:
- You type a web address: You open your browser and type in a web address (e.g., www.example.com) or click on a link.
- Your computer checks its cache: Your computer first checks its local DNS cache. If it recently looked up the same domain, it might have the IP address saved. If not, it moves to the next step.
- Asking the recursive DNS server: Your computer contacts a Recursive DNS Server (usually provided by your ISP or a public DNS service like Google DNS or Cloudflare DNS). It asks, "Hey, do you know the IP address for www.example.com?"
- Recursive DNS server searches: The Recursive DNS Server might have the IP address cached or might need to find it. It follows a trail of DNS queries, starting from the root DNS servers, then to the top-level domain (TLD) servers (like .com), and finally to the authoritative DNS server for "example.com."
- Authoritative DNS server response: The authoritative DNS server for "example.com" provides the correct IP address, which the Recursive DNS Server caches and sends back to your computer.
- Your computer can now connect to the website hosting server, and you see the web page you requested.
Using the "dig" Command for DNS Queries
Now that you understand the basics of DNS, you might wonder how to explore DNS records for a domain. This is where the "dig" command comes in handy. "Dig" is a command-line tool that allows you to query DNS information for a domain.
For example, if we run the command:
… we get the following result:
For example, if you run "dig example.com," you might see output that includes A records, AAAA records, NS records, and other DNS-related data for the domain.
"Dig" is a valuable tool for network administrators, webmasters, or anyone curious about a website's DNS configuration. It helps you gain insights into how a domain is set up and can be essential for troubleshooting DNS-related issues.
Let’s explore some of the most important DNS records in the next section!
What DNS records are there?
Each DNS record contains specific information about a domain, helping direct internet traffic to the right destination. Here's a breakdown of some common DNS records:
1. A Record (Address Record)
The A record is the most fundamental DNS record. It links a domain name to an IPv4 address. For example, if you have a website hosted at 192.168.1.1, the A record for your domain would associate www.example.com with that IP address.
www.example.com. IN A 192.168.1.1
2. AAAA Record
Similar to the A record, the AAAA record links a domain to an IPv6 address. IPv6 is the newer version of the internet protocol and uses longer addresses. Here's how an AAAA record looks:
www.example.com. IN AAAA 2001:0db8:85a3:0000:0000:8a2e:0370:7334
3. CNAME Record (Canonical Name)
CNAME records are like aliases. They point one domain to another domain's A or AAAA record. For instance, you could use a CNAME to have "blog.example.com" point to the same IP address as "www.example.com."
blog.example.com. IN CNAME www.example.com.
4. MX Record (Mail Exchanger)
MX records handle email routing. They specify which mail servers are responsible for receiving emails on behalf of a domain. MX records have priority values to determine the order in which servers are used.
example.com. IN MX 10 mail.example.com.
5. TXT Record (Text Record)
TXT records contain text information, often used for adding extra information about a domain. They're commonly used for email verification, SPF (Sender Policy Framework), and DKIM (DomainKeys Identified Mail) settings.
example.com. IN TXT "v=spf1 mx -all"
6. NS Record (Name Server)
NS records specify the authoritative name servers for a domain. These servers hold the official DNS records for the domain. They are essential for delegating subdomains or transferring domain control.
example.com. IN NS ns1.example.com.
Global DNS Testing with Globalping
Understanding DNS is one thing, but what if you want to check how your DNS records perform from different locations around the globe? This is where Globalping comes in handy.
Globalping is a free network testing platform that allows you to run network measurement requests from anywhere. So, for example, if you want to run "dig" from a location in South Africa, Berlin, or a specific ISPN, you can easily do so!
Note: The "dig" command is actually called "dns" in Globalping. But don't get confused; they differ only in their names.
To use Globalping, follow these steps:
Follow the installation instructions explained on Github to set up Globalping on your machine.
Open your terminal and type the following to run dig (dns) from South Africa:
globalping dns jsdelivr.com from "South Africa"
View the results!
Want to learn how to read dig/dns results? Check out our guide here.
In summary, DNS records are the backbone of the internet, translating human-readable domain names into machine-friendly IP addresses. Understanding the various types of DNS records, such as A, AAAA, CNAME, MX, TXT, and NS, is essential for managing your online presence effectively.
Additionally, the "dig" command is a valuable tool for querying DNS information, and Globalping offers a convenient way to test the global accessibility of your DNS records.
If you want to learn more about Globalping or even want to contribute, visit us on GitHub – we’d be happy to see you there!