14 Network Traffic Analysis
Turning Packet Captures Into Network Design Evidence
14.1 Start With the Packet You Cannot Explain
Imagine an installed node that sometimes misses alerts, reconnects slowly, or sends duplicate telemetry. Traffic analysis starts with that unexplained behavior and works backward through capture points, timestamps, loss, retries, encryption limits, and release evidence. The goal is not a pretty packet trace; it is a defensible explanation of what the system is doing.
14.2 Learning Objectives
By the end of this chapter, you will be able to:
- Plan network traffic captures that answer a design, validation, or troubleshooting question.
- Choose capture points for device, gateway, broker, RF, backhaul, and application evidence.
- Use packet traces to review protocol timing, retransmissions, loss, joins, retries, command traffic, and maintenance events.
- Explain how encryption changes what traffic analysis can and cannot prove.
- Package packet evidence so simulation results, field captures, and release decisions can be compared.
14.3 Capture Paths That Prove Behavior
Network traffic analysis is strongest when it starts with a behavior to explain, then chooses the path locations that can observe that behavior. The same stale alarm can look different at a device interface, an 802.15.4 sniffer, a LoRaWAN gateway, an MQTT broker, a cloud ingress point, and an application log. A device capture might show DNS delay and repeated TCP SYNs. A gateway capture might show backhaul jitter or NAT resets. A broker log might show session expiry, QoS acknowledgements, or a retained-message surprise. A cloud event stream might show that ingestion succeeded but dashboard freshness lagged.
For IoT design work, the goal is not to collect every packet. The goal is to capture the window where the design claim could fail: joining, reconnecting, retrying, roaming, commissioning, sending a burst, draining a queue, applying a command, or recovering after gateway/backhaul outage. A useful plan says which claim is being tested, which points can see it, which timestamps must align, which packet fields are enough, and which evidence remains outside the trace because of encryption, radio visibility, retention, or privacy limits.
The evidence loop matters because packet files are easy to overread. A trace can prove that a gateway sent an MQTT PUBLISH at 09:14:03, that TCP retransmitted three segments, or that a LoRaWAN network server recorded weak SNR during a join wave. It cannot automatically prove why a sensor measurement was wrong, why a user did not acknowledge an alert, or why a cloud rule made a business decision. The design action is defensible only when the trace is linked to simulation assumptions, gateway logs, RF survey notes, broker telemetry, and the remaining uncertainty.
- Question: Join reliability, alarm freshness, retry storm, command latency, firmware update load, or broker disconnect.
- Viewpoint: Device NIC, RF sniffer, gateway, router, broker, cloud edge, or application event stream.
- Limit: Payload encryption, missed radio channels, NAT, clock drift, sampling window, retention policy, and privacy controls.
14.4 Build Readable Trace Bundles
A useful trace bundle includes the PCAP or flow export, the capture command, interface, channel, filter, time zone, clock source, device identifiers, software versions, scenario notes, and the logs needed for correlation. For gateways and Linux edge devices, that may mean tcpdump ring buffers, tshark extraction scripts, NTP status, broker logs from Mosquitto, EMQX, or HiveMQ, and application events from AWS IoT Core, Azure IoT Hub, OpenTelemetry, CloudWatch, or Azure Monitor. Keep the capture command and display filters with the evidence so another reviewer can reproduce the summary rather than trust screenshots.
Match the tool to the visibility problem. Wireshark is good for interactive protocol review. tshark is better for repeatable extraction in a test script. Nordic nRF Sniffer, TI SmartRF Packet Sniffer, Ubertooth, or an 802.15.4 capture dongle can expose BLE, Thread, Zigbee, or raw link behavior that an IP capture misses. ChirpStack, The Things Stack, or packet-forwarder logs can expose LoRaWAN join attempts, RSSI/SNR, frame counters, gateway id, and downlink timing when payloads stay encrypted. VPC flow logs, firewall logs, and cellular-router logs can be enough when the question is path reachability, volume, or backhaul timing rather than protocol fields.
Make the bundle decision-oriented. Label the baseline capture, the event capture, and any rerun after a design change. Record whether clocks were synchronized with NTP or PTP, whether capture offload features affected checksums, whether monitor-mode radios covered the right channel, and whether packet loss could have happened before the capture point. For sensitive traces, document redaction, key handling, retention, and who may access the raw PCAP. A reviewer should be able to open the bundle and see the scenario, observation point, visible protocol facts, missing evidence, and proposed action without reconstructing the test from memory.
- Capture the symptom window. Include baseline plus the event: reboot, alarm burst, gateway loss, firmware rollout, handoff, or link degradation.
- Keep correlation data. Align packet times with firmware logs, broker session ids, gateway counters, application events, and simulation run ids.
- Summarize observable facts. Report MQTT CONNECT/CONNACK, PINGREQ/PINGRESP, QoS acknowledgements, CoAP ACK/RST, TCP retransmissions, resets, DNS timing, TLS or DTLS handshakes, queue depth, and retry counts.
14.5 Trace Visibility Has Limits
A packet capture proves what crossed the capture point during the selected window. It does not prove packets lost before that point, cloud processing after that point, or payload content hidden by TLS, DTLS, OSCORE, WPA, LoRaWAN keys, BLE link-layer encryption, or broker-side access controls. A TCP retransmission shows transport recovery, but the cause may be RF loss, buffer pressure, roaming, firewall state, broker overload, or backhaul jitter. A missing packet in one capture can mean the packet never existed, the capture point missed the channel, the filter was too narrow, or the clock alignment points to the wrong event window.
The under-the-hood skill is separating transport evidence from application meaning. MQTT QoS 1 PUBACK timing can show delivery acknowledgement at the broker path, but it does not prove a human saw an alert. A CoAP ACK can prove message exchange at the protocol layer, but it does not prove a sensor value was physically correct. LoRaWAN frame counters and RSSI/SNR can show link behavior, but payload meaning still needs device, network-server, or application context. BLE supervision timeouts, Thread parent changes, Wi-Fi roaming, and cellular reconnects each leave different evidence trails, so the capture point must match the mechanism under review.
Trace interpretation also has measurement mechanics. Network-interface offload can make local checksum fields look wrong even when transmitted packets were valid. Monitor-mode radios may miss frequency hops or channels outside the selected band. Packet-forwarder logs may round or normalize timestamps. Broker logs may show accepted sessions but not every dropped network packet. Flow logs aggregate events and can hide short retransmission bursts. Strong analysis names these limits, uses a second evidence source where the decision is important, and avoids turning one visible symptom into a system-wide conclusion.
- Timing state: Clock sync, capture start/stop, frame deltas, keepalive intervals, reconnect delay, and queue drain time.
- Protocol state: Session setup, acknowledgements, retransmission, route repair, reset behavior, topic flow, and command response.
- Residual uncertainty: What must be checked with RF survey data, device logs, broker telemetry, application records, or a controlled staging capture.
14.6 Prerequisites
You should already be comfortable with:
- Network Simulation Methodology: scenario packs, model boundaries, run packages, and validation records.
- Network Simulation Tools: how simulation, emulation, capture, survey, and telemetry tools fit different evidence needs.
- Networking basics: packets, addressing, routing, transport, and application protocols.
- Application protocols: MQTT, CoAP, HTTP, publish/subscribe, request/response, and gateway patterns.
14.7 What This Chapter Adds
Simulation predicts behavior under model assumptions. Traffic analysis checks what actually happened on a device, link, gateway, broker, or backhaul path. This chapter focuses on using traffic analysis as design evidence, not as a generic tool tutorial.
Evidence first
Start with the design, validation, security, or troubleshooting decision the capture must support.
Capture point matters
A device, gateway, RF sniffer, broker, or cloud edge may each see different parts of the same failure.
Payloads may be opaque
TLS, DTLS, link-layer keys, and broker-side security can hide content while leaving timing and metadata visible.
Traces need context
Packet files are useful only when tied to time windows, filters, devices, scenario events, and decision criteria.
14.8 Turn Captures Into Evidence
Network traffic analysis starts with a question, not a packet file. The team chooses the capture point that can observe the behavior, records the scenario window and filters, reads packet timing against protocol expectations, compares the trace with simulation or logs, and turns the result into a design action.
The loop introduced in the overview connects field evidence back to the scenario pack. It should tell reviewers what was captured, why it was captured, what it proves, and what remains outside the capture.
14.9 Capture Planning
A capture without a question often becomes a large file that nobody can review. Plan the capture like an experiment.
Treat PCAP files as evidence with access controls. They may include tokens, device IDs, locations, topic names, DNS names, certificate details, or plaintext payloads in development networks. Redact or restrict traces before sharing broadly.
14.10 Capture Points
Choose the capture point that can observe the evidence needed for the decision.
14.11 Tool Roles
Do not rank tools in the abstract. Choose the tool role that matches the capture point and review question.
Interactive protocol review
Use for packet dissection, timeline inspection, stream following, field exploration, and training reviewers on what the trace shows.
Remote packet capture
Use on gateways, routers, Linux devices, and field systems where a lightweight command-line capture is practical.
Repeatable extraction
Use for scripted field extraction, test automation, CI checks, and producing repeatable summaries from PCAP files.
Wireless link evidence
Use for 802.15.4, Thread, Zigbee, BLE, or other over-the-air behavior when gateway logs cannot show the radio exchange.
Aggregate path evidence
Use when packet payloads are unnecessary and the question is about endpoints, volume, timing, or backhaul behavior.
Outcome correlation
Use to connect packets with commands, alerts, dashboards, user events, and incident timelines.
14.11.1 Minimal Capture Examples
Use command snippets as starting points, not as unreviewed production procedures.
# Capture one device's broker traffic on a gateway.
sudo tcpdump -i eth0 host 192.0.2.40 and port 8883 -w device-broker.pcap
# Extract a repeatable packet summary from an existing capture.
tshark -r device-broker.pcap -Y "tcp.analysis.retransmission or tcp.flags.reset == 1" \
-T fields -e frame.time -e ip.src -e ip.dst -e tcp.stream -e _ws.col.InfoUseful display filters depend on the protocol and visibility:
mqtt
coap
tcp.analysis.retransmission
tcp.flags.reset == 1
dns or mdns
ip.addr == 192.0.2.40
frame.time_delta > 1
The capture file alone is not enough evidence. Store the command, interface, filters, clock source, scenario description, device identifiers, tool versions, and analysis script beside the PCAP.
14.12 Reading a Trace
The strongest traffic analysis reports behavior, not just packets. Focus on patterns that connect to the design decision.
14.13 Encryption and Evidence Limits
Modern IoT traffic is often encrypted. That is usually correct. Traffic analysis should be honest about what remains visible and what needs another evidence source.
If encrypted traffic blocks payload inspection, use staged test captures, broker logs, device logs, or approved key logging. Do not ship weaker security because it makes packet analysis easier.
14.14 Comparing Traffic With Simulation
Traffic analysis is especially useful after simulation because it tests whether modeled assumptions match a field or pilot system.
14.15 Incremental Examples
14.15.1 ESP32 MQTT Bench Capture
A lab team wants to confirm that an ESP32 temperature node publishes every 60 seconds to a local Mosquitto broker. The capture can run on the gateway or broker host with tcpdump, then be reviewed in Wireshark or summarized with tshark. The useful facts are the CONNECT/CONNACK timing, PUBLISH cadence, keepalive interval, DNS lookup, TCP reconnects, and whether the observed payload size and report interval match the simulation input.
14.15.2 Thread/Zigbee Join Wave
A room sensor pilot reports stale occupancy events after several nodes rejoin. The traffic-analysis plan should combine an 802.15.4 sniffer, gateway logs, and application timestamps during a planned join wave. A Nordic nRF Sniffer, TI SmartRF Packet Sniffer, or supported 802.15.4 capture dongle can expose frame timing, acknowledgements, route repair, and channel behavior, while gateway logs show what reached the IP side. The result should identify whether the stale event is caused by RF retries, route repair, gateway queueing, or broker/application delay.
14.15.3 Multi-Site Alarm Path Review
A facilities program needs to compare a simulation with field evidence from Wi-Fi gateways, LoRaWAN devices, and cellular backhaul. The capture bundle may include gateway tcpdump files, ChirpStack or The Things Stack metadata, packet-forwarder logs, MQTT broker session logs, AWS IoT Core or Azure IoT Hub events, OpenTelemetry traces, CloudWatch or Azure Monitor metrics, and Grafana dashboard timestamps. The review should separate radio link behavior, broker session behavior, cloud ingestion delay, dashboard freshness, and user acknowledgement so the team changes the correct layer.
14.16 Broker Disconnect Evidence
A pilot deployment reports that a device sometimes disappears from the dashboard even though firmware logs say the sensor is running.
A good result statement would not say “Wireshark fixed the issue.” It would say which capture point saw the last successful packet, which expected packet was absent or late, what logs agreed with the packet evidence, and which design assumption must change.
14.17 Try It Now
Rewrite this weak traffic-analysis result into a decision-ready statement:
“The packet capture looked normal, so the network is fine.”
A stronger answer should name the design question, capture point, scenario window, visible protocol facts, encrypted or missing evidence, related logs, and the design action that follows.
14.18 Micro-Exercise: Pick the Capture Point
For each symptom, choose the first capture point and one supporting log:
- A sensor publishes locally, but no alert appears in the dashboard.
- Several Thread nodes go stale after a router is power-cycled.
- A cellular gateway reconnects after an outage, but commands arrive late.
Use device interface, RF sniffer, gateway, broker/server, network edge, or application telemetry as the capture point.
14.19 Practice Checks
14.20 Common Pitfalls
Large packet files are not automatically useful. Start with the behavior that must be verified or explained.
A broker capture cannot prove what happened on the radio, and an RF sniffer cannot prove cloud processing. Choose the capture point for the claim.
Quiet operation rarely explains failures caused by joins, gateway reboots, outage recovery, updates, or correlated alarms.
Screenshots can help a discussion, but a packet-analysis handoff needs PCAP files, commands, filters, timestamps, tool versions, and analysis notes.
Encrypted captures can show timing and session behavior, but they usually cannot prove application payload content without approved decryption or logs.
Packet traces may contain sensitive identifiers or payloads. Treat them as controlled evidence, not disposable screenshots.
14.21 Summary
Network traffic analysis validates what a network actually did. A strong traffic-analysis study starts with a decision question, chooses capture points intentionally, records filters and time windows, preserves packet evidence, reviews protocol behavior, states encryption limits, compares traces with simulation and logs, and ends with a design action. The goal is not to collect every packet. The goal is to collect the packets that can defend or revise the network design.
14.22 References
- Wireshark User’s Guide - official Wireshark packet-analysis documentation.
- Wireshark Display Filter Reference - official display-filter reference.
- tcpdump Manual Page - official tcpdump capture options.
- tshark Manual Page - official command-line Wireshark documentation.
- MQTT Version 5.0 Specification - official OASIS MQTT specification.
- RFC 7252: The Constrained Application Protocol - official CoAP specification.
14.23 See Also
- Network Simulation Methodology: compare field traces with scenario packs, model boundaries, and acceptance bands.
- Network Simulation Tools: choose when to use simulation, emulation, capture, survey, or telemetry evidence.
- Network Design Methodology: connect traffic findings to network design decisions.
- Testing and Validation: turn packet evidence into repeatable validation criteria.
14.24 What’s Next
| If you want to… | Read this |
|---|---|
| Turn packet findings into validation criteria | Testing and Validation |
| Compare traces with scenario assumptions | Network Simulation Methodology |
| Choose the right evidence tool for a study | Network Simulation Tools |
| Translate evidence limits into component checks | Specification Sheet Fundamentals |
| Previous | Current | Next |
|---|---|---|
| Simulation Methods & Scenarios | Network Traffic Analysis | Specification Sheet Fundamentals |
14.25 Key Takeaway
Traffic analysis turns device behavior into network load. Estimate message rate, payload size, overhead, retries, bursts, and gateway fan-in before assuming a network can scale.