tcpsubnet(8)
β¨ tcpsubnet β¨
tcpsubnet is a manual page for a tool that summarizes and aggregates IPv4 TCP traffic by subnet π
π NAME
okay so tcpsubnet is the tool that summarizes and aggregates IPv4 TCP traffic by subnet π¦
π§Ύ SYNOPSIS
tcpsubnet [-h] [-v] [-J] [-f FORMAT] [-i INTERVAL] [subnets]
π DESCRIPTION
bestie, this tool summarizes and aggregates IPv4 TCP sent to the subnets you pass in as an argument, then prints to stdout on a fixed interval β¨
It uses dynamic tracing of kernel TCP send/receive functions, so it's giving "kernel-aware" energy, but it will need updating whenever the kernel changes π₯
The traced data gets summarized in-kernel with a BPF map to keep overhead low π . Still, at very high TCP event rates, the overhead may be measurable. Check the OVERHEAD section for the tea β
Since this uses BPF, only the root user can use this tool. No root, no tcpsubnet π
π οΈ REQUIREMENTS
You'll need CONFIG_BPF and bcc π§
π OPTIONS
-hβ Prints the USAGE message πΈ-vβ Runs in verbose mode. It outputs the subnet evaluation and the BPF program π-Jβ Formats the output as JSON π-iβ Sets the interval between updates, in seconds. The default is 1 β°-fβ Formats the output units. Supported values arebkmBKM. When you usekmKM, the output gets rounded to floor πsubnetsβ A comma separated list of subnets. Traffic gets sorted into these subnets, and order matters π The default is127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,0.0.0.0/0
π EXAMPLES
Summarize TCP traffic by the default subnets:
# tcpsubnet
Summarize all TCP traffic:
# tcpsubnet 0.0.0.0/0
Summarize all TCP traffic and output in JSON and Kb:
# tcpsubnet -J -fk 0.0.0.0/0
π FIELDS
Here's what you'll see in the output π
- Standard output, left hand column β Subnet
- Standard output, right hand column β Aggregate traffic in the units you passed as an argument
- JSON output,
dateβ The current date, formatted in the system locale - JSON output,
timeβ The current time, formatted in the system locale - JSON output,
entriesβ A map of subnets to aggregates. Values are in the format you passed to-f
π’ OVERHEAD
Okay this part is important, so listen up π«Ά This traces all tcp_sendmsg function calls in the TCP/IP stack, and it summarizes data in-kernel to keep the overhead down. In a simple iperf test (v2.0.5) with the default values, throughput dropped by about 5%. Over 10 runs without tcpsubnet running, the average throughput was 32.42Gb/s. With tcpsubnet enabled, it was 31.26Gb/s π
This is not meant to be used as a long running service. Use it for troubleshooting or for a controlled interval. As always, try it out in a test environment first π
π¦ SOURCE
This one's from 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 π§
π©βπ» AUTHOR
Rodrigo Manyari π
π‘ INSPIRATION
tcptop(8) by Brendan Gregg π¦
π SEE ALSO
netlink(7) π«Ά
Man page vibes check: this one's from the USER COMMANDS section and dated 2018-03-01. Stay iconic, stay root-approved, and go tcpsubnet your little heart out π β¨π
π¦ 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