Troubleshooting DNS Issues {nslookup, dig, host & More} (2024)

Introduction

DNS (domain name system) stores information related to domain names as a distributed database. The client-server service translates domain names to IP addresses and vice versa.

Most other network services, such as Web, emails, and file transfer, use DNS. A misconfigured DNS server can lead to critical connectivity issues. Thankfully, troubleshooting DNS issues is a vital and relatively simple process to follow.

Follow this tutorial to learn the practical steps in troubleshooting DNS issues.

Troubleshooting DNS Issues {nslookup, dig, host & More} (1)

Prerequisites

  • A stable internet connection.
  • Access to the command line/terminal.
  • A user account with administrator/sudo privileges.

Note: Follow our tutorial to set up a DNS nameserver on Ubuntu.

DNS Troubleshooting

DNS troubleshooting follows logical steps from basic network troubleshooting to more in-depth analysis. Network services often report DNS issues for reasons that do not require in-depth DNS troubleshooting.

If you are experiencing DNS issues, start by performing the following steps before going on to in-depth troubleshooting:

  • Check cables

If using a wired connection, make sure everything is connected properly. On wireless networks, check if WiFi is turned on and connected. Check the router if all cables are functional. Try to switch ports for ethernet cables and test out the connection.

  • Restart router

Turn the router off and wait for at least two minutes before turning it on again. Wait until the router fully boots up before rechecking the connection.

  • Scan for malware

Viruses sometimes block an internet connection. Run a scan to see if anything suspicious appears and handle accordingly.

  • Check the website

If the problems arise when connecting to a particular website or a part of the website, check if the connection problem is with the website itself. One way to do this is using the ping command.

Troubleshooting DNS Issues {nslookup, dig, host & More} (2)

The command output helps identify the reason for the connection problem:

1. If ping does not show a response, the issue is most likely on the server's end.

2. A common cause of an error in the response is a poorly configured DNS server or firewall restrictions. Learn how to resolve the "Temporary failure in name resolution" error.

3. If the output shows a response, the problem is most likely with the DNS.

The comprehensive list below provides valuable tips for troubleshooting DNS issues.

Check TCP/IP Settings

Misconfigured DNS server addresses are a common issue. Reset the settings and check if communication is back to normal. Depending on which OS you're using, the steps are different.

For Windows:

1. Search for Network Status in the Start menu and open the tool.

Troubleshooting DNS Issues {nslookup, dig, host & More} (3)

2. Select Properties under the network connection details.

Troubleshooting DNS Issues {nslookup, dig, host & More} (4)

3. Click the Edit button to change the IP settings.

Troubleshooting DNS Issues {nslookup, dig, host & More} (5)

4. If the IP assignment is Manual, double-check the IP, Preferred, and Alternate DNS addresses. Change IP assignment by selecting Automatic (DHCP) from the dropdown menu to reset back to normal.

Troubleshooting DNS Issues {nslookup, dig, host & More} (6)

5. Save the settings when finished.

For Linux:

1. Click the connection icon in the top-right corner.

Troubleshooting DNS Issues {nslookup, dig, host & More} (7)

2. Open the menu and select Wired Settings.

Troubleshooting DNS Issues {nslookup, dig, host & More} (8)

3. Click the gear icon in the connection pane to open the settings.

Troubleshooting DNS Issues {nslookup, dig, host & More} (9)

4. Navigate to the IPv4 tab in the settings menu.

5. If manually assigned, double-check the Address and DNS IP address list. Select the Automatic (DHCP) option and change the DNS switch to Automatic to reset back to normal.

Troubleshooting DNS Issues {nslookup, dig, host & More} (10)

Apply the settings when finished and close the window. Lastly, check the connection to ensure everything functions correctly.

Note: Learn how to install and use PowerDNS on Ubuntu, an open-source DNS server solution that helps resolve namespaces.

Flush the DNS Cache

IP mapping to popular websites is often the target of malicious attacks. DNS caches information to improve loading speed, and it might have cached a wrong address. Clearing the DNS cache deletes all the lookup information and updates with subsequent requests.

Flushing DNS cache is a good security measure to take in general. Follow our tutorial for detailed and OS-specific instructions: .

Release and Renew DHCP Server IP

Releasing and renewing the IP address helps resolve an IP conflict and old DNS information by refreshing the cached information. The easiest way to accomplish a release and renewal is through the command prompt/terminal.

Warning: Resetting the IP disconnects the computer from the internet.

To renew the IP on Windows using the command prompt:

1. Run the following commands to release the current IP and renew the information:

IPCONFIG /RELEASEIPCONFIG /RENEW

2. Check the new information with:

IPCONFIG /ALL

To force IP renewal on Linux via the terminal:

1. Open the terminal and release the current IP with the following command:

