How-To Guide

How to Diagnose Packet Loss and Retransmissions

Find and fix packet loss: read TCP retransmission and RTT signals, distinguish local from path loss, and check queues and MTU.

On this page

  1. Introduction
  2. How Loss Hurts
  3. Reading the Kernel Signals
  4. Locating the Loss
  5. Common Causes
  6. MTU and Path MTU Discovery
  7. When It Is the Application
  8. Common Pitfalls and Conclusion

Introduction

Packet loss is the difference between a fast network and a slow one, because TCP reacts to loss by retransmitting and shrinking its congestion window. A tiny loss rate can halve throughput and add tail latency. Diagnosing it means reading the signals the kernel already keeps (retransmission counts, RTT, congestion window), locating the loss (local egress, the path, or the receiver), and checking the common causes (congestion, a fault, or an MTU mismatch) before blaming the application.

How Loss Hurts

TCP treats a lost segment as a signal of congestion: it retransmits and reduces the congestion window, so throughput drops and latency rises. A loss rate that seems tiny, a fraction of a percent, can meaningfully cut throughput on a path with a high bandwidth-delay product, because the window has to re-grow after each loss.

For latency-sensitive traffic, loss is worse than the throughput cost: a lost packet can stall the stream until the retransmission timer fires, adding a multiple of the RTT to a request. So loss shows up as both lower throughput and a fat latency tail.

# loss impacts TCP
1. retransmit the lost segment
2. shrink the congestion window (treat loss as congestion)
=> throughput drops; on high-BDP paths a small loss hurts a lot
=> latency: a lost packet stalls the stream until the retransmit timer
# both throughput and the latency tail are affected

Reading the Kernel Signals

The kernel already tracks per-socket statistics: retransmissions, the smoothed RTT, the congestion window, and the retransmission timeout. The ss -ti command shows these for live sockets. A rising retransmission count is direct evidence of loss; a high, variable RTT suggests queueing or a congested path.

The TCP info also shows whether the connection is limited by the congestion window (cwnd-limited) or by the receiver (rwnd-limited or application-limited). That distinction tells you whether the problem is the network (cwnd) or the receiver or application (rwnd or not enough data to send).

# per-socket TCP statistics (Linux)
ss -ti state established '( dport = :443 )'
# fields to read in the output:
#   retrans:x/y        retransmitted segments / total (a rising number = loss)
#   rtt:a/b            smoothed RTT / RTT variance
#   cwnd:n             congestion window (network-limited if small)
#   rwnd_limited       receiver-window-limited (receiver or app is the limit)

Locating the Loss

Loss can be local (egress drops from your host), on the path (a congested or faulty link), or at the receiver (its buffer overflowed). A ping flood of increasing size finds the MTU where packets start being dropped; a traceroute with per-hop statistics shows where loss and latency rise, which points at the rough location.

For a systematic measurement, a tool that sends packets and counts loss per hop (such as mtr) shows loss at each hop. Loss that appears at one hop and continues to the destination is real; loss at a single hop that does not continue is often that router deprioritising the probe traffic, not real loss on the data path.

# probe path loss and MTU
mtr --report --report-cycles=100 1.1.1.1          # loss/latency per hop
ping -M do -s 1472 203.0.113.10                   # test MTU (1472 + 28 = 1500)
ping -M do -s 1400 203.0.113.10                   # smaller payload
# loss that starts at a hop and continues => real
# loss only at one hop => often probe deprioritisation, not data-path loss

Common Causes

Congestion is the most common: a link is saturated and its queue overflows, dropping packets. That loss is real, and the fix is capacity or traffic shaping, not a bug in the application. A faulty link or interface produces loss independent of load and is a hardware or provider issue.

An MTU mismatch is a subtle cause: a path element has a smaller MTU than the endpoints assume, and large packets are dropped silently (a PMTU black hole) while small ones pass. Connections that work for small responses but hang for large ones are the classic sign. Also check duplex mismatch, which causes loss under load on a specifically misconfigured link.

# loss causes, by signature
congestion        loss rises with load; fix capacity/shaping
faulty link       loss independent of load; hardware/provider
MTU black hole    small responses ok, large ones hang; PMTU discovery broken
duplex mismatch   loss under load on a specific link
# distinguish by whether loss tracks load and by packet size

MTU and Path MTU Discovery

Path MTU discovery relies on ICMP “fragmentation needed” messages. If those are filtered, the endpoints do not learn the smaller MTU and keep sending packets that a hop drops, producing a black hole: the connection establishes and small exchanges work, but a large response stalls.

The workaround is MSS clamping at the tunnel or the edge: clamp the TCP MSS so packets fit the smallest MTU on the path. This avoids relying on ICMP and fixes the black hole for TCP. Test with pings of decreasing size to find the largest that passes without fragmentation.

# MSS clamping fixes the MTU black hole for TCP (iptables example)
iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN \
  -j TCPMSS --clamp-mss-to-pmtu
# find the working MTU empirically
for s in 1472 1452 1400 1300 1200; do
  ping -M do -s $s -c 1 203.0.113.10 >/dev/null 2>&1 && echo "ok $s" || echo "drop $s"
done

When It Is the Application

Not all stalls are network loss. An application that sends small writes in a pattern that trips Nagle and delayed ACK, or that opens a new connection per request and pays repeated losses on connection setup, looks like a network problem but is a configuration problem. Check the full picture before blaming the network.

Also check the receiver: a receiver whose socket buffer is too small, or a process too slow to drain it, causes the sender to be receiver-window-limited and the connection to look slow without any loss. The kernel statistics distinguish this: rwnd_limited means the receiver or application, cwnd-limited means the network.

# application-side look-alikes
small writes + Nagle/delayed ACK -> looks like added latency, not loss
new connection per request       -> repeated setup, not steady-state loss
receiver buffer too small        -> rwnd_limited, no loss
slow receiver process            -> window fills, sender stalls, no loss
# kernel stats: cwnd-limited = network; rwnd_limited = receiver/app

Common Pitfalls and Conclusion

Do not read a single hop’s loss from a traceroute as real loss; routers deprioritise probes. Do not blame the application for a cwnd-limited connection, or the network for an rwnd-limited one; the kernel stats tell you which. Do not ignore MTU, which produces a black hole that looks like a hang. And do not fix congestion with retries; add capacity or shape the traffic.

Packet loss cuts throughput and fat-tens the latency tail, and it is diagnosable from the signals the kernel already keeps. Read retransmissions, RTT and the window limits from the TCP stats, locate the loss with per-hop probing and MTU tests, distinguish congestion from a fault from an MTU black hole, and clamp MSS where PMTU discovery is filtered. Then you fix the cause instead of retrying around it.

Sources: Linux: ss manual, RFC 1191: Path MTU Discovery, RFC 2923: TCP problems with PMTUD.

FAQ

How do I tell network loss from a slow receiver?
From the kernel socket stats: cwnd-limited means the network (congestion window) is the constraint, while rwnd-limited means the receiver window is, pointing at the receiver or a slow application rather than loss on the path.
What is an MTU black hole?
A path where a hop has a smaller MTU than the endpoints assume and the ICMP fragmentation-needed message is filtered, so large packets are dropped silently. Small exchanges work and large responses hang. The fix is MSS clamping to fit the smallest MTU on the path.

Related Examples