The Domain Name System (DNS) is vital for the running of the web. In a nutshell, it converts requested domain names into IP (Internet Protocol) addresses – which is what computers use to find websites, deliver emails, and the many other activities that take place on the web.
Understanding how DNS works and its configuration – whether you’re looking to add a DNS record or edit an existing one – can help you better manage your WordPress site.
Table of contents
Definition of terms
Throughout this article, we will make reference to certain technical terms and abbreviations, some of which may not be part of your everyday vocabulary. As such, we thought it might be useful to include a short section explaining what these terms mean.
- TLD: Top-Level Domain. Example .com or .co.uk
- URL: Uniform Resource Locator – The full name of a resource, including TCP/IP information. Example http://www.melapress.com
- FQDN: Fully Qualified Domain Name – The full domain name includes the hostname, domain, and TLD. Example www.melapress.com
- Domain name: Name of the domain example melapress.com
- TCP/IP: Transmission Control Protocol/Internet Protocol. The main protocol (language) used by devices communicating over a network such as the internet.
- Domain registrar: The company with which you registered your domain name.
- Hosting provider: The company that provides hosting for your WordPress website.
More about DNS – What is it?
The resources we access on a network, be it the internet or our home/office network, need an address. This address allows us to find those resources. Resources can include email servers, web servers, a network printer, etc.
This address is called an IP address and is defined by the TCP/IP protocol – the main language of the internet. Addresses are made up of four numbers between 0 and 255, with each number separated by a full stop:
192.0.2.0
203.0.113.0
Remembering these numbers can be difficult, which is why we typically use a URL. URLs like www.melapress.com and www.google.com are easier to remember than a string of numbers.
Even though we use URLs, computers still need the IP address to find the resource we want to access. This is where DNS comes in. DNS converts the URLs we type into IP addresses by referencing its lookup table. As a WordPress administrator or website owner, you need to ensure that your DNS server is configured properly to allow visitors and customers to find you.
What does a DNS record look like
A DNS record must include essential information that allows computers to understand what it is and what it refers to. Understanding what this information is can help you configure your own records.
- Record name: The domain name of the record
- Record type: The type of record (ex., A record)
- TTL (Time To Live): The number of seconds a record is valid for. Once the TTL is reached, the record needs to be refreshed. The refresh is done automatically by the DNS server.
- IP/Host: The IP address or hostname for the record
WordPress DNS records you need to know about
There are eight different types of DNS records, each with its own use. When it comes to WordPress DNS configuration, however, five records are of particular interest, which we will discuss in some detail below.
A Record
A Record stands for Address Record. It is used to associate a URL (www.melapress.com) with an IP address.
A records are used to tell DNS where a particular website is located. In essence, it directs a URL to the webserver’s IP address.
In certain situations, one A record can have multiple IPs assigned to it – such as in the case of load balancing or round-robin setup, for example. This ensures that traffic is routed to different servers, thereby distributing traffic load. It also ensures that if one server goes down, website visitors will continue to be served by the second server.
You should have at least one DNS record that lists your domain.
When to set up or configure A records
A records are configured when setting up a new domain or subdomain. If you’re changing the domain of your website or the webserver/hosting provider, you may also need to update your A record to reflect this change.
How to configure A records
To configure an A record, you need to enter the below information:
- Name: The root domain, represented by ‘@’
- Value: The web server’s IP address
- TTL: The record’s time to live, expressed in seconds
To set up an A record for a subdomain, enter the subdomain name in the Name field. For example, when setting up the sub-domain blog.melapress.com, enter ‘blog’ in the Name field.
Do note that A records and all other DNS records must be configured with your domain provider.
CNAME Record
CNAME stands for Canonical Name Record. It is used to create domain aliases, such as when setting sub-domains. An example of this would be using a CNAME record for blog.melapress.com that points to www.melapress.com or creating a subdomain like ftp.melapress.com with the same IP as www.melapress.com
CNAME records point to a domain rather than an IP.
When to set up or configure CNAME records
CNAME records are configured when you want to set up an alias for an existing domain. For example, you want to set an alias of blog.melapress.com for melapress.com.
How to configure CNAME record
To configure a CNAMED record, you need to enter the below information:
- Name: The alias you want to configure
- Value: The domain you want the CNAME record to point to
- TTL: The record’s time to live, expressed in seconds
MX Record
MX stands for Mail Exchange. They specify the mail server and are used to route emails. As an example, if you were to send an email to joel@melapress.com, your mail server must query MX records to determine where the email needs to be sent.
Note: WordPress uses PHPMailer to send emails from WordPress without the need for a local mail server.
One thing to note here is that MX records also have a priority configuration. Lower numbers indicate higher priority. Priority can be used to configure backup mail servers in case the primary mail server goes down.
When to set up or configure MX records
MX records are configured when setting up a mail server. This enables you to have an email address with your own domain, for example joel@melapress.com. Do note that you need to have a mail server to point the record towards.
How to configure an MX record
To configure an MX record, you need to enter the below information:
- Name: The root mail domain, represented by ‘@’
- Priority: Preference for the mail server being configured with lower numbers representing higher preference (priority)
- Value: The mail server domain name
- TTL: The record’s time to live, expressed in seconds
NS Record
NS stands for Name Server. They specify which DNS server has the authority for a particular domain. This record essentially tells other DNS servers that they have reached the authoritative DNS server for a particular domain.
You should have at least one NS record in your authoritative DNS server for your domain. In most cases, you’ll have multiple records that point to different authoritative DNS servers for redundancy purposes.
When to set up or configure NS records
NS records are configured when setting up a new domain or when configuring a sub domain that will use a different nameserver. You might also need to update existing DNS records when making changes to your WordPress DNS.
How to configure an NS record
To configure an NS record, you need to enter the below information:
- Name: The domain, represented by ‘@’ for the root domain
- Value: The domain name of the authoritative DNS server
- TTL: The record’s time to live, expressed in seconds
TXT Record
TXT stands for text. These records were originally intended as a note-storage space, allowing administrators to save any kind of notes on the DNS server – hopefully related to DNS and not their grocery shopping list.
TXT records are also used by third parties to verify domain ownership. Here, you need to add a specific TXT record to confirm you own the domain, such as when configuring Google Analytics. TXT records are also used by a number of protocols, such as SPF and DKIM, which are email antispam and authentication protocols, respectively.
When to set up or configure TXT records
TXT records are typically configured when setting up a service such as Google Analytics for domain ownership verification.
How to configure a TXT record
To configure a TXT record, you need to enter the below information:
- Name: The domain, represented by ‘@’ for the root domain
- Value: The text string
- TTL: The record’s time to live, expressed in seconds
How to access DNS records for a WordPress website
Your DNS records are typically held at;
- Your domain registrar
- Your hosting provider
- DNS service provider
- Your own DNS servers
– depending on how your environment is configured. This can vary depending on your setup. In most cases, however, the registrar and WordPress hosting provider are the same. In such cases, you’ll find everything in one place. Sadly, there are no DNS management plugins available.
In this section, we will cover tutorials for managing DNS on a number of platforms.
CPanel
CPanel is a backend management system that’s something of a gold standard and is used by many service providers. Anyone who has been a web administrator long enough will surely have crossed paths with this platform. GoDaddy, for example, uses CPanel with some of its hosting plans, as do many others.
In CPanel, DNS records are managed from Domains > Zone Editor. Simply click on Manage next to the domain name you want to create or edit DNS records for.
To add a new record, click the Add Record button. To edit an existing record, click on the Edit button next to the DNS record you want to edit. Remember to click Save Record once done.
Hostinger
Hostinger is a registrar and hosting service provider with data centers around the world. They use hPanel – a custom control panel designed by Hostinger themselves. They offer plenty of documentation on their website should you require it.
To manage DNS records through Hostinger, navigate to Domains, then click the arrow next to the domain you want to manage DNS records for. Next, locate DNS/Nameservers within the sidebar and click.
Depending on how your DNS is set up, you will see different options. If Hostinger is not your registrar, you’ll find available options under External Domains. If your domain was purchased through Hostinger, you’d find a DNS records option instead. DNS records can be managed from here.
GoDaddy
GoDaddy is a service provider offering domain registration and hosting, among other things. They offer DNS management through their account page, making it easy to configure.
To manage DNS records with GoDaddy, first click on My Products, go to the Domains tab, and click on Manage All. Click on the ellipses (…) in the Manage column and then click on Manage DNS.
WP Engine
WPEngine is a WordPress hosting provider. You can find DNS settings in the DNS details tab, which you can access by navigating to Domains and then DNS Details from the user portal
Kinsta
Kinsta is a cloud platform that offers hosting services. DNS is managed through MyKinsta. When setting up DNS for the first time, you’ll need to click on the Add Your First Domain option, which is available in the DNS tab. This will create a DNS zone for you, which also allows you to add additional domains.
Troubleshooting and fixing DNS WordPress issues
DNS errors and issues can happen for a variety of reasons. Sometimes, it’s an issue with your WordPress DNS settings. Other times, however, it may be an issue with your internet setup or connection.
In this section, we will look at common DNS errors and the steps you can take to resolve them.
DNS_PROBE_FINISHED_NXDOMAIN
This error means that a DNS request was authoritatively answered that the domain does not exist. This can happen for various reasons, including:
- There is a typo in the URL
- The domain name has not been registered yet
- The domain name has expired
- There is a network issue that is prohibiting the request from being resolved
Checking for typos in the URL is the easiest so we should always get that out of the way first – especially if the domain has resolved in the past.Next, check the status of the domain using ICANN’s Registration data lookup tool, which will tell you whether the domain is active and when it expires.
Should you encounter any issues here, first check your WordPress DNS configuration to make sure everything is in order. You might also want to speak with your domain registrar or DNS provider for further assistance.
If you are using a CDN, clear the cache. You might also want to clear your DNS cache. In Windows, you can do this by opening the terminal and typing:
ipconfig /flushdns
This will clear your DNS cache.
ERR_NAME_NOT_RESOLVED
This error means that the DNS request could not be completed, and the domain name was not resolved into an IP.
To resolve this issue, start by clearing your cache and disabling any VPN or proxy you might be using. This will help us eliminate caching issues.
Next, check your IP settings, paying particular attention to the DNS server settings. Try changing these to Google’s Public DNS servers by configuring the following IPs:
8.8.8.8
8.8.4.4
If none of the above solutions work, check whether your WordPress DNS is configured to use DNSSEC. Log in to your DNS portal and check for a DNSSEC record. As a reminder, you will typically find your DNS portal in the hosting provider’s or domain registrar’s back-end. You can safely delete this record and allow some time for changes to propagate before trying to access the website again.
ERR_CONNECTION_RESET
While not a WordPress DNS configuration issue, an ERR_CONNECTION_RESET error is often attributed as such, which is why it is being included here. This error is a browser error and occurs when your browser fails to establish a connection. You should be able to verify this by using a different browser or a different machine altogether.
Next, clear your browser’s cache and do a hard reload. If you are using a VPN connection or a proxy, disable it temporarily and try to visit the website again.
DNS tools and queries
A small mistake in the DNS configuration can lead to big problems – people won’t be able to access your website or send you emails. In this section, we will look at how you can use nslookup, dig, and other DNS tools to test your DNS setup.
Nslookup and Dig DNS Tools
Both Nslookup and Dig are command-line tools found on many operating systems. These tools are used to send queries to DNS servers. Nslookup is more popular with Windows users, while Dig is more popular with Mac OS and Linux users. Both use similar queries and commands.
Querying a DNS Server with Dig and nslookup
The most basic DNS query you can send to a DNS server is to resolve a domain name into an IP address. By default, both Dig and Nslookup query A records, so just type the below in the command line to get the answer:
- Linux/Mac: dig www.melapress.com
- Linux/Windows: nslookup www.melapress.com
Below is a screenshot of the nslookup command and the response from the server:
Here is a breakdown of the response:
- Server: 172.20.10.1 is the IP address of the DNS server we queried and sent a response.
- Address: 172.20.10.1#53 is the IP address and port number of the DNS service.
- Name: www.melapress.com is the domain name we queried.
- Address: 162.159.134.42 is the IP address where the domain www.melapress.com is hosted. This is the record we are looking for.
Authoritative & Non-Authoritative Answers from the DNS Server
Did you notice the text ‘Non-authoritative answer’ in the DNS server response? That means that the server you queried is not the authoritative name server of the domain melapress.com. This means that the answer we received is a cached or forwarded response.
To get a response from the authoritative server, you have to find the name servers (NS records) of the domain and query them directly. We’ll do this in the below example.
Finding the Name Servers of a Domain
The name servers of a domain are the servers that hold the DNS zone of a domain (the main authority for that domain). These are the servers you specify when registering a new domain.
To find the name servers of a domain, use the following command:
dig [domain_name] NS
NS is the type of DNS record we want to know. So, to find the NS (name server) records of the domain melapress.com, the command should be:
dig www.melapress.com NS
Below is a screenshot with the request and answer:
As part of the response, you can see that we have sent one query (QUERY:1) and received one authoritative answer (AUTHORITY: 1).
This tells us the authoritative name server for the domain melapress.com. In this section, you can also see the Time to Live (TTL) value of the record, which is 3600.
Technical details of the query, such as how long it took the server to respond, when it was sent, the size of the message, etc.
Querying a Different DNS Server
By default, the Dig or Nslookup tool sends the query to the DNS server configured on your device’s network interface. Typically, this is the DNS server of an ISP, a web host, or the network you are connected to. Therefore, if you want an authoritative answer about a particular record or FQDN, you have to query the name server directly. To do this, use the following command format:
dig @[server] [domain]
Since we now know the name servers of the domain melapress.com, we can query one of them directly. In this case, we are querying 162.88.61.47, which is the IP address of the ns1cvw.name.com name server. We want the server to resolve the IP address of the FQDN www.melapress.com. The command is:
dig @163.114.216.17 www.melapress.com
Here is the response from the server:
This is the answer from the server. The FQDN melapress.com resolves to the IP address 163.114.216.17
Using DNS Tools to Find a Domain’s Mail Servers
When you send an email to support@melapress.com, your mail server sends DNS requests to find the IP address of the melapress.com domain mail servers. Mail server records on DNS are MX records, also known as Mail Exchanger records. To find the MX records of a domain, use the following command format:
dig [domain] [MX]
Below is the response from the DNS server for the dig melapress.com MX command:
From the answer, we can see that the domain melapress.com has five mail servers. The number in front of every mail server record is the server’s priority. The lower the number is, the higher the priority. This means that when you send an email to this domain, your mail servers will first try to connect to aspmx.l.google.com because it has a priority of 1. If, for some reason, it is unavailable, then the servers try to connect to the next server, in this case, the server with a priority of 5.
Other Uses for DNS Tools
The Dig and Nslookup DNS tools can be used to query any DNS server for any type of record. For example, you can use these tools to retrieve the TXT records of a domain, which are typically used by SPF and other frameworks. Dig also has an ‘any’ switch. When used, it downloads all the records for a particular domain.
Geek note: If you want to learn more about DNS and the different types of records, try getting the records for google.com or wikipedia.org.
Checking DNS Propagation
To minimize traffic and requests between servers, DNS servers cache DNS records for the time specified in the Time to Live (TTL) value. TTL is specified in seconds for every DNS record and works like an expiration date.
The higher the TTL value of a DNS record, the longer it will take for a change to propagate, because the DNS servers cache the record for much longer. On the other hand, a low TTL value means that a DNS record change will be propagated very quickly. However, a low TTL value also means an increase in the number of DNS resolution requests.
You should set a high TTL value for DNS records, like 86,400 seconds (24 hours). Only use lower values, something like 3,600 seconds (1 hour), when you are planning a DNS record change. As long as you lower the TTL a few days or weeks before the change, the change should be propagated in a respectable time. You can use the free online tool What’s My DNS to check if a DNS record change has been propagated. To run a test, simply type in the record and configure the expected results by clicking on the cogwheel.
How DNS works
Understanding how DNS works can help you improve how you manage it and troubleshoot issues when they arise. While it can get slightly complicated when you look beneath the surface, in principle, it is very straightforward.
We will illustrate this with an example – visiting www.melapress.com
Step 1: Request the IP address of the domain name
Once you type the URL www.melapress.com into the address bar of your browser, your computer or smartphone sends a request to the DNS server, asking for the IP address of www.melapress.com.
The initial request is sent to the DNS server configured on your device. Typically, this is assigned by your router or ISP and is configured automatically upon connection to the network, assigned by the DHCP.
Geek note: Before sending a request to the DNS server, your computer first checks the hosts file. This text file maps domains with IP addresses, making them hard-coded. This is mostly used for the loopback address, which is 127.0.0.1 however allows any IP to be assigned to any domain.
Step 2: Recursive DNS server requests the Name Servers of the domain
Network and ISP DNS servers are called recursive DNS servers because they do not store domain data. Instead, they forward your query to other DNS servers, who send back the answer (the IP address of the requested website).
The recursive DNS server (the DNS server your device contacted) contacts other DNS servers higher up in the hierarchy (such as root servers) to get the IP address of the Name Servers (NS) for the domain melapress.com. Name Servers (NS) are DNS servers that hold information about domains.
Every domain has one or more Name Servers (NS). Whenever a DNS server needs to resolve the IP address of a domain they are responsible for, a DNS server holding the NS record answers the query. You configure the Name Servers (NS) for a domain when you buy the domain.
Step 3: Recursive DNS Server Requests the Name Servers to Resolve the FQDN
At this stage, the recursive DNS server your device contacted has the list of name servers for the domain you want to browse. So it sends a request to one of the servers to resolve the FQDN www.melapress.com to an IP address. The DNS server checks its A records and answers with the IP. In this case, it is 192.124.249.168.
Step 4: Recursive DNS Server Replies with an IP Address
Now that the recursive DNS server your device contacted has the IP address of the FQDN www.melapress.com, it sends it back to your device.
Step 5: Your Device Connects to the Web Server
Your device connects to the web server on that IP address it received from the recursive DNS server and requests the page on www.melapress.com. The web server responds by sending the data, which your browser starts downloading and rendering.
When to access your DNS records
Managing DNS as a WordPress administrator is not something you need to do every day. In most cases, you’ll need to manage records when:
- Setting up WordPress for the first time/ registering a new domain
- Setting up services such as Google Analytics and Hotjar
- Changing hosting provider
- Getting a CDN service (such as Cloudflare)