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
Share:
5,040

Related videos on Youtube

Kimel
Author by

Kimel

Updated on September 18, 2022

Comments

  • Kimel
    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
    Kimel almost 11 years
    I tried this as well, but there are no broadcasts counter.
  • cuonglm
    cuonglm almost 11 years
    Do you see any line contain tx_broadcast or rx_broadcast
  • Kimel
    Kimel almost 11 years
    No, I don't, maybe it is related to interface driver ?
  • Kimel
    Kimel almost 11 years
    So 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
    Kimel almost 11 years
    Thanks! Looks good (sorry I can't vote up-need 15 rep for that :))
  • Kimel
    Kimel almost 11 years
    Well, 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))...