LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ip-stats

manages and displays network interface statistics

TLDR

Show all interface statistics
$ ip stats
copy
Show statistics for a specific interface
$ ip stats show dev [eth0]
copy
Show link-layer statistics
$ ip stats show group link
copy
Show hardware offload statistics
$ ip stats show group offload
copy
Show offload statistics for specific interface
$ ip stats show dev [eth0] group offload
copy
Show specific offload subgroup
$ ip stats show dev [eth0] group offload subgroup [l3_stats|cpu_hit|hw_stats_info]
copy
Show bridge STP, multicast or VLAN statistics
$ ip stats show dev [br0] group xstats subgroup bridge suite [stp|mcast|vlan]
copy
Show LACP statistics for a bond
$ ip stats show dev [bond0] group xstats subgroup bond suite 802.3ad
copy
Show MPLS statistics
$ ip stats show dev [eth0] group afstats subgroup mpls
copy
Output as JSON
$ ip -j -p stats show dev [eth0] group link
copy
Enable L3 hardware statistics
$ ip stats set dev [eth0] l3_stats on
copy

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 manages and displays network interface statistics. It provides access to both software-maintained counters and hardware offload statistics where supported.Statistics groups include link-layer counters (the same as ip -s link show), hardware offload metrics, extended per-device-type statistics for bridges and bonds, and address-family specific statistics like MPLS. By default, all stats are requested. Hardware statistics collection may need to be explicitly enabled.

PARAMETERS

show [dev DEVICE]

Display statistics
set dev DEVICE
Configure statistics collection
group GROUP
Statistics group: link, offload, xstats, xstats_slave, afstats. Several groups may be given
subgroup SUBGROUP
Specific subgroup within a group: cpuhit, hwstatsinfo, l3stats (offload); bridge, bond (xstats); mpls (afstats)
suite SUITE
Specific suite within a subgroup, e.g. stp, mcast, vlan (bridge) or 802.3ad (bond)
l3_stats on|off
Enable/disable L3 hardware statistics

INSTALL

sudo apt install iproute2
copy
sudo pacman -S iproute2
copy
sudo apk add iproute2-minimal
copy
sudo zypper install iproute2
copy
brew install iproute2
copy
nix profile install nixpkgs#iproute2
copy

CAVEATS

Hardware offload statistics require driver and hardware support. Some statistics may not be available on all interfaces. L3 offload statistics are disabled by default and must be enabled with ip stats set; use subgroup hw_stats_info to check whether a driver actually installed the counters. Requires iproute2 5.19 or newer.

HISTORY

ip stats was added in iproute2 5.19 (2022), contributed by Petr Machata, to expose the kernel's RTM_GETSTATS interface, including the L3 hardware offload statistics introduced in Linux 5.18.

SEE ALSO

ip(8), ip-link(8), ip-monitor(8), ifstat(1), nstat(8)

RESOURCES

Copied to clipboard
Kai