Linux network interface broadcast statistics
5,040
You can try ethtool
:
ethtool -S <NIC name>
But not all of drivers is support for statistic, read manpage of ethtool for more details.
Updated
The solution is looking at /proc/net/netstat
, but it is not in human readable. Using some awk
to manipulate it:
cat /proc/net/netstat | \
awk '(f==0) { i=1; while ( i<NF) {n[i] = $i; i++ }; f=1; next} \
(f==1){ i=1; while ( i<NF){ printf "%s = %d\n", n[i], $i; i++}; f=0}' | \
grep Bcast
Output in my machine:
InBcastPkts = 171
OutBcastPkts = 17
InBcastOctets = 11856
Related videos on Youtube
Author by
Kimel
Updated on September 18, 2022Comments
-
Kimel almost 2 years
I am looking for a way to see the number of Ethernet broadcast frames transmit/received by the network interfaces.
I am familiar with many Linux commands,procs and options to get interface statistics (ifconfig , nstat (which shows ip broadcasts), /proc/net/dev , ifstat etc...).
For example /proc/net/dev shows received Multicast, but there is no reference for broadcasts.
Is there a standard way to see it ? -
Kimel almost 11 yearsI tried this as well, but there are no broadcasts counter.
-
cuonglm almost 11 yearsDo you see any line contain
tx_broadcast
orrx_broadcast
-
Kimel almost 11 yearsNo, I don't, maybe it is related to interface driver ?
-
Kimel almost 11 yearsSo I looked at my driver code, I see it doesn't count broadcasts. but is there other Linux generic interface for network stats (including broadcasts) ?
-
Kimel almost 11 yearsThanks! Looks good (sorry I can't vote up-need 15 rep for that :))
-
Kimel almost 11 yearsWell, checking it looks like IP layer broadcast statistics, I don't think it consist Ethernet broadcast (such as ARP). I see that this proc is updated from the net/ipv4/proc.c file (which is following RFC4293 (MIB for IP))...