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
OR
/sbin/ifconfig -a
OR
ifconfig
Sample outputs:
eth0 Link encap:Ethernet HWaddr 00:19:d1:2a:ba:a8
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::219:d1ff:fe2a:baa8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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)
Memory:e3180000-e31a0000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
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 Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg 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:
Ip: 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 Icmp: 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 IcmpMsg: InType0: 65 InType3: 89 InType11: 71 OutType3: 79 OutType8: 67 Tcp: 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 Udp: 40292 packets received 62 packets to unknown port received. 0 packet receive errors 42369 packets sent UdpLite: TcpExt: 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 IpExt: 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.
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I am confused with the word ethernet packets and ethernet frames.
Are they the same thing ? Please explain.
thanks.
Those are IP statistics, not ethernet ones. There iare no FCS errors, runts, etc…