tl;dr The bandwidth usage recorded by nload (home page) is higher than what's provided by tcpdump (home page).

There seems to be a difference in bandwidth usage when I run tcpdump -e -w - | pv -a > /dev/null as opposed to running nload.

For example, I saw a bandwidth usage of 150kbps using nload but only 30kbps using tcpdump. To rule out pv, I've done the following:

# open a tmux session where tcpdump dumps all traffic into a file for 60 seconds
$ tmux new-session -d -s tcpdump_60secs 'tcpdump -e -w tempfile' && sleep 60 && tmux kill-server

$ wc -c tempfile
# divide by 60, resulting in bytes per second

Any pointers to how nload gets its bandwidth statistics will be appreciated.

Replicated on a clean Ubuntu 18.04 install, on a LXC proxmox container, tested with nload build using commit 8f92dc0.

  • To start with, which version of Linux have you installed (Ubuntu server, Ubuntu desktop, Kubuntu, Lubuntu, Xubuntu, Ubuntu MATE, et al.) , and which release number? Different releases have different tools for us to recommend. Please click edit and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our channel to you. All facts about your system should go in the Question with edit – K7AAY May 13 at 20:38
  • Is nload reporting bits per second and tcpdump bytes per second? Your method for tcpdump is only approximate, because tempfile includes pcap formatting. I measured 2.2 % overhead, but results will be payload length dependent. Extract with the -e option and count the packet lengths for an accurate answer. – Doug Smythies May 13 at 21:31

I looked through the source code and it appears that the data mainly comes from /proc/net/dev Reference on GitHub

To look further, the data comes from the kernel rather than direct sources and will involve the heavy diving into this source tree to fully understand the process.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.