DNS records are the data stored in DNS servers. They contain information such as IP address, hostname, mail server, etc.
DNS stands for Domain Name System. This system allows computers to communicate with each other over the Internet using domain names instead of IP addresses. The DNS protocol was developed in 1983 by Paul Mockapetris.
A DNS record contains the name or address of a computer or network resource (e.g., website) along with its associated IP address. Each DNS record has a unique identifier called a Resource Record Identifier (RRID).
How Does It Work?
A DNS query is sent from one computer to another. When this happens, the first computer sends out a request asking the second computer what it knows about a particular domain name.
In response, the second computer returns a list of IP addresses and other information that it stores about the domain name.
The DNS server then checks if there is an entry for the domain name in its database. If so, it will return the corresponding IP address; otherwise, it will send back an error message.
The DNS server also keeps track of which IP addresses have been assigned to different domains. This way, when a new domain is added to the DNS server’s database, it can automatically assign the proper IP address to the domain.
When you visit a website on your computer, your browser contacts the DNS server to find out where to go. Your browser asks the DNS server for the IP address of the website you want to visit.
For example, let’s say you type www.google.com into your browser’s location bar. Your browser makes a DNS query to find out where to take you.
Your browser sends a request to the DNS server: “I need to know where google.com lives.”
Your browser receives a reply from the DNS server: “It lives at 192.168.1.2”
Your browser now knows how to get to Google.com.
Why Do We Need DNS Records?
DNS records are used to map domain names to IP addresses. For example, when you enter www.google.com in your browser’s URL bar, your browser uses the DNS records to determine where to take you.
You may be wondering why we need DNS records. Why not just use IP addresses?
IP addresses are great for finding specific websites because they’re easy to remember.
However, IP addresses don’t tell us much about the resources behind those sites. For instance, www.google.com could be owned by Google, Inc. or it could be owned by a company called Google LLC.
IP addresses also change frequently. So, if you wanted to reach www.google.com today, you’d probably end up going to a different IP address than you would tomorrow.
To solve these problems, DNS was created. DNS records store all kinds of useful information about domain names, including their owners, locations, and even whether they’re active or inactive.
There are two main types of DNS records: A records and CNAME records, as well as additional elements which help your website load and run smoothly.
An A record tells the DNS server where to direct incoming requests for a given domain name. An A record consists of three parts:
• The domain name itself
• The IP address of the host machine that owns the domain name
• The type of data contained within the record
Let’s look at an example. Say I own the domain name www.example.com. I might create a record for my site like this:
www.example.com. 1 IN A 192.168.0.1
Here, the domain name is www.example.com, the IP address of the host that owns the domain name is 192.168.0.1, and the type of data stored in the record is IPv4 Address.
Now, let’s say I want to make sure people always get directed to the right place when they ask for www.example.com. To do this, I’ll create another A record with the same domain name but a different IP address:
www. example com. 2 IN A 192.168..1.2
In this case, the domain name is still www.example.com and the IP address of the second host is 192.168.1.2, but the type of data stored is IPv6 Address.
A CNAME record allows you to point one domain name to another. In other words, a CNAME record lets you create a shortcut between domains. It does this by telling the DNS server which domain name to send visitors to.
The syntax of a CNAME record looks like this:
mydomainname.com. CNAME www.myotherdomain.com
When someone asks for mydomainname.com, the DNS server will first check to see if there’s a CNAME record associated with mydomainname.com pointing to www. myotherdomain. If so, the DNS server will send the visitor to www.myotherdomian.com instead.
Another important element of understanding DNS is MX entry, and this dictates the way in which email messages are redirected to your preferred domain.
How Does MX Work?
The MX entry specifies the mail exchange servers (mail exchangers) that should handle email messages sent to a particular domain. This helps ensure that emails sent from your website are delivered properly.
For example, suppose you have a web hosting account with HostGator. You can use the following MX entries to specify the mail exchanger(s) that should receive email messages sent to your domain name:
You can add as many MX entries as you need. Each MX entry has a priority value that determines how important each mail exchanger is. Higher-priority MX entries take precedence over lower-priority ones.
If you want to set up multiple mail exchangers, you can list them in any order. For example, you could list some mail exchangers higher than others. If you don’t specify a priority value, the default priority value is 10.
Note: When using Google Apps, we recommend setting up Gmail as your primary mail exchanger. We also recommend adding your company’s domain name to the SPF or DKIM records on your Google Apps account.
TXT records are another important element of understanding DNS records. They’re used to store information about the domain name itself. These records are useful because they allow you to store text strings on your domain name.
How Do TXT Records Work?
TXT records are very similar to A records. The only difference is that they contain text rather than an IP address.
To create a TXT record, simply enter the desired text into the appropriate field. In most cases, you won’t need to worry about the length of the text string. However, it’s best practice to keep the size under 255 characters.
Using TXT Records With Your Domain Name
In addition to storing text strings, TXT records can be used to provide additional information about your domain name. One such example would be displaying the owner’s contact details.
For instance, let’s say that you own a domain name called mywebsite.com. You might decide to display the owner’s contact details on your site. To do this, you’d create a TXT record with the following content:
This means that whenever someone types mywebsite.com in their browser, the DNS server will look at the TXT record and return the owner’s contact details to the user.
Why Use TXT Records?
There are several reasons why you may want to use TXT records. Some examples include:
- Displaying contact information for your business.
- Providing additional information about your domain.
- Storing a URL redirect.
Setting Up TXT Records
There are two ways to set up TXT records. The first way is through the cPanel interface, and the second uses the Command Line Interface.
- Creating a TXT Record Through CPanel
The easiest way to create a TXT record is through cPanel. Simply log into your control panel and click on Manage Domains. Then, select the domain name from the left side menu and click on Add New TXT Record.
This opens the Create TXT Record page. Enter the required information and then click Save Changes when finished.
- Adding a TXT Record Using Command Line Interface
You can also create a TXT record using the command line interface. Follow these steps to add a TXT record using the command line interface:
Log into your hosting account via SSH (see our guide).
Type the following command:
Example: hostname -t txt www.example.com
Type ‘help’ to view available options.
Type ‘quit’ to exit.
Understanding DNS records is essential if you want to make sure that your website loads correctly. It’s also important to understand what each of the different types of DNS records actually means.
By learning more about DNS records, you’ll be able to ensure that your website loads properly and quickly.