• netstat


    1. 列出所有端口 (包括监听和未监听的)

    # netstat -a
    # netstat -at   //所有 tcp 端口
    # netstat -au   //所有 udp 端口

    2. 列出所有处于监听状态的 socket

    # netstat -l
    # netstat -lt   //所有监听 tcp 端口
    # netstat -lu   //所有监听 udp 端口

    3. 持续输出 netstat 信息

    # netstat -c

    4. 找出指定端口

    # netstat -ap | grep ssh

    5. 显示每个协议的统计信息

    # netstat -s
    # netstat -st   //TCP 端口的统计信息
    # netstat -su   //UDP 端口的统计信息
    Ip: //IP统计
        19953104 total packets received //接收包数
        0 forwarded //数据报递送数
        0 incoming packets discarded //接收后丢弃的包数
        19705169 incoming packets delivered //接收后转交的包数
        13733100 requests sent out
    Icmp: //ICMP统计
        24 ICMP messages received
        0 input ICMP message failed.
        ICMP input histogram:
            echo requests: 24
        42 ICMP messages sent
        0 ICMP messages failed
        ICMP output histogram:
            destination unreachable: 18 //无法到达主机数目
            echo replies: 24 //回复回应数
    IcmpMsg:
            InType8: 24
            OutType0: 24
            OutType3: 18
    Tcp: //TCP统计
        2106 active connections openings //主动打开数
        407 passive connection openings //被动打开数
        1274 failed connection attempts //连接失败尝试数
        278 connection resets received //复位连接数
        46 connections established
        18713627 segments received //当前已接收的报文数
        16067813 segments send out //当前已发送的报文数
        32 segments retransmited //被重传的报文数目
        0 bad segments received.
        2799 resets sent
    Udp: //UDP统计
        1533048 packets received //接收的数据包
        18 packets to unknown port received.
        0 packet receive errors //接收错误数
        10383 packets sent //发送的数据包
    UdpLite:
    TcpExt:
        156 TCP sockets finished time wait in fast timer
        41565 delayed acks sent
        61 delayed acks further delayed because of locked socket
        Quick ack mode was activated 2451 times
        22 packets directly queued to recvmsg prequeue.
        12406928 packet headers predicted
        1693405 acknowledgments not containing data payload received
        2012411 predicted acknowledgments
        7 times recovered from packet loss by selective acknowledgements
        2 congestion windows fully recovered without slow start
        5 congestion windows recovered without slow start by DSACK
        4 congestion windows recovered without slow start after partial ack
        7 fast retransmits
        11 other TCP timeouts
        TCPLossProbes: 8419
        TCPLossProbeRecovery: 7302
        2510 DSACKs sent for old packets
        8414 DSACKs received
        1 connections reset due to early user close
        3 connections aborted due to timeout
        TCPDSACKIgnoredNoUndo: 7308
        TCPSpuriousRTOs: 1
        TCPSackShifted: 2
        TCPSackMerged: 6
        TCPSackShiftFallback: 33
        TCPRcvCoalesce: 39927
        TCPOFOQueue: 19912
    IpExt:
        InBcastPkts: 988081
        OutBcastPkts: 2378
        InOctets: -1
        OutOctets: -1
        InBcastOctets: 115630041
        OutBcastOctets: 313496
        InNoECTPkts: 19969442

    源码
    http://download.csdn.net/download/zhangxuechao_/9820343

  • 相关阅读:
    第四周作业
    jsp第二次作业
    jsp第一次作业
    软件测试1
    activity
    listview
    sql
    登录
    第二次安卓作业
    安卓第一周作业
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/11709732.html
Copyright © 2020-2023  润新知