Commands / Monitoring and logs

Monitoring and logs

ifstat

Also interface statistics, per-card counters, bytes sent per card

Shows each network card's packet and byte counters, and the change since the last run.

ifstat (from iproute2) prints, for each card, the packets and bytes received and sent. Like nstat, it prints the change since it last ran on this device, so two runs around some traffic show how much went out of each card: the way to see which cable of a bundle carried a transfer. Byte counts over a mebibyte are shown in kibibytes, with a K.

ifstat command usage

ifstat [-a] [-n] [-s] [CARD...]

Options

-a
show all counters since the card came up, not the change
-n
reset the baseline without printing deltas
-s
print without updating the baseline
CARD...
only these cards, e.g. bond0p1 bond0p2

ifstat examples

ifstat bond0p1 bond0p2
Shows how much each cable of the bond received and sent since the last run.

Pitfalls

  • The default is the delta since ifstat last ran on this device: run it once before the traffic, then again after.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab