tcpretrans(8)
π tcpretrans(8) β¨ System Manager's Manual π
πΈ NAME πΈ
okay so tcpretrans is the tool that traces or counts TCP retransmits and TLPs (tail loss probes) π¦. It runs on Linux and uses eBPF/bcc, so it's giving low-level energy π .
π§ SYNOPSIS π§
tcpretrans [-h] [-s] [-l] [-c] [-4 | -6]
π DESCRIPTION π
bestie, this one traces TCP retransmits and shows the address, port, and TCP state info for each one π«Ά. Sometimes you'll also get the PID, but honestly usually not, because retransmits are usually sent by the kernel on timeouts π. To keep the overhead super low, only the TCP retransmit functions get traced. It does not trace every packet, so it's not giving tcpdump(8) or a packet sniffer vibes β. If you want, it can also count retransmits over an interval you set yourself, which is a lowkey great way to spot network paths the flows go through that might be dropping stuff π₯.
This works by dynamically tracing the kernel's tcp_retransmit_skb() and tcp_send_loss_probe() functions. Those can change with kernel updates, so the tool will need updating to match π οΈ.
β οΈ Since this uses BPF, only the root user can run this tool. No cap, that's a hard rule π.
π REQUIREMENTS π
You need CONFIG_BPF and bcc. That's the whole list, no notes π
.
β¨ OPTIONS β¨
-hβ Prints the usage message π.-sβ Shows the TCP sequence numbers π’.-lβ Includes tail loss probe attempts π. Heads up, the kernel may not always finish the TLP send, so those can be incomplete.-cβ Counts the retransmits that happen per flow π.-4β Only traces the IPv4 family πΈ.-6β Only traces the IPv6 family π¦.
π EXAMPLES π
Trace TCP retransmits:
# tcpretrans
Trace TCP retransmits and TLP attempts:
# tcpretrans -l
Trace IPv4 family only:
# tcpretrans -4
Trace IPv6 family only:
# tcpretrans -6
π FIELDS π
TIMEβ When the retransmit happened β°.PIDβ The process ID that was on-CPU π§ . Less useful than it sounds, since it's often0(the kernel) for timer-based retransmits.IPβ The IP address family, either 4 or 6 π.LADDRβ The local IP address π .LPORTβ The local port πͺ.T>β The type of event:R>means retransmit,L>means tail loss probe π―.RADDRβ The remote IP address π°οΈ.RPORTβ The remote port π.STATEβ The TCP session state π«§.SEQβ The TCP sequence π’.RETRANSMITSβ The total retransmits that have piled up since the start π.
π¦ OVERHEAD π¦
The overhead should be negligible. TCP retransmit events are usually low (under 1000 per second), and the tiny bit of extra work this tool adds to each event keeps the cost basically nothing π.
π SOURCE π
This comes from bcc π«Ά. Check out https://github.com/iovisor/bcc.
Also, look in the bcc distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool π.
π OS π
Linux π§
π§ͺ STABILITY π§ͺ
Unstable, still in development π§. Use it with a little caution, bestie.
π AUTHOR π
Brendan Gregg π
π SEE ALSO π
tcpconnect(8), tcpaccept(8) π
Okay that's the whole tea π« This page came from the USER COMMANDS manual, last updated 2016-02-14, and the manual name is tcpretrans(8). Go make the kernel behave, bestie π πβ¨
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms