How To Troubleshoot DNS in Linux

In this article, we want to teach you How To Troubleshoot DNS in Linux.

DNS stands for Domain Name System. It lets you connect to the websites by human-readable domain names like with the unique ID of the server where a website is stored.

Think that DNS is the internet’s phonebook. It lists domain names with their IP addresses. When a user enters a domain name like, it looks up the IP address and connects them to the physical location where that website is stored.

How To Troubleshoot DNS in Linux

If the DNS doesn’t appear to be updating and resolving correctly, stay with us to show you how to troubleshoot DNS.

Here is some basic DNS troubleshooting in Linux:

  1. First, you need to collect information that has created the problem by doing some investigation like logs, debug messages and etc.
  2. Prepare your required tools for DNS troubleshooting.
  3. Troubleshooting considers so many issues that may cause the problem and work one by one to point to the actual person who created the issue.
  4.  When the issue is found, you have to work on that with the tools, commands, logs, and all other resources to resolve it.

In order to troubleshoot DNS, follow these steps to resolve the DNS issue in Linux:

Check DNS server is configured correctly or not

If your client is unable to resolve hostnames to IP addresses, you need to open the /etc/resolv.conf file and check the name server is configured correctly.

Open the file with the following command, you can use your favorite text editor, here we use vi:

vi /etc/resolv.conf

If the client is configured with the correct DNS server follow the next step. If not, change it to the right one.

Ping the DNS server IP

At this point, you can ping the DNS server IP with the following command:

ping server-ip-address

If pinging is not happening, you need to do network troubleshooting.

If pinging is happening, there is a communication path between server-client. So, you need to check whether the DNS server in Linux is running or not.

You can use the NMAP tool to check what ports opened on the server.

Use NMAP to check the DNS server in Linux

One way to troubleshoot DNS in Linux is using Nmap. You can use the Nmap command to see which services are running and which ports are opened on the remote server.

Note: For more details about Nmap, you can follow this article about How to Install and Use Nmap on Linux.

nmap server-ip-address

If the DNS server is running and working fine, you should see the DNS port(53) in the list of the opened ports.

Otherwise, if the server is not running and the port is blocked, you can troubleshoot it in this way:

Check the named.conf and DNS zone files for syntax errors. you can use the following command to check the named.conf file:

#named-checkconf configuration-file-location

When you run this command, it will show you the errors if any according to the line number, so it’s very much easy to check where we did the mistake.

To check the DNS zone files in Linux you can use the following command:

#named-checkzone domain-name zone-file-location 

Now you check for the issue in deep.

Check DNS server issue

At this step, you can troubleshoot DNS in Linux in deep.

With the following command, you can check under who is the DNS server is registered and its properties:


To check what server is used to resolve and some basic info you can use the following command:


Also, to check who is resolving and what is resolving in detail about the DNS server, you can use the following command:



At this point, you learn some basic ways to troubleshoot DNS from this part of the Linux Tutorials.

Hope you enjoy this article about How To Troubleshoot DNS in Linux.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!