netstat--打印网络连接、路由表、网卡统计等

2021-04-21 22:26

阅读:654

标签:open   进入   ted   ace   路由   end   sock   val   interface   

netstat-打印网络连接,路由表,接口统计信息的工具,在平常工作也会经常遇到;
常用选项:

    -i:查看网卡数据包收发情况(常用于查看是否有丢包、错误)

    -s:对各种协议的统计信息

    -r:查看路由表信息(也常用route -n)查看

用法示例一:查看网络包收发情况,以确定是否存在丢包的情况(当网络存在延迟的时候用)

[root@localhost ~]# netstat -i
Kernel Interface table
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
ens33     1500   115820      0      0 0         25312      0      0      0 BMRU
lo       65536      104      0      0 0           104      0      0      0 LRU
RX-OK:接收的总包数

RX-ERR:总错误数

RX-DRP:进入 Ring Buffer 后因其他原因(如内存不足)导致的丢包数

RX-OVR:Ring Buffer 溢出导致的丢包数 

TX-OK等也是类似的

用法示例二:对各种协议的统计信息(常用于确认传输层和网络层是否出现问题)

会对ip、icmp、tcp、udp协议的网络包数据进行统计

[root@localhost ~]# netstat -s
Ip:
    24060 total packets received
    0 forwarded
    0 incoming packets discarded
    24060 incoming packets delivered
    23707 requests sent out
    16 outgoing packets dropped
Icmp:
    83 ICMP messages received
    2 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 81
        echo replies: 2
    151 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 146
        echo request: 5
IcmpMsg:
        InType0: 2
        InType3: 81
        OutType3: 146
        OutType8: 5
Tcp:
    83 active connections openings
    2 passive connection openings
    0 failed connection attempts
    1 connection resets received
    2 connections established
    26009 segments received
    24723 segments send out
    22 segments retransmited
    0 bad segments received.
    14 resets sent
Udp:
    157 packets received
    149 packets to unknown port received.
    0 packet receive errors
    337 packets sent
    0 receive buffer errors
    0 send buffer errors
UdpLite:
TcpExt:
    1 invalid SYN cookies received
    64 TCP sockets finished time wait in fast timer
    10 delayed acks sent
    Quick ack mode was activated 63 times
    9978 packet headers predicted
    1349 acknowledgments not containing data payload received
    71 predicted acknowledgments
    6 congestion windows recovered without slow start after partial ack
    8 other TCP timeouts
    TCPLossProbes: 7
    TCPLossProbeRecovery: 2
    65 DSACKs sent for old packets
    4 DSACKs sent for out of order packets
    5 DSACKs received
    6 connections reset due to unexpected data
    1 connections aborted due to timeout
    TCPRcvCoalesce: 13797
    TCPOFOQueue: 12267
    TCPOFOMerge: 4
    TCPSynRetrans: 7
    TCPOrigDataSent: 2676
IpExt:
    InMcastPkts: 69
    InBcastPkts: 84
    InOctets: 144180091
    OutOctets: 2230841
    InMcastOctets: 1932
    InBcastOctets: 9481
    InNoECTPkts: 104145
[root@localhost ~]# 
 TCPSynRetrans: 7    #7次 SYN 重传

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

netstat--打印网络连接、路由表、网卡统计等

标签:open   进入   ted   ace   路由   end   sock   val   interface   

原文地址:https://www.cnblogs.com/liujunjun/p/12247935.html


评论


亲,登录后才可以留言!