Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 37 ยท Protocol Analysis

DHCP and Other Everyday Protocols

Read the DHCP discover, offer, request and acknowledge exchange with options in Wireshark, and recognize NTP, mDNS, SSH, FTP, SMTP, SMB and other common protocols.

A typical office or home network capture contains far more than web traffic. Before any browsing, a device asks for an IP address with DHCP. Behind the scenes there are time sync, name discovery, file sharing and management protocols. Recognizing the common ones quickly lets you separate normal background chatter from the traffic you are hunting.

DHCP: how a device gets an address

The Dynamic Host Configuration Protocol gives a client an IP address, subnet mask, default gateway, DNS servers and a lease time. It runs over UDP: the client uses port 68, the server port 67. (DHCPv6 uses ports 546 and 547; see IPv6.) The exchange is called DORA:

sequenceDiagram
    participant C as Client (0.0.0.0)
    participant S as DHCP server
    C->>S: Discover (broadcast: "any DHCP server out there?")
    S->>C: Offer (proposed address 192.0.2.50)
    C->>S: Request (broadcast: "I take 192.0.2.50 from this server")
    S->>C: Acknowledge (lease time, gateway, DNS)

Discover, Offer, Request, Acknowledge.

Details worth seeing in a capture:

  • The client has no address yet, so the Discover goes from 0.0.0.0 to 255.255.255.255 and the Ethernet destination is broadcast.
  • The transaction ID (dhcp.id) ties the four messages together; the client's MAC address is in dhcp.hw.mac_addr.
  • The message type is DHCP option 53 (field dhcp.option.dhcp; if a filter name does not work in your version, apply it from the details tree). Values: 1 Discover, 2 Offer, 3 Request, 4 Decline, 5 ACK, 6 NAK, 7 Release, 8 Inform.
  • Important options: 1 subnet mask, 3 router (gateway), 6 DNS servers, 12 host name, 15 domain name, 50 requested IP, 51 lease time, 54 server identifier, 55 parameter request list, 61 client identifier, 60 vendor class (reveals the OS or device type).
  • After half the lease time (T1) the client renews with a unicast Request to its server; at 87.5% (T2) it broadcasts.
  • A NAK means the server refuses the requested address (the client moved to another network). A Decline means the client found the offered address already in use.

Filters: dhcp (or bootp in older versions), udp.port == 67 or udp.port == 68, and by message type through the option field.

Troubleshooting with DHCP

  • Discovers with no Offers: the server is unreachable, the DHCP scope is exhausted, or a relay agent is missing. The client then self-assigns a link-local 169.254.x.x address (APIPA), a well-known sign.
  • Several Offers from different servers: a second DHCP server (often a home router plugged in by mistake, a rogue DHCP server) answers; clients may receive wrong gateways. Compare dhcp.option.dhcp_server_id across Offers.
  • Repeated Discover/Offer/Decline loops: an address conflict (see duplicate-address warnings in Ethernet and ARP).

The stand-in parses the options of an invented DHCP Offer from the option encoding (code, length, value), as the Packet Details tree does.

Python Decode DHCP options from bytes (stand-in)

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.

A map of everyday protocols

Knowing a protocol's port and what normal looks like helps you ignore it or notice that it is out of place.

Protocol Transport and port What you see Wireshark filter
NTP UDP 123 Time requests and responses; 48-byte packets ntp
mDNS UDP 5353 to 224.0.0.251 / ff02::fb Local name discovery (printers, Apple devices, Chromecast) mdns
LLMNR / NBNS UDP 5355 / 137 Windows fallback name lookups, a common security finding llmnr, nbns
SSDP UDP 1900 UPnP device discovery ssdp
SSH TCP 22 Version banner in clear, then encrypted ssh
Telnet TCP 23 Clear-text login (insecure; should not exist) telnet
FTP TCP 21 (+ data connections) Commands such as USER, PASS, RETR in clear text ftp, ftp-data
SMTP / IMAP / POP3 TCP 25, 587 / 143, 993 / 110, 995 Mail, often upgraded with STARTTLS or wrapped in TLS smtp, imap, pop
SMB TCP 445 Windows file sharing and network login smb2
RDP TCP 3389 Remote desktop, encrypted rdp
SNMP UDP 161/162 Device monitoring, community strings in v1/v2c snmp
Syslog UDP 514 Log messages in clear text syslog
LDAP TCP 389 / 636 Directory queries and logins ldap
NetBIOS/Browser, IGMP, LLDP, STP, CDP various link-layer Chatter from switches and routers igmp, lldp, stp, cdp

To get a quick overview of an unknown capture, open Statistics > Protocol Hierarchy. It lists every protocol with its share of packets and bytes. You will practice this in the statistics chapter.

Protocols that send passwords in clear text (Telnet, FTP, HTTP basic authentication, SNMPv1/v2c, POP3 without TLS) are findings in any real network. In your own tests, use throwaway accounts only, and never reuse a real password on such a service.

Identify the protocol from the port

When a capture has no friendly names (a capture with a snaplen that cuts payloads, or a filter that removed the handshake), a port guess is your first step. The stand-in maps ports to protocols, notes the usual security stance and handles the fact that either side of a conversation may carry the well-known port.

Python Guess protocols from ports (stand-in)

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.

If a protocol runs on a non-standard port, use Analyze > Decode As to tell Wireshark how to interpret it, for example "TCP port 8081 = HTTP". The mapping is saved in your profile.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What are the four messages of a DHCP lease, in order?

    DORA: Discover, Offer, Request, Acknowledge.
  2. 2. Why is the source address of a DHCP Discover 0.0.0.0?

    The client is asking for an address, so it has none and broadcasts the request.
  3. 3. A client shows IP 169.254.10.20. What does that suggest?

    169.254.0.0/16 addresses are self-assigned when no DHCP answer arrives.
  4. 4. Which protocol on a network capture is a finding because it sends passwords in clear text?

    Telnet transmits everything, including login credentials, without encryption.

Summary

  • DHCP assigns addresses using Discover, Offer, Request, Acknowledge on UDP ports 67 and 68; options carry the gateway, DNS and lease time.
  • Missing Offers, link-local 169.254 addresses, rogue servers and NAKs are the typical DHCP problems.
  • Learn the usual suspects (NTP, mDNS, SSDP, SMB, SSH, FTP, SMTP, SNMP) so you can recognize background noise.
  • Use Protocol Hierarchy for a first overview, and Decode As for protocols on unusual ports.
  • Clear-text protocols are security findings; test only with throwaway credentials.

Next: IPv6 and Neighbor Discovery