Skip to content
Tutorials Center
My learning

Topics

Lesson 22 of 37 ยท Troubleshooting Networks

Diagnosing DNS and DHCP Problems

Find DNS failures, slow lookups and DHCP issues in Wireshark: read response codes, measure query time, follow the DORA exchange and spot rogue servers.

"The internet is down" often means "names do not resolve" or "my computer has no address". Both are easy to prove in a capture because DNS and DHCP are short, well-structured exchanges. This lesson shows what a healthy exchange looks like, so you can spot a broken one quickly.

It continues from Slow Networks. Output is read-only example text; the Python blocks are stand-ins that parse sample records.

DNS: query, response, and response codes

A DNS lookup is one UDP packet out and one back (port 53). Each response carries a response code (rcode):

rcode Name Meaning
0 NOERROR Success (the answer section may still be empty)
2 SERVFAIL The resolver could not get an answer, for example a broken upstream or DNSSEC problem
3 NXDOMAIN The name does not exist
5 REFUSED The server refuses to answer this client

Useful filters:

TEXT
dns                              # all DNS
dns.flags.response == 0          # queries only
dns.flags.rcode != 0             # failed lookups
dns.qry.name contains "example"  # a specific name
dns.time > 0.5                   # responses slower than 500 ms

Wireshark links each response to its query and gives dns.time, the delay between them. A lookup that takes 800 ms makes every web page feel slow, because browsers wait for it before connecting.

TEXT
 14  0.000  10.0.0.20 -> 10.0.0.1  DNS  Standard query 0x3a1f A shop.example.com
 15  0.812  10.0.0.1 -> 10.0.0.20  DNS  Standard query response 0x3a1f A shop.example.com A 203.0.113.9
Python Summarize DNS lookups from sample records

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Typical DNS findings

  • Repeated queries, no responses: the resolver is unreachable, or a firewall blocks UDP 53. The client retries (often after 1 s, then 2 s) before trying the next resolver.
  • NXDOMAIN for odd names: a typo, a stale search suffix, or software looking up a name that was removed. Many NXDOMAINs for random-looking names can also indicate malware, covered in Malware Traffic and Beaconing.
  • Responses from an unexpected address: the answer came from a different IP than the one queried, a sign of misconfiguration or interference.
  • Search suffix storms: names like server.corp.local.corp.local mean the client appends suffixes to every short name.

DHCP: the four-step DORA exchange

DHCP gives a host its IP address, router, DNS servers and lease time. It uses UDP ports 67 (server) and 68 (client). The client has no address yet, so it broadcasts.

sequenceDiagram
    participant C as Client
    participant S as DHCP server
    C->>S: Discover (broadcast)
    S->>C: Offer (address, lease)
    C->>S: Request (accept this offer)
    S->>C: Acknowledge

Discover, Offer, Request, Acknowledge (DORA).

Filter with dhcp (older versions call it bootp). Inspect options such as dhcp.option.dhcp == 2 for an Offer, and the options list for router (3), DNS servers (6) and lease time (51).

What goes wrong:

  • Discover with no Offer: server down, wrong VLAN, or the DHCP relay (giaddr) is misconfigured.
  • Offer received, but no Request: the client rejected it, often because it already has a conflicting address.
  • NAK: the server refuses the request, typically because the client asked for an address on the wrong network (a laptop moved between subnets).
  • Two Offers from different servers: a second DHCP server on the network. A rogue server can hand out a wrong gateway or DNS server and redirect traffic. Compare the server identifier (dhcp.option.dhcp_server_id) across Offers.
  • Addresses starting with 169.254: the client gave up and self-assigned a link-local address.
Python Spot a second DHCP server

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Putting it together

When a user says "no internet", capture on that machine and ask, in order: did it get an address (DHCP)? Can it resolve names (DNS)? Can it reach the destination (TCP handshake)? The first step that fails is where to dig.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which DNS response code means the name does not exist?

    NXDOMAIN (rcode 3) is the authoritative statement that the queried name does not exist.
  2. 2. Which filter shows only failed DNS lookups?

    A non-zero rcode means an error such as SERVFAIL, NXDOMAIN or REFUSED.
  3. 3. What is the correct order of a DHCP exchange?

    DORA: the client discovers, the server offers, the client requests, the server acknowledges.
  4. 4. Two Offers with different server identifiers answer one Discover. What should you suspect?

    Only one authorized server should answer in most networks, so an unknown one needs investigation.

Summary

  • DNS problems show as non-zero response codes, slow dns.time, or no response at all.
  • DHCP follows Discover, Offer, Request, Acknowledge; check where the exchange stops.
  • Two DHCP servers on one network are a configuration error or a security risk.
  • Always test in order: address, name resolution, connectivity.

Next: TCP Windows, Resets and Stalled Connections