{"id":1487,"date":"2021-05-10T13:38:51","date_gmt":"2021-05-10T10:38:51","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=1487"},"modified":"2025-11-27T13:44:04","modified_gmt":"2025-11-27T11:44:04","slug":"how-to-troubleshoot-dns-with-dig-and-nslookup","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-troubleshoot-dns-with-dig-and-nslookup\/","title":{"rendered":"Troubleshoot DNS with dig &#038; nslookup"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Amongst other users, DNS helps <\/span><b>web users connect to websites<\/b><span style=\"font-weight: 400;\"> without memorizing <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/what-is-my-ip\/\"><b>IP addresses<\/b><\/a><span style=\"font-weight: 400;\">\u2014unique numeric IDs assigned to computers to enable other computers to identify and communicate with them.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This article guides you on how to <\/span><b>troubleshoot DNS with dig and nslookup.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">But first, let\u2019s clear a few things.<\/span><\/p>\n<h2><b>Why DNS Errors Occur ?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">People often see the<\/span><b> domain name system,<\/b><span style=\"font-weight: 400;\"> DNS for short, as the internet\u2019s <span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;phone book&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:636,&quot;5&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;6&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;7&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;8&quot;:{&quot;1&quot;:[{&quot;1&quot;:2,&quot;2&quot;:0,&quot;5&quot;:{&quot;1&quot;:2,&quot;2&quot;:0}},{&quot;1&quot;:0,&quot;2&quot;:0,&quot;3&quot;:3},{&quot;1&quot;:1,&quot;2&quot;:0,&quot;4&quot;:1}]},&quot;9&quot;:0,&quot;12&quot;:0}\">phone book<\/span>. It\u2019s a network of servers that track domain names and matches them to the correct IP addresses.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When you visit a website with the domain name (<\/span><i><span style=\"font-weight: 400;\">like <\/span><\/i><a href=\"https:\/\/www.scalahosting.com\/\"><b><i>scalahosting.com<\/i><\/b><\/a><i><span style=\"font-weight: 400;\">)<\/span><\/i><span style=\"font-weight: 400;\">, your browser<\/span><b> asks the DNS server <\/b><span style=\"font-weight: 400;\">for the IP address, enabling you to connect to the website.\u00a0<\/span><\/p>\n<p><b>DNS error occurs<\/b><span style=\"font-weight: 400;\"> when the browser is unable to connect to the IP address. And one of the primary causes of this error is the <\/span><b>DNS cache\u2019s Time to Live<\/b><span style=\"font-weight: 400;\"> (<\/span><i><span style=\"font-weight: 400;\">TTL).\u00a0<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s the amount of time web admins set a packet <\/span><i><span style=\"font-weight: 400;\">(DNS information) <\/span><\/i><span style=\"font-weight: 400;\">to exist in a DNS cache before expiration\u2014this is where device operating systems or browsers <\/span><b>locally store DNS information <\/b><span style=\"font-weight: 400;\">to speed up future requests.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A DNS change doesn\u2019t often propagate in real-time &#8211; the TTL determines when and how fast it does.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When you make recent<\/span><b> changes to your <\/b><a href=\"https:\/\/www.scalahosting.com\/kb\/dns-records-explained\/\"><b>DNS records<\/b><\/a><span style=\"font-weight: 400;\">, move to a new host, or change the domain name, your website visitors will continue to see the old results or run into error until the TTL expires.<\/span><\/p>\n<h2><b>Basic Troubleshooting for DNS Issues<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Some DNS issues require basic troubleshooting to resolve.\u00a0<\/span><\/p>\n<p><b>Let\u2019s quickly take a look at them :<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Web browsers often report <\/span><b>connectivity problems as DNS issues<\/b><span style=\"font-weight: 400;\">. So always check your routers and internet connection.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Switch off your router <\/span><i><span style=\"font-weight: 400;\">(or unplug your modem<\/span><\/i><span style=\"font-weight: 400;\">) and wait for a few minutes before switching it back or reconnecting the modem.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Run malware <\/b><span style=\"font-weight: 400;\">to find out if a virus is blocking internet access.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ping the website with <\/span><a href=\"https:\/\/downforeveryoneorjustme.com\/\" rel=\"nofollow \"><b>Down For Everyone Or Just Me<\/b><\/a><b>.<\/b><span style=\"font-weight: 400;\"> If the website is down just for you, then it\u2019s a DNS problem &#8211; otherwise, it\u2019s not necessarily a DNS problem, it might be from the host.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Flush your DNS cache<\/b><span style=\"font-weight: 400;\"> to eliminate polluted DNS information.<\/span><\/li>\n<\/ul>\n<h2><b>Troubleshooting DNS With Command Line<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">If the DNS server fails to respond after <\/span><b>basic troubleshooting<\/b><span style=\"font-weight: 400;\">, then you might want to use the command line to troubleshoot the IP address the domain currently points to.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The article makes it intuitive &#8211; let\u2019s quickly examine how to go about it.<\/span><\/p>\n<h3><b>Troubleshooting With Dig on macOS and Linux<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Dig is the <\/span><b>primary command-line tool<\/b><span style=\"font-weight: 400;\"> for troubleshooting DNS issues on <\/span><b>macOS and Linux.\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">It stands for <\/span><b>Domain Internet Groper<\/b><span style=\"font-weight: 400;\">, and it enables users to dig into DNS issues from their computer rather than using web-based tools. You could learn more about <\/span><b>Dig <\/b><span style=\"font-weight: 400;\">by typing <\/span><i><span style=\"font-weight: 400;\">[man dig]<\/span><\/i><span style=\"font-weight: 400;\"> in the Linux command line.\u00a0<\/span><\/p>\n<p><b>But follow these quick steps to troubleshoot DNS issues on your macOS and Linux computers :<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Open the terminal window. Follow this navigation path to open the terminal app on macOS, Applications &gt;&gt; Utilities &gt;&gt; Terminal. If it\u2019s a Linux device, use the terminal shortcut key <\/span><b>CTRL + ALT + T<\/b><span style=\"font-weight: 400;\"> to open the window.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Run this command at the command prompt to troubleshoot the DNS<\/span> <b>dig example.com<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Replace <\/span><i><span style=\"font-weight: 400;\">example.com<\/span><\/i><span style=\"font-weight: 400;\"> with the<\/span><b> domain name you intend to test.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Dig presents DNS information as questions and answers. The <\/span><i><span style=\"font-weight: 400;\">\u2018QUESTION SECTION<\/span><\/i><span style=\"font-weight: 400;\">\u2019 shows the requests while the \u2018<\/span><i><span style=\"font-weight: 400;\">ANSWER SECTION\u2019 <\/span><\/i><span style=\"font-weight: 400;\">displays the response to the requests.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Below is an example of <\/span><b>Dig information for the domain,<\/b> <i><span style=\"font-weight: 400;\">example.com<\/span><\/i><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-1488\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_48.png\" alt=\"Troubleshoot DNS with dig &#038; nslookup, Troubleshooting With Dig on macOS and Linux\" width=\"547\" height=\"320\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_48.png 547w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_48-300x176.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">In the<\/span><i><span style=\"font-weight: 400;\"> QUESTION SECTION<\/span><\/i><span style=\"font-weight: 400;\">, we could see the Dig command looks up for the <\/span><b>A record<\/b><span style=\"font-weight: 400;\"> of example.com, and the <\/span><i><span style=\"font-weight: 400;\">ANSWER SECTION<\/span><\/i><span style=\"font-weight: 400;\"> shows the domain points to I<\/span><b>P address 93.184.216.119.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If you wish to use a <\/span><b>specific DNS server<\/b><span style=\"font-weight: 400;\"> for the query, then you\u2019d need to include the <\/span><b>@<\/b><span style=\"font-weight: 400;\"> option in the dig command, and here\u2019s an example, <\/span><b>dig @208.67.222.222 example.com<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The command <\/span><b>performs a DNS lookup<\/b><span style=\"font-weight: 400;\"> for the domain, <\/span><i><span style=\"font-weight: 400;\">www.example.com<\/span><\/i><span style=\"font-weight: 400;\"> using an <\/span><b>OpenDNS server<\/b><span style=\"font-weight: 400;\"> with the IP address 208.67.222.222.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">OpenDNS is an American company that provides DNS resolution services.\u00a0 The company allows users to use its <\/span><b>DNS servers for DNS lookup<\/b><span style=\"font-weight: 400;\"> instead of relying on ISPs\u2019 DNS servers or locally installed DNS servers.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">Note<\/span><\/i><b><i>:<\/i><\/b><i><span style=\"font-weight: 400;\"> Dig command displays the <\/span><\/i><a href=\"https:\/\/www.scalahosting.com\/kb\/how-to-add-a-dns-a-record\/\"><b><i>A record<\/i><\/b><\/a><i><span style=\"font-weight: 400;\"> of a domain by default. If you wish to look up a different DNS record, you could specify that at the end of the command-line thus, <\/span><\/i><i><span style=\"font-weight: 400;\">dig example.com MX<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">This command-line looks up the MX<\/span><i><span style=\"font-weight: 400;\"> (mail exchanger) <\/span><\/i><span style=\"font-weight: 400;\">records of the domain, <\/span><i><span style=\"font-weight: 400;\">example.com<\/span><\/i><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><b>Troubleshooting With nslookup<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The nslookup program helps windows users to <\/span><b>troubleshoot DNS issues<\/b><span style=\"font-weight: 400;\"> using the command-line.\u00a0<\/span><\/p>\n<p><b>Follow these steps to get started :<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Press the <\/span><b>Windows key and R <\/b><span style=\"font-weight: 400;\">on your keyboard to open the Run interface.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Type <\/span><b>cmd <\/b><span style=\"font-weight: 400;\">on the search bar and press the <\/span><b>Enter key<\/b><span style=\"font-weight: 400;\"> to open the DOS command window.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Run this command at the command prompt to troubleshoot the <\/span><b>DNS <\/b><b>nslookup example.com<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Replace <\/span><i><span style=\"font-weight: 400;\">example.com<\/span><\/i><span style=\"font-weight: 400;\"> with the domain name you intend to test.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Check out how the <\/span><b>nslookup program presents its outputs.<\/b><span style=\"font-weight: 400;\"> Below is the nslookup information for <\/span><b>google.com.<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-1489\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_55.png\" alt=\"Troubleshoot DNS with dig &#038; nslookup, Troubleshooting With nslookup\" width=\"437\" height=\"286\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_55.png 437w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/05\/2021-05-10_13h35_55-300x196.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">According to the nslookup information, google.com currently points to <\/span><b>216.58.223.206<\/b><span style=\"font-weight: 400;\">, and the DNS server used for the query is unknown, but the <\/span><b>IP address is 10.109.7.113<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">Note<\/span><\/i><b><i>:<\/i><\/b><i><span style=\"font-weight: 400;\"> you could also use the<\/span><\/i><b><i> @ option<\/i><\/b><i><span style=\"font-weight: 400;\"> in the nslookup command if you wish to use a <\/span><\/i><b><i>specific DNS server<\/i><\/b><i><span style=\"font-weight: 400;\"> for the query. nslookup also looks up the A records of a domain by default.<\/span><\/i><\/p>\n<p><b>Use this command to look up a different DNS record:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">set type=MX<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">example.com<\/span><\/li>\n<\/ul>\n<h2><b>Wrapping it Up<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">This article outlines easy steps to troubleshoot DNS issues on Windows, macOS, and Linux operating systems using<\/span><b> the command line.\u00a0<\/b><\/p>\n<p><b>However, you could use these web-based options if you\u2019re not comfortable with the command line:<\/b><\/p>\n<ul>\n<li aria-level=\"1\"><a href=\"https:\/\/www.dnsstuff.com\/\" rel=\"nofollow\"><b>DNS Stuff<\/b><\/a><\/li>\n<\/ul>\n<ul>\n<li aria-level=\"1\"><a href=\"https:\/\/mxtoolbox.com\/\"><b>MX Toolbox<\/b><\/a><\/li>\n<\/ul>\n<ul>\n<li aria-level=\"1\"><a href=\"https:\/\/dnsquery.org\/keep-us-free\" rel=\"nofollow\"><b>DNS Query<\/b><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amongst other users, DNS helps web users connect to websites without memorizing IP addresses\u2014unique numeric IDs assigned to computers to enable other computers to identify and communicate with them. This article guides you on how to troubleshoot DNS with dig and nslookup. But first, let\u2019s clear a few things. Why DNS Errors Occur ? People [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Troubleshoot DNS with dig & nslookup | ScalaHosting KB","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_analysis_target_kw":"","footnotes":""},"categories":[22],"tags":[],"class_list":["post-1487","post","type-post","status-publish","format-standard","hentry","category-dns"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/1487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=1487"}],"version-history":[{"count":6,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/1487\/revisions"}],"predecessor-version":[{"id":5865,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/1487\/revisions\/5865"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=1487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=1487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=1487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}