sbm: monitor network traffic

$ sbm -i wlp2s0 -c 10
wlp2s0:   0.00  bps Rx   0.00  bps Tx     0 pps Rx     0 pps Tx
wlp2s0:   5.54 kbps Rx  18.94 kbps Tx     6 pps Rx     8 pps Tx
wlp2s0:   2.78 Mbps Rx 122.69 kbps Tx   256 pps Rx   141 pps Tx
wlp2s0: 433.54 kbps Rx  45.22 kbps Tx    55 pps Rx    35 pps Tx
wlp2s0: 528.00  bps Rx 752.00  bps Tx     1 pps Rx     1 pps Tx
wlp2s0:  10.94 kbps Rx   5.50 kbps Tx     6 pps Rx     4 pps Tx
wlp2s0:   0.00  bps Rx   0.00  bps Tx     0 pps Rx     0 pps Tx
wlp2s0:  13.34 kbps Rx  26.10 kbps Tx    11 pps Rx    13 pps Tx
wlp2s0: 384.64 kbps Rx  57.70 kbps Tx    57 pps Rx    49 pps Tx
wlp2s0: 553.67 kbps Rx  51.35 kbps Tx    69 pps Rx    56 pps Tx

sbm (Simple Bandwidth Monitor) is a tiny utility to track your network traffic. It’s similar to slurm in functionality but shows a continuous log of transfer rates (upstream and downstream). The best use-case is the situation in which you want to figure out how much data an application transmits in isolation. With constant monitoring, you can also figure out easily if any application is sending information home. Continue reading sbm: monitor network traffic

vnstat: monitor internet data usage

cool_penguin_smallIf you have a data transfer limit on your internet connection you might want to keep a tab on how much data you have consumed already. The ISP stores the information in its servers and might provide you an option to view it. If it’s not there, try vnstat, written exactly to solve this problem. Continue reading vnstat: monitor internet data usage

NetHogs: monitor per process network traffic

NetHogs shows the real-time network bandwidth usage on an interface by process. It is a useful tool for those situations when you want to know – who is using all my bandwidth? Currently NetHogs supports the following:

  • Shows TCP download and upload speed per process
  • Supports both IPv4 and IPv6
  • Supports both Ethernet and PPP

NetHogs has to be run with root privileges and target interface name as parameter. If no interface name is provided, NetHogs tries eth0. Example usage:

$ sudo nethogs wlan0

Default refresh rate is update per second. It can be controlled by using the -d option:

-d seconds

There are some interactive controls to change the display or quit:

m : cycle between display modes (kb/s, kb, b, mb)
r : sort by 'received'
s : sort by 'sent'
q : quit

Webpage: NetHogs

trickle: manage bandwidth usage on Linux

cool_penguin_smallEveryone encounters this common situation – one of the processes using the whole bandwidth and others starving appearing slow. trickle is the solution on Linux. It is a network bandwidth manager. Before going into the usage we’ll discuss the requirements for trickle:

  • The program you want to monitor should be dynamically linked to glibc (the libc.so shared library). The reason is that trickle is a userspace application that uses the loader preloading technique. Essentially it provides a new socket interface and the original one is masked. To know whether your program meets the requirement use ldd.
    $ ldd /usr/bin/axel|grep libc.so
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff552ce1000)

    So yes, axel can be a candidate if it meets the next requirement.

  • The program must use the TCP protocol. To check that, use netstat after running the program.
    $ netstat -pa|grep axel
    tcp 0 0 192.168.0.16:37901 alpinecurrant.cano:http ESTABLISHED 10966/axel

    axel does use TCP! axel is fit for being used with trickle.

Trickle can be used in 2 modes – as a standalone utility for each program or as a daemon that can handle multiple programs fired with trickle.

  • As a standalone program
    trickle -u 128 -d 64 myprogram

    where u denotes upload limit and d denotes download limit in KB/s.

  • As a daemon
    trickled -u 512 -d 256

    sets the cumulative limit for all the programs run using trickle.

trickle can be used by non-root users. You can run your favourite terminal session using trickle and all programs (matching trickle’s criteria) run from the terminal will be monitored by trickle.

trickle is available in the default repositories on many distros, including Ubuntu.

Webpage: trickle

iftop: network counterpart of top

tux_compIf you have used top and wished that you had something like that to check your network usage your wish is granted. iftop does the same for a network interface by showing you the bandwidth usage. Available in synaptic.

Check this article to count the number of open connections and other useful network hacks.

Webpage: iftop