htop icon indicating copy to clipboard operation
htop copied to clipboard

Htop counting network traffic twice on bonded interface

Open itscooldani opened this issue 1 year ago • 2 comments

I have ethernet and wifi interfaces bonded together for load balancing, and I'm noticing that htop now shows double the network usage (double the possible network usage - twice my ISP speed) than it did before. I'm assuming this has something to do with counting the physical interfaces AND the virtual bonded interface, which would count every packet twice, but I am unable to confirm this.

I haven't been able to find anywhere which lets me select specific interfaces to use, which would be super handy. If there's no option for that, this can also be a feature request! I'm happy to make a new issue with that though if that's preferable.

Happy to do any digging/further investigation you need, just not sure what I'm looking for or where.

itscooldani avatar May 03 '24 04:05 itscooldani

There's an old feature request for per-interface meters at #200, but that one needs still some thought to create a reasonable UI/UX.

The double-accounting for interfaces is known (cf. #646), and filtering will likely involve a bit more than just bridges.

If you can look for ways in which NIC types can be distinguished to filter out composit devices (bridges, veth pairs, …) would be nice. The implementation of the network meter is cross-platform, thus also things involving *BSD would be of interest. TIA.

BenBE avatar May 03 '24 08:05 BenBE

If you can look for ways in which NIC types can be distinguished to filter out composit devices (bridges, veth pairs, …) would be nice.

Not a universal solution for all virtual / composite devices but at least for bonding devices / "load balancing bundles" on Linux this should be trivial as the devices will have MASTER and SLAVE flags.

2: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 3c:ec:ef:75:64:58 brd ff:ff:ff:ff:ff:ff
    inet 10.10.1.254/24 brd 10.10.1.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 *snip*/64 scope global dynamic noprefixroute 
       valid_lft 205435sec preferred_lft 119035sec
    inet6 fe80::3eec:efff:fe75:6458/64 scope link 
       valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
    link/ether 3c:ec:ef:75:64:58 brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 3c:ec:ef:75:64:59 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3eec:efff:fe75:6459/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever
5: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
    link/ether 3c:ec:ef:75:64:58 brd ff:ff:ff:ff:ff:ff permaddr 3c:ec:ef:75:64:5a
6: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc prio state UP group default qlen 1000
    link/ether 3c:ec:ef:75:64:5b brd ff:ff:ff:ff:ff:ff
    inet *snip*/24 brd *snip* scope global dynamic noprefixroute eth3
       valid_lft 66901sec preferred_lft 56101sec
    inet6 fe80::3eec:efff:fe75:645b/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever

https://www.man7.org/linux/man-pages/man7/netdevice.7.html

smlanger avatar Mar 23 '25 14:03 smlanger