sudo dhclient -r

The terminal outputs a confirmation message, and the connection is closed.

2. Run dhclient without any options to renew the IP:

sudo dhclient
Troubleshooting DNS Issues {nslookup, dig, host & More} (11)

Change to Public DNS Servers

Change the DNS servers to public domain addresses. Some standard options are:

  • Google's 8.8.8.8 address as primary and 8.8.4.4 as secondary.
  • Cloudflare's 1.1.1.1 address as primary and 1.0.0.1 as secondary.

Public domain addresses are generally reliable and are available for free. However, use this only as a temporary resolution.

On the other hand, some public domain DNS servers block traffic from malicious websites. A public DNS might detect a flagged website as suspicious, and the public DNS you're using might be blocking access.

Use dig

The dig command (domain information groper) provides DNS information and helps in diagnosing issues. The utility's raw output makes it the preferred method for troubleshooting DNS issues.

The program is available on macOS and Linux by default and is free to install on Windows.

To get dig information for a domain, run the following command in the terminal:

dig <domain name or IP>

Note: Using an IP address performs a reverse DNS lookup.

For example, to show the information for phoenixnap.com, run:

dig phoenixnap.com
Troubleshooting DNS Issues {nslookup, dig, host & More} (12)
  • The status shows whether a query was successful.
  • The ANSWER SECTION shows a response to a request sent in the QUESTION SECTION.
  • The SERVER displays the address for the public DNS server.

By default, dig looks up the A record for a domain and shows which IP address the domain points to when resolving the name.

The dig tool offers many advanced options for comprehensive searches. For example, add the +trace tag to see the full path to the destination:

dig phoenixnap.com +trace
Troubleshooting DNS Issues {nslookup, dig, host & More} (13)

The +trace option helps pinpoint traffic drops in the route to the destination.

To check the delegated name servers, use the ns option:

dig phoenixnap.com ns
Troubleshooting DNS Issues {nslookup, dig, host & More} (14)

Use the ns option to help identify and troubleshoot delegation problems.

Use nslookup

The nslookup command provides functions for checking different DNS records and servers. The tool is available on macOS, Linux, and Windows operating systems by default, and it was the first tool for querying DNS.

To get nslookup information for a domain, use the following command in the command line/terminal:

nslookup <domain name or IP>

For example, run nslookup for phoenixnap.com:

nslookup phoenixnap.com
Troubleshooting DNS Issues {nslookup, dig, host & More} (15)

The output prints the DNS server's address and the A record response. The nslookup command is preferable for Windows because of its availability.

Note: Learn how to improve website performance significantly by reducing DNS lookups.

Use host

The host utility is a straightforward program for performing a DNS lookup. The command is available for macOS and Linux systems.

The basic syntax for host is:

host <domain name or IP>

For example:

host phoenixnap.com
Troubleshooting DNS Issues {nslookup, dig, host & More} (16)

The host command is excellent for quickly checking if a domain name exists and resolves to an address. A typical use case for host is in bash scripts.

Use additional options to display more information. For example, add the -a tag to see a similar output to the dig command:

host -a phoenixnap.com
Troubleshooting DNS Issues {nslookup, dig, host & More} (17)

The output shows additional information in the answer section, such as the NS, SOA, MX, and other available records.

Use traceroute or tracert

The traceroute and tracert tools help trace a route from source to destination. When troubleshooting DNS issues, the commands help identify where packets stopped on the network. The traceroute command is available on macOS and Linux, while the Windows equivalent is tracert.

Note: Install the traceroute tool using the apt package manager:

sudo apt install traceroute

As a readily available and simpler alternative, use tracepath.

To map the network, run the following command in the terminal:

traceroute <domain name or IP>

If using a Windows machine, run:

tracert <domain name or IP>
Troubleshooting DNS Issues {nslookup, dig, host & More} (18)

For more information on the traceroute/tracert command and how to read the output, check our comprehensive tutorial on .

Contact Your ISP

If the computer uses the ISP's DNS, you cannot resolve the issues on your end. Contacting the ISP helps determine the problem and pinpoint the difficulties on their end.

Conclusion

At the end of this guide, you should have several tools and tricks to help you resolve DNS issues. If you're looking to set up your DNS server at home to speed up your connection, try following our Raspberry Pi tutorial on How to Set Up Raspberry Pi as a DNS Server. Also, check out our guide to learn about one of the common DNS errors "DNS_PROBE_FINISHED_BAD_CONFIG" and how to fix it.

Troubleshooting DNS Issues {nslookup, dig, host & More} (2024)

FAQs

How to troubleshoot DNS with dig? ›

Use your web browser to visit http://www.digwebinterface.com.
  1. In the Hostnames or IP addresses text box, type the domain that you want to test.
  2. Under Options, select the Show command check box.
  3. Under Nameservers, select the server that you want to use for the DNS query. ...
  4. Click Dig.

