{"id":1557,"date":"2018-11-23T16:45:32","date_gmt":"2018-11-23T08:45:32","guid":{"rendered":"http:\/\/ykyi.net\/?p=1557"},"modified":"2018-11-23T16:45:32","modified_gmt":"2018-11-23T08:45:32","slug":"netstat-s%e7%bb%9f%e8%ae%a1%e8%be%93%e5%87%ba%e7%9a%84%e6%89%80%e6%9c%89%e5%ad%97%e6%ae%b5%e8%af%a6%e7%bb%86%e8%a7%a3%e9%87%8a","status":"publish","type":"post","link":"https:\/\/ykyi.net\/?p=1557","title":{"rendered":"netstat -s\u7edf\u8ba1\u8f93\u51fa\u7684\u6240\u6709\u5b57\u6bb5\u8be6\u7ec6\u89e3\u91ca"},"content":{"rendered":"<p>\u4eca\u5929\u5de5\u4f5c\u4e0a\u78b0\u5230\u4e00\u4e2a\u95ee\u9898\u9700\u8981\u77e5\u9053udp\u7684\u4e22\u5305\u6570\u636e\u3002\u5b9e\u9645\u4e0a\u6211\u4e0d\u76f8\u4fe1\u80fd\u7b80\u5355\u5730\u5f97\u5230udp\u7684\u4e22\u5305\u7cbe\u786e\u6570\u636e\u3002\u7406\u7531\u662f\uff0c\u7f51\u5361\u8d1f\u8f7d\u592a\u9ad8\u65f6\u6709\u4e9b\u5305\u8fde\u7f51\u5361\u90fd\u6ca1\u6536\u5230\uff0c\u6839\u672c\u4e0d\u53ef\u80fd\u6765\u5f97\u53ca\u6c47\u62a5\u7ed9\u5185\u6838\u3002\u53e6\u5916\uff0c\u5982\u679c\u662f\u8def\u7531\u5668\u628audp\u4e22\u4e86\uff0c\u90a3udp\u7684\u76ee\u7684\u7aef\u673a\u5668\u5f53\u7136\u66f4\u4e0d\u53ef\u80fd\u611f\u77e5\u5230\u6709\u4e22\u5305\u4e86\u3002<\/p>\n<p>\u8fd9\u65f6\uff0c\u540c\u4e8b\u8bf4netstat -us (&#8211;statistic)\u53ef\u4ee5\u770b\u5230udp\u7684\u4e22\u5305\u3002\u8fd9\u91cc\u7684u\u9009\u9879\u6307\u7684\u662f\u53ea\u5c55\u793audp\u76f8\u5173\u7684\u7edf\u8ba1\uff0cs\u9009\u9879\u81ea\u7136\u8868\u793a\u7684\u662f\u7edf\u8ba1\u4e86\u3002\u5982\u679c\u4e0d\u7528u\u9009\u9879\uff0c\u5219\u51fa\u663e\u793a\u6240\u6709\u7edf\u8ba1\u6570\u636e\u3002\u4e0b\u9762\u662f\u6211\u7684\u673a\u5668\u4e0a\u7684\u8f93\u51fa\u3002<\/p>\n<pre><code class=\"language-bash \">Ip:\n    203440255187 total packets received\n    0 forwarded\n    0 incoming packets discarded\n    201612429535 incoming packets delivered\n    1064529177 requests sent out\n    15 fragments dropped after timeout\n    3058122492 reassemblies required\n    1230296840 packets reassembled ok\n    15 packet reassembles failed\nIcmp:\n    14869220 ICMP messages received\n    3965512 input ICMP message failed.\n    ICMP input histogram:\n        destination unreachable: 6054246\n        timeout in transit: 687\n        echo requests: 8570532\n        echo replies: 243755\n    12913011 ICMP messages sent\n    0 ICMP messages failed\n    ICMP output histogram:\n        destination unreachable: 4097869\n        time exceeded: 5\n        echo request: 244605\n        echo replies: 8570532\nIcmpMsg:\n        InType0: 243755\n        InType3: 6054246\n        InType8: 8570532\n        InType11: 687\n        OutType0: 8570532\n        OutType3: 4097869\n        OutType8: 244605\n        OutType11: 5\nTcp:\n    111681768 active connections openings\n    4186820 passive connection openings\n    24951865 failed connection attempts\n    55064041 connection resets received\n    275 connections established\n    1033901799 segments received\n    1776166765 segments send out\n    12156205 segments retransmited\n    6705 bad segments received.\n    106348033 resets sent\nUdp:\n    198894689917 packets received\n    472986510 packets to unknown port received.\n    1146976531 packet receive errors\n    116750744 packets sent\n    110301286 receive buffer errors\n    0 send buffer errors\nUdpLite:\nTcpExt:\n    423 invalid SYN cookies received\n    693 packets pruned from receive queue because of socket buffer overrun\n    19 packets pruned from receive queue\n    11309370 TCP sockets finished time wait in fast timer\n    106 packets rejects in established connections because of timestamp\n    10210477 delayed acks sent\n    20811 delayed acks further delayed because of locked socket\n    Quick ack mode was activated 8856 times\n    17118697 packets directly queued to recvmsg prequeue.\n    301717551 bytes directly in process context from backlog\n    152118951904 bytes directly received in process context from prequeue\n    104771733 packet headers predicted\n    15179703 packets header predicted and directly queued to user\n    218747377 acknowledgments not containing data payload received\n    102637644 predicted acknowledgments\n    7293 times recovered from packet loss by selective acknowledgements\n    Detected reordering 40 times using FACK\n    Detected reordering 27 times using SACK\n    Detected reordering 1088 times using time stamp\n    476 congestion windows fully recovered without slow start\n    5287 congestion windows partially recovered using Hoe heuristic\n    236 congestion windows recovered without slow start by DSACK\n    151673 congestion windows recovered without slow start after partial ack\n    1 timeouts after reno fast retransmit\n    4 timeouts after SACK recovery\n    10540 timeouts in loss state\n    7232 fast retransmits\n    649 forward retransmits\n    1871 retransmits in slow start\n    11612658 other TCP timeouts\n    TCPLossProbes: 93185\n    TCPLossProbeRecovery: 14667\n    2431 packets collapsed in receive queue due to low socket buffer\n    8814 DSACKs sent for old packets\n    3350 DSACKs received\n    1 DSACKs for out of order packets received\n    90851 connections reset due to unexpected data\n    214 connections reset due to early user close\n    352 connections aborted due to timeout\n    TCPDSACKIgnoredNoUndo: 1571\n    TCPSpuriousRTOs: 7\n    TCPSackShifted: 94\n    TCPSackMerged: 131\n    TCPSackShiftFallback: 21183\n    TCPTimeWaitOverflow: 1876775\n    TCPRcvCoalesce: 15711184\n    TCPOFOQueue: 3194\n    TCPChallengeACK: 2337394\n    TCPSYNChallenge: 13608\n    TCPSpuriousRtxHostQueues: 1982796\nIpExt:\n    InBcastPkts: 46443933\n    InOctets: 44312451521655\n    OutOctets: 1915626725817\n    InBcastOctets: 6827280595\n<\/code><\/pre>\n<p><em>\u5582\uff0c\u8981\u662f\u8f6c\u8f7d\u6587\u7ae0\u3002\u9ebb\u70e6\u8d34\u4e00\u4e0b\u51fa\u5904 ykyi.net \u91c7\u96c6\u722c\u866b\u628a\u94fe\u63a5\u4e5f\u6293\u8d70<\/em><\/p>\n<p>\u8fd9\u91cc\u9762\u786e\u5b9e\u6709\u4e24\u4e2a\u7591\u4f3c\u8868\u793audp\u7684\u4e22\u5305\u6570\u7684\u6570\u636e\uff1a<\/p>\n<pre><code class=\"language-bash \">Udp:\n    1146976531 packet receive errors\n    110301286 receive buffer errors\n<\/code><\/pre>\n<p>\u4e8e\u662f\uff0c\u5f53\u7136\u9996\u5148\u662f\u770blinux man page\u3002\u7ed3\u679cnetstat\u7684man\u624b\u518c\u91cc\u5c45\u7136\u6ca1\u6709\u8fd9\u4e9b\u5b57\u6bb5\u7684\u4ecb\u7ecd\u3002<br \/>\n\u8ddf\u4f4f\uff0c\u95eegoogle\u3002\u6ca1\u60f3\u5230\uff0c\u7b54\u6848\u5c31\u662fnetstat -s\u7684\u8f93\u51fa\u5e76\u6ca1\u6709\u51c6\u786e\u7684\u6587\u6863(pooly documented)\u3002<br \/>\n\u8fd9\u91cc\u6709\u4e2a\u8d34\u5b50\u95ee\u4e86\u76f8\u540c\u7684\u95ee\u9898 https:\/\/www.reddit.com\/r\/linux\/comments\/706wsa\/detailed_explanation_of_all_netstat_statistics\/<br \/>\n\u7b80\u5355\u5730\u8bf4\uff0c\u56de\u8d34\u4eba\u544a\u8bc9\u4ed6\uff0c\u201c\u522b\u7528netstat\uff0c\u800c\u662f\u7528nstat\u548cip tools\u201d\u201c\u8fd9\u662f\u4e2a\u4e0d\u53ef\u80fd\u7684\u4efb\u52a1\uff0c\u9664\u975e\u770b\u5b8c\u6210\u5428\u6e90\u4ee3\u7801\u201d\u3002<br \/>\nblablabla &#8230;<br \/>\n\u4e8b\u5b9e\u4e0a\uff0c\u770b\u4e86google\u5230\u7684\u4e00\u4e9b\u8d34\u5b50\u540e\uff0c\u8fd8\u662f\u5927\u6982\u77e5\u9053\u4e86\u771f\u76f8\u3002<\/p>\n<pre><code class=\"\">    1146976531 packet receive errors\n<\/code><\/pre>\n<p>\u8fd9\u4e00\u53e5\u5bf9\u5e94<a href=\"https:\/\/tools.ietf.org\/html\/rfc4113\">\u5173\u4e8eUDP\u7684\u4e00\u4e2aRFC\u6807\u51c6\u7684\u6587\u6863<\/a> \u4e2d\u5b9a\u4e49\u7684\u5b57\u6bb5 udpInErrors\u3002<\/p>\n<blockquote><p>\n  &#8220;The number of received UDP datagrams that could not be<br \/>\n             delivered for reasons other than the lack of an application<br \/>\n             at the destination port.&#8221;<br \/>\n  udpInErrors\u8868\u793a\u64cd\u4f5c\u7cfb\u7edf\u6536\u5230\u7684\u4e0d\u80fd\u88ab\u6295\u9012\u7684UDP\u5305\uff0c\u4e0d\u80fd\u6295\u9012\u7684\u539f\u56e0\u9664\u4e86\u6ca1\u6709\u5e94\u7528\u7a0b\u5e8f\u5f00\u542f\u4e86\u5bf9\u5e94\u7684\u7aef\u53e3\u3002\n<\/p><\/blockquote>\n<p>\u800c\u8fd9\u4e00\u884c<\/p>\n<pre><code class=\"\">    110301286 receive buffer errors\n<\/code><\/pre>\n<p>\u8fd9\u4e00\u884c\u5bf9\u5e94 nstat -a -z (\u4e0b\u6587\u4f1a\u518d\u63d0\u5230nstat)\u8f93\u51fa\u4e2d\u7684 UdpRcvbufErrors \u5b57\u6bb5\u3002\u6211\u6ca1\u6709\u627e\u5230RFC\u5173\u4e8eUdpRcvbufErrors\u5b57\u6bb5\u7684\u5b9a\u4e49\u3002<br \/>\nIBM\u5b98\u7f51\u4e0a\u6709\u4e2a\u7f51\u9875\u7b80\u5355\u4ecb\u7ecd\u4e86UdpRcvbufErrors\uff1a Number of UDP buffer receive errors. \uff08UDP\u7684\u7f13\u51b2\u6536\u5230\u9519\u8bef\u7684\u6b21\u6570\uff09\u3002<br \/>\n\u518d\u7ed3\u5408\u8fd9\u7bc7\u6587\u7ae0: \u4e3a\u4f55udp\u4f1a\u88ab\u4e22\u5f03<a href=\"https:\/\/jvns.ca\/blog\/2016\/08\/24\/find-out-where-youre-dropping-packets\/\">Why do UDP packets get dropped<\/a>\u3002\u6211\u975e\u5e38\u6709\u4fe1\u5fc3\u7684\u8ba4\u4e3a UdpRcvbufErrors \u8868\u793a\u7684\u662f\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u6838tcp\u6808\u7ed9udp socket\u5206\u914d\u7684\u7f13\u51b2\u51fa\u9519\uff08\u7f13\u51b2\u6ee1\uff09\u7684\u6b21\u6570\u3002\u81f3\u4e8e\u7f51\u5361\u81ea\u5df1\u7684\u7f13\u51b2\uff0c\u548c\u64cd\u4f5c\u7cfb\u7edf\u7684\u7f13\u51b2\u662f\u4e24\u56de\u4e8b\u3002\u7f51\u5361\u7684\u7f13\u51b2\u51fa\u9519\u4e0d\u4f1a\u88ab\u8ba1\u5165\u8fd9\u4e2a\u8ba1\u6570\u3002udp\u7ecf\u8fc7\u7684\u8def\u7531\u7684\u4e22\u5305\u6570\u5f53\u7136\u53ea\u80fd\u591f\u67e5\u770b\u5bf9\u5e94\u7684\u8def\u7531\u5668\u7684\u7edf\u8ba1\u6570\u636e\u4e86\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u56e0\u4e3anetstat\u5df2\u7ecf\u88ab\u5e9f\u5f03\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u3002\u800c\u662f\u7528 nstat \u548c ss \u8fd9\u4e24\u4e2a\u65b0\u547d\u4ee4\u4ee3\u66ff\u3002<br \/>\nnstat\u7684\u8f93\u51fa\u76f8\u5f53\u4e8enetstat -s\u7684\u8f93\u51fa\u3002\u4f46nstat\u4f1a\u8f93\u51fa\u6bd4netstat -s\u66f4\u591a\u7684\u5b57\u6bb5\u4fe1\u606f\uff0c\u4e14\u7edd\u5927\u591a\u6570\u5b57\u6bb5\u540d\u5bf9\u5e94\u5230RFC\u6807\u51c6\u4e2d\u7528\u7684\u5b57\u6bb5\u540d\u3002<\/p>\n<p>\u53ef\u4efb\u610f\u8f6c\u8f7d\u672c\u6587\uff0c\u4f46\u9700\u8981\u6ce8\u660e\u51fa\u5904\uff01\uff01\uff01\u8c22\u8c22<\/p>\n<p>Why do UDP packets get dropped: https:\/\/jvns.ca\/blog\/2016\/08\/24\/find-out-where-youre-dropping-packets\/<br \/>\n1: https:\/\/tools.ietf.org\/html\/rfc4113<br \/>\n2: https:\/\/www.ibm.com\/support\/knowledgecenter\/STXNRM_3.13.4\/coss.doc\/deviceapi_response_2.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5de5\u4f5c\u4e0a\u78b0\u5230\u4e00\u4e2a\u95ee\u9898\u9700\u8981\u77e5\u9053udp\u7684\u4e22\u5305\u6570\u636e\u3002\u5b9e\u9645\u4e0a\u6211\u4e0d\u76f8\u4fe1\u80fd\u7b80\u5355\u5730\u5f97\u5230udp\u7684\u4e22\u5305\u7cbe\u786e\u6570\u636e\u3002\u7406\u7531\u662f\uff0c\u7f51\u5361\u8d1f\u8f7d\u592a\u9ad8\u65f6\u6709\u4e9b\u5305\u8fde\u7f51\u5361\u90fd\u6ca1\u6536\u5230\uff0c\u6839\u672c\u4e0d\u53ef\u80fd\u6765\u5f97\u53ca\u6c47\u62a5\u7ed9\u5185\u6838\u3002\u53e6\u5916\uff0c\u5982\u679c\u662f\u8def\u7531\u5668\u628audp\u4e22\u4e86\uff0c\u90a3udp\u7684\u76ee\u7684\u7aef\u673a\u5668\u5f53\u7136\u66f4\u4e0d\u53ef\u80fd\u611f\u77e5\u5230\u6709\u4e22\u5305\u4e86\u3002 \u8fd9\u65f6\uff0c\u540c\u4e8b\u8bf4netstat -us (&#8211;statistic)\u53ef\u4ee5\u770b\u5230udp\u7684\u4e22\u5305\u3002\u8fd9\u91cc\u7684u\u9009\u9879\u6307\u7684\u662f\u53ea\u5c55\u793audp\u76f8\u5173\u7684\u7edf\u8ba1\uff0cs\u9009\u9879\u81ea\u7136\u8868\u793a\u7684\u662f\u7edf\u8ba1\u4e86\u3002\u5982\u679c\u4e0d\u7528u\u9009\u9879\uff0c\u5219\u51fa\u663e\u793a\u6240\u6709\u7edf\u8ba1\u6570\u636e\u3002\u4e0b\u9762\u662f\u6211\u7684\u673a\u5668\u4e0a\u7684\u8f93\u51fa\u3002 Ip: 203440255187 total packets received 0 forwarded 0 incoming packets discarded 201612429535 incoming packets delivered 1064529177 requests sent out 15 fragments dropped after timeout 3058122492 reassemblies required 1230296840 packets reassembled ok 15 packet reassembles failed Icmp: 14869220 ICMP messages received 3965512 input ICMP message failed. ICMP input histogram: destination unreachable: 6054246 &hellip; <a href=\"https:\/\/ykyi.net\/?p=1557\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;netstat -s\u7edf\u8ba1\u8f93\u51fa\u7684\u6240\u6709\u5b57\u6bb5\u8be6\u7ec6\u89e3\u91ca&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6,7],"tags":[51,59],"class_list":["post-1557","post","type-post","status-publish","format-standard","hentry","category-network","category-tech_articles","category-unix_linux","tag-linux-2","tag-network-2"],"_links":{"self":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1557"}],"version-history":[{"count":0,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1557\/revisions"}],"wp:attachment":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}