iftop, nload, nethogs, bmon, iptraf-ng, bwm-ng, speedometer
Seven live Linux bandwidth monitors that answer "who is using the network right now?": iftop (which host pair), nethogs (which process), iptraf-ng (IP/TCP/UDP stats and logs), and nload, bmon, bwm-ng and speedometer (interface totals). All were run on real iperf3 traffic in a Docker lab.
188.1 Why is it used?
- The server upload is suddenly full: find the interface, then the host pair, then the process.
- Watch live rates while testing a link or a transfer.
- Log traffic in the background or as CSV for a trend.
- Install on Linux with apt; on macOS most come from Homebrew (speedometer via pip).
188.2 How it works: packet copy vs counters
- Step 1
1.Monitor 192.168.208.20 runs iperf3 -c (20 Mbit/s)
- Step 2
2.Traffic crosses the Docker bridge (n188-lan) to server 192.168.208.10 (iperf3 -s)
- Step 3
3.iftop, nethogs, iptraf-ng open a packet socket on eth0 and read a copy of every packet (root / CAP_NET_RAW)
- Step 4
4.nload, bmon, bwm-ng, speedometer read only the kernel interface counters (light, no root)
- Step 5
5.Each tool turns its data into live rates on screen
| Tool | Answers | Data source |
|---|---|---|
| iftop | Which host pair (and port), how much | Packet copy |
| nethogs | Which process (PID) | Packet copy + socket to PID |
| iptraf-ng | IP/TCP/UDP stats, menus, background logs | Packet copy |
| nload | Interface in/out with graphs | Counters |
| bmon | Interface rates, scriptable ascii output | Counters (netlink) |
| bwm-ng | Interface rates, plain/CSV/HTML | Counters (/proc/net/dev) |
| speedometer | Live RX/TX graph per tap | Counters |
188.3 Lab setup
Terminal
docker network create n188-lan \ --subnet 192.168.208.0/24docker run -d --name n188-server \ --network n188-lan --ip 192.168.208.10 \ --memory 128m nicolaka/netshoot:v0.13 \ iperf3 -sdocker run -d --name n188-mon \ --network n188-lan --ip 192.168.208.20 \ --memory 128m debian:12-slim sleep 900apt-get install iftop nload nethogs bmon \ iptraf-ng bwm-ng speedometer iperf3 tmuxiperf3 -c 192.168.208.10 -t 20 -b 20MOutput
kernel modules before: 27 (mods-before.txt)### kernel modules after: 27 (mods-after.txt)before = after (no module loaded)188.4 iftop: options
Terminal
iftop -t -s 5 -n -N -P -i eth0Output
# Host name (port/service if enabled) last 2s last 10s last 40s cumulative-------------------------------------------------------------------------------------------- 1 192.168.208.20:54670 => 19.0Mb 15.9Mb 15.9Mb 11.9MB 192.168.208.10:5201 <= 9.75Kb 8.19Kb 8.19Kb 6.14KB--------------------------------------------------------------------------------------------Total send rate: 19.0Mb 15.9Mb 15.9MbTotal receive rate: 9.75Kb 8.19Kb 8.19KbTotal send and receive rate: 19.0Mb 15.9Mb 15.9Mb--------------------------------------------------------------------------------------------Peak rate (sent/received/total): 19.0Mb 9.75Kb 19.0MbCumulative (sent/received/total): 11.9MB 6.14KB 11.9MB| Option | Meaning |
|---|---|
| -t / -s 5 | Text mode / print one report after 5 s and exit |
| -n / -N | No DNS lookup / no port service names |
| -P | Show ports with hosts |
| -i eth0 | Listen on this interface |
| -f 'port 443' | BPF filter (e.g. 'not port domain' hides DNS) |
| -F 192.168.1.0/24 / -G 2001:db8::/32 | IPv4 / IPv6 network for direction |
| -B / -b / -m 100M | Bytes instead of bits / no bars / bar scale limit |
| -p / -l | Promiscuous mode / count IPv6 link-local |
| -c ~/myiftoprc | Alternate config file |
- Columns are 2 s, 10 s and 40 s averages plus cumulative; => is send, <= is receive.
- Here 19.0 Mb send = the 20 Mbit/s iperf3 stream to server port 5201.
188.5 iftop: keys and ~/.iftoprc
| Key | Action |
|---|---|
| r / p | DNS resolution / port display on-off |
| s / d, S / D | Aggregate by source / destination, show their ports |
| t | Cycle 2-line, 1-line sent / received / total |
| 1 2 3, < > | Sort by 2s/10s/40s column, by source/destination name |
| l / f | Regex filter on host names / edit BPF filter live |
| P / o | Pause display / freeze sort order |
| j / k | Scroll down / up |
Output
--- after key P (paused) Display paused qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq192.168.208.20:36296 <= 192.168.208.10:5201 1.19KB 1.00KB 1.00KBTX: cum: 11.9MB peak: 2.44MB rates: 2.38MB 1.98MB 1.98MBRX: 5.99KB 1.22KB 1.19KB 1.00KB 1.00KBTOTAL: 11.9MB 2.44MB 2.38MB 1.98MB 1.98MBOutput
interface: eth0dns-resolution: noport-resolution: noshow-bars: noport-display: onuse-bytes: yessort: 2sline-display: one-line-both- ~/.iftoprc: one name: value per line; 29 directives that mirror the options (filter-code, promiscuous, hide-source, log-scale, max-bandwidth, net-filter...).
- With this file, iftop showed rates in bytes and started in one-line-both mode.
- A command-line option always overrides the file.
188.6 nload
Terminal
nload -u M eth0Output
Device eth0 [192.168.208.20] (1/1):================================================================================Incoming: Curr: 0.00 MByte/s Avg: 0.00 MByte/s Min: 0.00 MByte/s Max: 0.00 MByte/s Ttl: 23.94 MByte- Outgoing average was 2.4 MByte/s = 20 Mbit/s of iperf3; incoming near zero because data leaves the monitor.
- -u h|H|b|B|k|K|m|M|g|G sets rate unit (lowercase bits, uppercase bytes); -U for totals.
- -a 60 average window (default 300 s), -t 1000 refresh ms (default 500), -i/-o graph scale, -m many devices without graphs.
- Keys: arrows/Enter/Tab switch device, F2 option window, F5 save to ~/.nload, F6 reload, q quit.
188.7 nethogs
Terminal
nethogs -t -c 3 eth0Output
Refreshing:unknown TCP/0/0 0 0Refreshing:iperf3/872/0 230.748 0.232031unknown TCP/0/0 0 0Refreshing:iperf3/872/0 717.883 0.670313unknown TCP/0/0 0 0- Each line: program/PID/UID, then sent and received KB/s; iperf3 is on top.
- -t tracemode (text), -c N exit after N updates, -d refresh delay, -v 0-5 units (KB/s, KB, B, MB, MB/s, GB/s).
- -s sort by sent, -l full command line, -b basename, -a all devices, -C TCP and UDP, -P pid, -f pcap filter; setcap for non-root.
- Keys: q quit, s/r sort sent/received, l command line, b basename, m total vs rate mode.
188.8 bmon
Terminal
bmon -p eth0 -o ascii:quitafter=3Output
Interfaces RX bps pps % TX bps pps % eth0 0 0 0 0 Interfaces RX bps pps % TX bps pps % eth0 1.35KiB 20 2.38MiB 56 Interfaces RX bps pps % TX bps pps % eth0 1.35KiB 20 2.38MiB 56 - First reading is 0 (a rate needs two readings); TX 2.38 MiB matches nload.
- -p policy picks interfaces (eth0,eth1 or 'eth*,!eth0'); -a include down; -r/-R read/rate intervals; -b bits; -U SI units.
- Inputs: netlink (default), proc, dummy, null. Outputs: curses (default), ascii, format, null. module:help lists options (ascii quitafter, netlink notc).
- Curses output documents one key: ? for the quick reference.
188.9 iptraf-ng
Terminal
iptraf-ng -i eth0 -B -L /tmp/n188-ip.logiptraf-ng -d eth0 -t 1 -B -L /tmp/n188-detail.logkill -USR2 <pid> # stop a background monitorOutput
$ cat /tmp/n188-detail.log*** Detailed statistics for interface eth0, generated Mon Nov 9 11:12:00 2026Total: 1880 packets, 44795449 bytesTCP: 1880 packets, 44795449 bytesUDP: 0 packets, 0 bytesPeak total activity: 20100.42 kbps, 106 ppsPeak incoming rate: 20.67 kbps, 49 ppsPeak outgoing rate: 20080.06 kbps, 56 ppsMon Nov 9 11:12:00 2026; ******** Detailed interface statistics stopped ********| Option | Facility |
|---|---|
| (none) | Interactive menu |
| -i eth0 | all | IP traffic monitor |
| -g / -d eth0 | General / detailed interface stats |
| -s eth0 / -z eth0 | TCP/UDP service monitor / packet size counts |
| -l eth0 | all | LAN station (MAC) monitor |
| -t 10 / -B / -L file | Run only 10 minutes / background / log file |
| kill -USR1 / -USR2 | Rotate logs / stop background process |
188.10 bwm-ng and speedometer
Terminal
bwm-ng -o plain -N -c 3 -t 1000 -I eth0Output
bwm-ng v0.6.3 (delay 1.000s); input: /proc/net/dev; press 'ctrl-c' to end this| iface Rx Tx Total============================================================================== eth0: 1.48 KB/s 2435.67 KB/s 2437.16 KB/s ------------------------------------------------------------------------------ total: 1.48 KB/s 2435.67 KB/s 2437.16 KB/s- Inputs: this Debian build has only proc and disk (getifaddrs, kstat, ioservice are for macOS/BSD/Solaris builds).
- Outputs: curses, curses2, plain, csv, html; -u bytes|bits|packets|errors; -T rate|max|sum|avg; -c count; -F file; -C CSV delimiter.
- -I eth0,wlan0 shows only these; -I %lo,docker0 hides them; -t refresh ms; -A average span; -D daemon; config in /etc/bwm-ng.conf or ~/.bwm-ng.conf.
Terminal
speedometer -i 1 -rx eth0 -tx eth0speedometer -rx eth0 -c -tx eth0 # new columnspeedometer -f download.iso # file growth speed- Each tap is one graph: -rx received, -tx transmitted, -c new column, -f file growth (with SIZE: progress bar).
- Real capture: RX eth0 about 1.4 KiB/s, TX eth0 about 2.39 MiB/s.
- -i interval, -b old blocky display, -p plain text, -z missing file = zero size.
188.11 Common mistakes
- Expecting iftop on a laptop to show the whole office LAN: a switch sends unicast frames only to the destination port, even with -p promiscuous; you see only your own interface.
- Using iftop or nload to find the process: only nethogs maps sockets to PIDs.
- Running packet-copy tools without root or CAP_NET_RAW.
- Reading the first bmon/bwm-ng sample (always 0) as real.
188.12 Interview tips
- Bandwidth full on a server: nload/bmon (which interface, in or out) -> iftop -nNP (which host pair and port) -> nethogs (which process) -> bwm-ng CSV / iptraf-ng -B for trend.
- iftop = hosts, nload = interface, nethogs = process.
- Packet-copy tools need root; counter-based tools are light and run without root.
- Scripting: iftop -t -s, nethogs -t -c, bmon -o ascii, bwm-ng -o plain/csv.