The three tables
Outcome: you can read any row of any table and say exactly what is being counted — and you can follow one transfer as it appears in all three tables at once, which is where the reading skill actually lives.
bandwhich counts the same packets three
ways. The terminal draws them as
tables; raw mode (chapter 7) prints
them as lines, and this chapter quotes
the raw lines because they can be
written down exactly. Every line below
is from the lab's first capture,
transcript
examples/transcripts/t02-raw-loopback.txt:
a download the lab generated itself,
taken apart in the next chapter.
Each refresh prints a block beginning
Refreshing:, then up to three kinds
of line. An idle refresh prints just:
Refreshing:
<NO TRAFFIC>
Processes: who
process: <1793870221> "python3" up/down Bps: 973548/0 connections: 1
process: <1793870221> "fixture-fetch" up/down Bps: 562/0 connections: 1
A process line names one program, the
number in angle brackets being the
refresh's Unix timestamp. The figures
after up/down Bps: are bytes per
second leaving, then arriving — the
order is up first, down second,
always. After that, connections:
counts how many live connections those
bytes are spread over. A process with
five connections shows one combined
rate here; the per-connection truth is
in the third table.
This is the table that answers the
question from chapter 1. At the moment
quoted, a program named python3 was
sending at 973,548 bytes per second,
and a program named fixture-fetch
was barely moving. Hold those numbers;
the next chapter explains why the
sending program is the busy one in a
download, and why the numbers look the
way they do.
Connections: which conversation
connection: <1793870221> <lo>:18090 => 127.0.0.1:58878 (tcp) up/down Bps: 973548/0 process: "python3"
connection: <1793870221> <lo>:58878 => 127.0.0.1:18090 (tcp) up/down Bps: 562/0 process: "fixture-fetch"
A connection is one conversation
between two endpoints, each written as
an address and a port — the numbered
door on a machine that a single program
listens at or connects from. The line
gives the interface in angle brackets,
the local end first, then the remote
end, the protocol (tcp), the rates,
and the owning process. One connection
in the lab's transfer appears twice,
once from each side, because both
programs are on the same machine: the
server's row (port 18090, owned by
python3) and the client's row (port
58878, owned by fixture-fetch) are the
same conversation seen from its two
ends. On an ordinary download from
another machine you would see only your
own side's row.
Remote addresses: where
remote_address: <1793870221> 127.0.0.1 up/down Bps: 974110/0 connections: 2
The third table groups by the far address alone, across all processes and connections. Its figure here — 974,110 bytes per second — is the sum of the two connection rows above it (973,548 + 562), and its connection count is 2 for the same both-ends-on-one-machine reason. On a real machine this is the "where is it all going?" table: one address can gather a browser, a sync client, and an updater into a single row, and the processes table then separates them again.
Reading across the tables
The habit to build: start in the processes table ("who is busy?"), drop to that process's rows in the connections table ("talking to whom, on which port?"), and sanity-check the remote address table ("does the total for that address make sense — is anything else talking to it?"). Three questions, three tables, one set of packets. Most surprises in later chapters are a row that appears in one table and not another, or a number that changes meaning when you follow it across: a process total that is really forty small connections, or one fat connection wearing a process's name that chapter 9 will teach you to doubt.
Check: in the quoted refresh, which process is sending the bulk of the bytes, which port is the server's, and why does the remote address show two connections for one download? If you can answer all three from the lines above, the tables are yours.