A browser can fail to load a site before it ever reaches the web server. On a Linux desktop, Wireshark can reveal which DNS lookup failed and match the resolver's error reply to the original query in a saved capture.

A resolver can report NXDOMAIN when the name does not exist or SERVFAIL when it cannot complete the lookup. A timeout leaves no reply to filter. Encrypted DNS must be decrypted before Wireshark can read its response code.

Several DNS queries can be in flight at the same time, and a transaction ID can be reused. Wireshark links a reply to its request in the capture, so the packet order alone is a poor way to match them.

Steps to find failed DNS lookups in Wireshark:

Start on the GNOME desktop with a saved PCAP or PCAPNG file containing the DNS exchange you want to inspect and Wireshark's default layout.

  1. Click the Activities indicator at the left of the top bar.
  2. Type Wireshark in the Activities search.
  3. Open Wireshark from the search results.
  4. Click File in Wireshark's menu bar.
  5. Choose Open from the File menu.
  6. Type the full path to your capture in File name, replacing any existing value.

    The file shown is /home/reader/Documents/captures/web-traffic.pcapng. A Read filter can exclude the original query as the file opens, so the dialog should have an empty Read filter. Saved captures can contain private hostnames and payloads.

  7. Press Enter to open the capture.

    The file is ready when its name appears in the title bar and the packet list is populated.

  8. Maximize Wireshark with its title-bar button if the window does not fill the screen.

    The larger packet details pane has room for the DNS reply code, queried name, and transaction ID.

  9. Click the display filter field above the packet list.
  10. Enter the following expression in the display filter field, replacing any existing text.
    dns.flags.response == 1 && dns.flags.rcode != 0

    The expression matches DNS replies with a nonzero response code in the DNS header.

  11. Press Enter to apply the display filter.
  12. Select a DNS reply in the filtered packet list.

    The capture shown has one matching reply, frame 32. An empty list means the capture contains no decoded reply matching the filter.

  13. Expand Domain Name System (response) in the packet details pane if it is collapsed.
  14. Expand Flags under Domain Name System (response) if it is collapsed.
  15. Scroll down in the packet details pane just far enough to show Reply code with Flags still in view if the code is off-screen.
  16. Read Reply code under Flags.

    Frame 32 shows No such name (NXDOMAIN, code 3). SERVFAIL appears as Server failure (code 2).

  17. Collapse Flags to bring the rest of the DNS details back into view.
  18. Expand Queries in the DNS details if it is collapsed.
  19. Note the queried name and Transaction ID in the reply's DNS details.

    Frame 32 carries the name missing.example.test and transaction ID 0x605f.

  20. Click the Clear button (X) at the right end of the display filter field.

    Clearing the filter restores the queries to the packet list and keeps the selected reply open in the details pane.

  21. Double-click the Request In link in the selected reply's DNS details.

    In the capture shown, the link leads to frame 31. If the link is absent, Wireshark has no matching request in the capture to jump to.

  22. Confirm that the selected DNS query has the same queried name and Transaction ID as the failed reply.

    Frame 31 shows missing.example.test and 0x605f under Domain Name System (query). Its Response In: 32 link points back to the failed reply.

Share this guide