Troubleshooting the DNS name resolution issues – Tools used for DNS problems

Let us explore the ways we do troubleshooting the DNS name resolution issues which could have been leading to a situation where you would be having an issues accessing to the server, switches and any other networking devices.

What is a DNS ?

Name resolution is the process of relating easy-to-remember names with difficult-to-remember Internet Protocol (IP) addresses. The Domain Name System (DNS) provides name resolution services in most environments. These internal servers host a dynamic database of names and related IP addresses. These names may be as simple as hostnames or as complex as fully qualified domain names and web URLs.

DNS servers host resource records such as start of authority (SOA), name server (NS), and mail exchange (ME). The two most common record types are A and pointer records (PTR). The A records service forwards lookup requests, specifying that a given name is related to a particular IP address. PTR maps an IP address to a particular name. When a forward lookup query arrives, it is serviced by the A record for that name. When a reverse lookup query arrives, the PTR  for that IP address services it.

DNS name resolution issues

So you may be wondering what prompts you to suspect a name resolution problem? It may have started with someone commenting that they cannot access file server or printer, or an email server seems unavailable. There can be chance the user may experience intermittent difficulty accessing an internal web server. Even if he is connected he may lands up a wrong web server.

Let us explore how we can troubleshoot these issues while getting accustomed to some useful tools for DNS related issues

Tools Required

Below can be the useful list of tools that we may use to troubleshoot DNS issues

  • ping
  • nslookup
  • dig
  • host

We need to ensure that these command (packages) are already installed on our linux systems. The ping is generally installed on all linux system but for other we may need to install them. You can get it installed using the yum/dnf package managers

$ sudo dnf install bind-utils

Using the ping

This command can help isolating the issues of the DNS. This is one of most commonly used command on any linux systems to check the availability of the IP or the Hostname over the network.

So let us check the connectivity by hostname with an assumption that host named host01 with an IP address of 192.168.255.126

$ ping -c 3 host01

If the above succeeds and name resolution works, you will not need to continue along this line of testing. If this test fails, try the ping command with the remote IP address:

$ ping -c 3 192.168.255.126

If the above works it means connectivity exists. Now at this stage we can move forward to troubleshoot why the name resolution is failing

Please note if the ping by the IP has failed then its a network related issues and you can proceed to make sure first you get the connectivity established. So in short ping helped us to established if its really a DNS issues or it was a network connectivity issues.

Using the nslookup

Nslookup is the name of a program that lets users enter a host name and find out the corresponding IP address or domain name system (DNS) record. Users can also enter a command in nslookup to do a reverse DNS lookup and find the host name for a specified IP address.

In this blog article we will focus on non-interactive mode since it most closely resembles the functionality of dig and host.

Type nslookup and the destination name (or URL) you need to resolve:

$ nslookup host01

This output will display the IP address for host01, along with information about which server resolves the name. If this fails, it indicates a name resolution problem.

Perform a reverse lookup (resolving a known IP address to an unknown name) :

$ nslookup 192.168.255.126

To check the specific resource record we can use the below Command

$ nslookup -type=MX linuxquery.org

Using the dig

This commands enables us to make manual resolution queries. It provides much more details about the result hence preferred by many of the administrator

Forward lookup looks like :

$ dig host01

Reverse lookup looks like below

$ dig -x 192.168.255.126

You can also query the name server for specific records

$ dig linuxquery.org MX

This resolves the required server domain name linuxquery.org

Using the host

This also serves as most simple commands to check the hostname resolution.

Syntax for forward resolution

$ host host01

Syntax for Reverse lookup

$ host 192.168.255.126

When Querying for SOA records

$ host -C linuxquery.org

If you need to display the specified record type you can use the -t option.

$ host -t mx linuxquery.org

If you’re not sure which record types you need or if you want to see them all, use the -a (any) option:

$ host -a linuxquery.org

Conclusion

So we saw that to an extent the nslookupdig, and host provide the similar information. So you can choose based on your convenience any of those tool next time when you are into some DNS resolution issues. It can be handy if you have all the above tools installed. Best way to start is ping followed by any of the resolution tools.

You cab refer the BIND 9 for more details on the DNS.

Leave a comment