How to troubleshoot a DNS issue? ›

DNS failure? Try these DNS troubleshooting basics.
  1. Clear the cache. ...
  2. Reboot your computer. ...
  3. Check your hardware and wires. ...
  4. Run a wizard. ...
  5. Run an antivirus scan. ...
  6. Check DHCP (Dynamic Host Control Protocol) ...
  7. Reach out to the experts.
Jun 5, 2023

Which command is used when troubleshooting DNS issues? ›

The nslookup command is helpful in diagnosing issues with DNS name resolution. This command is comparable to Mac or Linux's dig function. It can find the IP address of a host or perform a reverse DNS lookup (to find the domain name of an IP). Nslookup can also provide information on DNS records for your domain.

What is the difference between dig and nslookup? ›

Nslookup offers the fundamental DNS data, dig supports a wider variety of record types. Nslookup is less suited for in-depth DNS investigation because it largely concentrates on querying A and PTR records.

How to test if DNS is working correctly? ›

Run ipconfig /all at a command prompt, and verify the IP address, subnet mask, and default gateway. Check whether the DNS server is authoritative for the name that is being looked up.

How do I use nslookup to resolve DNS? ›

This tool can be used to check DNS records propagation and resolution using different servers and perform other troubleshooting steps.
  1. Open Command prompt. ...
  2. Type nslookup and hit Enter. ...
  3. Type nslookup domain_name and the command will return the A record for the domain you ran a query for.
Oct 11, 2023

How to check DNS is resolving or not? ›

Check DNS settings
  1. For Linux, use the resolvectl status command to display the configured name resolution servers. ...
  2. For macOS, type scutil --dns to display the configured name resolution servers. ...
  3. For Windows, type ipconfig /all to display the configured name resolution servers.
Aug 2, 2022

What is the alternative to dig? ›

drill can be used as a drop-in replacement for dig .

How do I clear DNS issues? ›

How to Flush DNS
  1. Open Command Prompt as an administrator.
  2. Type ipconfig /flushdns and press Enter.
  3. You'll see a message confirming the DNS cache has been flushed.
Dec 15, 2023

How to fix DNS address not found? ›

How to fix the “Server DNS address could not be found” error
  1. Select the Start button, then type cmd.
  2. Right-click Command Prompt, then choose Run as Administrator.
  3. Type ipconfig /flushdns and press Enter.
  4. Type ipconfig /registerdns and press Enter.
  5. Type ipconfig /release and press Enter.
  6. Type ipconfig /renew and press Enter.

What are symptoms of bad DNS? ›

Symptoms of DNS Server Issues

These include slow or unresponsive web browsing, frequent webpage timeouts, error messages indicating DNS failures, or even complete internet disconnection. By familiarizing yourself with these signs, you can quickly diagnose and resolve the issue.

How to use nslookup to troubleshoot? ›

Troubleshooting With nslookup
  1. Press the Windows key and R on your keyboard to open the Run interface.
  2. Type cmd on the search bar and press the Enter key to open the DOS command window.
  3. Run this command at the command prompt to troubleshoot the DNS nslookup example.com.

How to fix DNS using Command Prompt? ›

How Can I Reset My DNS Server? Open your computer's command prompt app. On Windows, type ipconfig /flushdns, press enter, and restart your computer. On Mac, type lookupd -flushcache (Mac OSX 10.4 and earlier versions) or dscacheutil -flushcache (Mac OSX 10.5 and newer versions), press enter, and restart your computer.

Which of these are correct tool to troubleshoot DNS related issues? ›

Dig command

It's a useful tool for finding DNS-related issues.

How do I dig for DNS? ›

Perform an rDNS Lookup

There are various methods to perform a reverse DNS lookup.In Windows machines, you can use the nslookup command to perform rDNS lookup. Here is the command format. In Linux machines, you can use the dig command with the -x flag. dig -x <IP address > ~$ dig -x 8.8.

How do you investigate DNS tunneling? ›

To detect DNS tunneling in your network you need to examine long DNS queries and uncommon DNS query types, distinguish between legitimate security solutions as AVs and malicious traffic, and distinguish between human-generated DNS traffic and Bot-generated traffic.

How to troubleshoot DNS issues in Linux? ›

How to Troubleshoot Common DNS Issues in Linux Environments
  1. DNS Configuration Errors. Misconfigurations in /etc/resolv. ...
  2. DNS Cache Problems. Issues with local DNS caching, such as using nscd or dnsmasq , can lead to stale or incorrect DNS data.
  3. Firewall Blocking. ...
  4. Network Interface Issues. ...
  5. Incorrect Permissions.
Jan 22, 2024

Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 6335

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.