Linux network interface broadcast statistics

ethernetlinuxlinux-networking

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 ?

Best Answer

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