IP-STATS(8)

๐Ÿ“ฆ
version 7.3.0 ยท 2 versions
, in alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

๐Ÿ’– IP-STATS(8) ๐Ÿ’–

okay bestie, welcome to ip-stats, straight out of the iproute2 crew, sitting pretty in section 8 of the Linux manuals. this is the one that handles interface statistics โ€” showing them, managing them, the whole vibe. let's get into it ๐Ÿซถ


โœจ NAME โœจ

ip-stats โ€” manage and show interface statistics ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

ip stats  { COMMAND | help }

ip stats show [ dev DEV ] [ group GROUP [ subgroup SUBGROUP  [ suite
        SUITE ] ... ] ... ] ...

ip stats set dev DEV l3_stats { on | off }

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

ip stats set ๐Ÿ”ง

so this one is for toggling whether a certain HW statistics suite gets collected on a given netdevice. it's giving on/off switch energy, no cap.

these are the statistics suites that are supported:

  • l3_stats โ€” L3 stats reflect traffic that takes place in a HW device on an object that corresponds to the given software netdevice. literally the L3 traffic, mirrored onto your soft netdev. slay.

ip stats show ๐Ÿ‘‘

this is for showing stats on a given netdevice, or dumping statistics across all netdevices. by default, all stats are requested โ€” it wants everything, main character energy fr fr. but you can filter which stats get requested by using the group and subgroup keywords.

you can also specify several groups, or several subgroups for one group. and here's the tea: when no subgroups are given for a group, all the subgroups are requested. generous of it honestly ๐Ÿ’…

these are the groups it recognizes:

  • group link โ€” Link statistics. the same suite that ip -s link show shows. yes, that one.
  • group offload โ€” a group that contains a number of HW-oriented statistics. see below for the individual subgroups hanging out inside this group.
  • group xstats โ€” Extended statistics. a subgroup identifies the type of netdevice to show the statistics for.
  • group xstats_slave โ€” Extended statistics for the slave of a netdevice of a given type. a subgroup identifies the type of master netdevice.
  • group afstats โ€” a group for address-family specific netdevice statistics.

๐ŸŽ€ group offload subgroups ๐ŸŽ€

  • subgroup cpu_hit โ€” the cpu_hit statistics suite is useful on hardware netdevices. the link statistics on these devices reflect both the hardware- and software-datapath traffic. the cpu_hit statistics then only reflect software-datapath traffic. so it's the lil slice of truth underneath ๐Ÿ“
  • subgroup hw_stats_info โ€” this suite does not include traffic statistics, it's more of a vibe check ๐Ÿ‘€ โ€” it communicates the state of other statistics. through this subgroup, it's possible to discover whether a given statistic was enabled, and when it was, whether any device driver actually configured its device to collect these statistics. for example, l3_stats was enabled in the following case, but no driver has installed it:
# ip stats show dev swp1 group offload subgroup hw_stats_info
56: swp1: group offload subgroup hw_stats_info
    l3_stats on used off

after an L3 address is added to the netdevice, the counter will be installed:

# ip addr add dev swp1 192.0.2.1/28
# ip stats show dev swp1 group offload subgroup hw_stats_info
56: swp1: group offload subgroup hw_stats_info
    l3_stats on used on

see?? used off becomes used on. character development ๐Ÿ’–

  • subgroup l3_stats โ€” these statistics reflect L3 traffic that takes place in HW on an object that corresponds to the netdevice. note that this suite is disabled by default and needs to be first enabled through ip stats set. do not skip that step bestie, it will not work ๐Ÿ™ˆ

for example:

# ip stats show dev swp2.200 group offload subgroup l3_stats
112: swp2.200: group offload subgroup l3_stats on used on
    RX:  bytes packets errors dropped   mcast
          8900      72      2       0       3
    TX:  bytes packets errors dropped
          7176      58      0       0

note how the l3_stats_info for the selected group is also part of the dump. it just comes along, it's invited ๐ŸŽ€

๐ŸŒˆ group xstats and group xstats_slave subgroups ๐ŸŒˆ

  • subgroup bridge โ€” various statistics on bridges and their slaves.
    • suite stp โ€” STP statistics
    • suite mcast โ€” IGMP / MLD statistics
    • suite vlan โ€” per-VLAN traffic statistics
  • subgroup bond [ suite 802.3ad ] โ€” statistics for LACP traffic on bond devices and their slaves.

โญ group afstats subgroups โญ

  • subgroup mpls โ€” statistics for MPLS traffic seen on the netdevice. for example:
# ip stats show dev veth01 group afstats subgroup mpls
3: veth01: group afstats subgroup mpls
    RX: bytes packets errors dropped noroute
            0       0      0       0       0
    TX: bytes packets errors dropped
          216       2      0       0

๐Ÿ’… EXAMPLES ๐Ÿ’…

  • # ip stats set dev swp1 l3_stats on โ€” enables collection of L3 HW statistics on swp1. turning it ON bestie โœจ
  • # ip stats show group offload โ€” shows all offload statistics on all netdevices. everything, everywhere, all at once ๐Ÿซถ
  • # ip stats show dev swp1 group link โ€” shows link statistics on the given netdevice. just the one. focused. iconic.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

ip(8), ip-link(8),


๐ŸŽ€ AUTHOR ๐ŸŽ€

Manpage by Petr Machata. thank you king ๐Ÿ‘‘


and that's the whole page bestie, no notes ๐Ÿ’–

okay so this little masterpiece lives in iproute2 and it's dated 16 Mar 2022 โ€” go forth and read your stats, you've absolutely got this ๐Ÿฆ‹๐ŸŒธโœจ