Linux Commands

Commonly Used DNS with Example Usage

DNS servers are how the internet exists. It’s through DNS that the hostnames and domain names are resolved to get their IP addresses. Each system has default tools to troubleshoot the DNS errors. For system administrators, resolving the DNS issues is a common task.

This post highlights the different tools that you can use to troubleshoot and check your DNS. We will mention the tool and give an example of its usage.

Six Commonly Used DNS Tools with Example Usage

Various tools come in handy in checking and troubleshooting the DNS. Besides, you can use the same tools to extract the DNS details of specified domains or host names.

DNS refers to the domain name system. A DNS server handles the matching IP addresses to their respective domain names. That being said, here are the six commonly used DNS tools in Linux.

Whois

The whois DNS tool comes with a command line and graphical interface. It offers an easy and quick way of checking the nameserver, registrar and the domain name owner. With whois, you can know when a domain is registered, provided that its domain registration is public.

With whois, you can quickly query the details of a problematic domain name. On Ubuntu, you must first install the whois package before you use it:

$ sudo apt install whois

Let’s retrieve the DNS details of the linuxhint.com domain. The output gives us all the registrar details of the specified domain.

You can also visit the whois website and type the name of your target domain.

Once you press the search button, you will get an output which is similar to the one that we got earlier using the whois command line tool.

Dig

Dig stands for domain internet groper. It is an excellent tool to query the DNS servers and troubleshoot the related issues. Furthermore, dig is excellent at verifying the DNS records. There are various options that you can combine to get more DNS details.

For instance, we can query the record for the linuxhint.com domain:

$ dig linuxhint.com

You can check and verify the generated DNS details of the target domain name from the output.

Traceroute

Traceroute is the ideal option when you want to check the path to connect you to a domain name. The traceroute DNS tool gives the path for all hops between you and the target domain name. If there is a DNS error, the traceroute shows at what point the transmission of packets failed.

Suppose the traceroute is not available on your system; start by installing it. Here’s how to install it on Ubuntu:

$ sudo apt install traceroute

Let’s have an example of the traceroute for google.com. The output shows the total hops between the system, the domain, and the path which are taken to reach it.

Ping

When troubleshooting the DNS, you need a tool that lets you check if a server is online. Luckily, ping is perfect to check the status of a server and check if there is any packet loss during transmission. With ping, you can specify the domain name or the IP address.

Here’s an example to ping the linuxhint.com domain:

$ ping linuxhint.com

From the output, we confirm that the server is active and is transmitting the packets without loss.

Nslookup

With the nslookup tool, you can extract the DNS query information of a domain. Still, you can use it to convert the specified domain name to its IP address.

The following example is the nslookup for the Google domain:

$ nslookup google.com

Host

The host DNS lookup tool comes in handy in reverse lookups. You can use it with the domain name or to check the host that is assigned to a given IP. Here, we check the DNS lookup for Google. Then, we use the retrieved IP to do a reverse lookup.

Conclusion

There are various DNS tools that you can use when you want to extract the DNS information of a given domain or IP. This post presented six commonly used DNS tools that you can use to troubleshoot the DNS issues and check the DNS records. Try them out and settle on the one that suits you best.

About the author

Denis Kariuki

Denis is a Computer Scientist with a passion for Networking and Cyber Security. I love the terminal, and using Linux is a hobby. I am passionate about sharing tips and ideas about Linux and computing.