Linux See Ethernet Statistics

How do I see Ethernet (eth) statistics under Linux operating systems?

You need to use the following two commands:
a] ifconfig command – Display all interfaces which are currently available.


b] netstat command – Display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

ifconfig example

Type the following command:
/sbin/ifconfig eth0
/sbin/ifconfig -a
Sample outputs:

eth0      Link encap:Ethernet  HWaddr 00:19:d1:2a:ba:a8  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::219:d1ff:fe2a:baa8/64 Scope:Link
          RX packets:1948632 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1559234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2366493974 (2.3 GB)  TX bytes:388339315 (388.3 MB)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27378 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27378 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3046452 (3.0 MB)  TX bytes:3046452 (3.0 MB)

netstat Command Example

Ti display a table of all network interface including recived and send packets, enter:

netstat -i

Sample outputs:

Kernel Interface table
eth0       1500 0   1955323      0      0 0       1563543      0      0      0 BMRU
lo        16436 0     27472      0      0 0         27472      0      0      0 LRU

Display Summary Statistics For Each Protocol

Type the following command:

netstat -s

Sample outputs:

    2025059 total packets received
    21 with invalid addresses
    0 forwarded
    0 incoming packets discarded
    2024996 incoming packets delivered
    1568954 requests sent out
    5 outgoing packets dropped
    60 reassemblies required
    30 packets reassembled ok
    5 fragments failed
    225 ICMP messages received
    13 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 89
        timeout in transit: 71
        echo replies: 65
    146 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 79
        echo request: 67
        InType0: 65
        InType3: 89
        InType11: 71
        OutType3: 79
        OutType8: 67
    20603 active connections openings
    99 passive connection openings
    1125 failed connection attempts
    352 connection resets received
    17 connections established
    1983950 segments received
    1475010 segments send out
    51436 segments retransmited
    0 bad segments received.
    38462 resets sent
    40292 packets received
    62 packets to unknown port received.
    0 packet receive errors
    42369 packets sent
    16 invalid SYN cookies received
    2 packets pruned from receive queue because of socket buffer overrun
    4956 TCP sockets finished time wait in fast timer
    128 packets rejects in established connections because of timestamp
    45978 delayed acks sent
    5 delayed acks further delayed because of locked socket
    Quick ack mode was activated 6369 times
    21 packets directly queued to recvmsg prequeue.
    13099 bytes directly received in process context from prequeue
    1435761 packet headers predicted
    9 packets header predicted and directly queued to user
    133229 acknowledgments not containing data payload received
    38661 predicted acknowledgments
    5170 times recovered from packet loss by selective acknowledgements
    2 bad SACK blocks received
    Detected reordering 1 times using FACK
    Detected reordering 2 times using SACK
    Detected reordering 2 times using time stamp
    3 congestion windows fully recovered without slow start
    3 congestion windows partially recovered using Hoe heuristic
    9 congestion windows recovered without slow start by DSACK
    3521 congestion windows recovered without slow start after partial ack
    7455 TCP data loss events
    TCPLostRetransmit: 402
    6 timeouts after reno fast retransmit
    2810 timeouts after SACK recovery
    673 timeouts in loss state
    10164 fast retransmits
    111 forward retransmits
    7138 retransmits in slow start
    15322 other TCP timeouts
    878 SACK retransmits failed
    125 packets collapsed in receive queue due to low socket buffer
    8425 DSACKs sent for old packets
    167 DSACKs sent for out of order packets
    1244 DSACKs received
    13 DSACKs for out of order packets received
    1779 connections reset due to unexpected data
    104 connections reset due to early user close
    247 connections aborted due to timeout
    TCPSACKDiscard: 1
    TCPDSACKIgnoredOld: 650
    TCPDSACKIgnoredNoUndo: 463
    TCPSpuriousRTOs: 31
    TCPSackShifted: 5988
    TCPSackMerged: 14413
    TCPSackShiftFallback: 11127
    InMcastPkts: 556
    OutMcastPkts: 433
    InBcastPkts: 473
    InOctets: -1923455127
    OutOctets: 368984572
    InMcastOctets: 73654
    OutMcastOctets: 50857
    InBcastOctets: 40987

ss command – Display Quick Stats

Type the following command:

ss -s

Sample outputs:

ss -s
Total: 767 (kernel 824)
TCP:   123 (estab 15, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 0

Transport Total     IP        IPv6
*	  824       -         -        
RAW	  1         1         0        
UDP	  6         5         1        
TCP	  123       121       2        
INET	  130       127       3        
FRAG	  0         0         0        

See how to use ss command to display Linux TCP / UDP network and socket information.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

2 comments… add one
  • fazal noor Jul 2, 2011 @ 20:27

    I am confused with the word ethernet packets and ethernet frames.
    Are they the same thing ? Please explain.

  • Mircea Vutcovici Aug 1, 2012 @ 13:51

    Those are IP statistics, not ethernet ones. There iare no FCS errors, runts, etc…

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.