Linux – Display IP & TCP statistics per interface (netstat -s with interface)

linuxnetstattcp

Linux has the ability to display protocol statistics with netstat -s. The output looks something like:

Excerpt:

7487 times unabled to send RST due to no memory
TCPDSACKIgnoredOld: 817
TCPDSACKIgnoredNoUndo: 7246527
TCPSpuriousRTOs: 4583587
TCPSackShifted: 15825
TCPSackMerged: 455582

But these are accumulated over all networking interfaces. Is there a way to see these statistics per interface? I know that there are packet level statistics in /sys/class/net/$INTERFACE/statistics, but have not been able to find any protocol related ones.

Best Answer

Netstat -s is a more intuitive display of /proc/net/netstat. Counters in it are global and not per interface. To get that kind of information you will need to use/write a monitoring tool using libpcap.