{"id":293418,"date":"2024-10-04T20:05:47","date_gmt":"2024-10-04T12:05:47","guid":{"rendered":"https:\/\/lrxjmw.cn\/ywbbuztdndsm.html"},"modified":"2024-10-04T20:05:47","modified_gmt":"2024-10-04T12:05:47","slug":"ywbbuztdndsm","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ywbbuztdndsm.html","title":{"rendered":"\u8fd0\u7ef4\u5fc5\u5907\uff1aUbuntu \u4e2d\u66ff\u4ee3 netstat \u7684 ss \u547d\u4ee4\u4ecb\u7ecd"},"content":{"rendered":"
<\/p>\n
\u5728\u8fd0\u7ef4\u548c\u7ba1\u7406Linux<\/a>\u670d\u52a1\u5668\u7684\u65f6\u4faf\uff0c\u6211\u4eec\u6700\u5e38\u7528\u7684\u4e00\u4e2a\u547d\u4ee4<\/a>\u5c31\u662fnetstat\uff0c\u6211\u5e38\u7528\u8fd9\u4e2a\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u670d\u52a1\u5668\u4e0a\u6709\u4ec0\u4e48\u8fdb\u7a0b\u6b63\u5728\u4fa6\u542c\u7aef\u53e3\uff0c\u4e3b\u8981\u62ff\u6765\u786e\u8bca\u7f51\u8def\u670d\u52a1\u7684\u5de5\u4f5c\u72b6\u6001\u3002<\/p>\n \u4e0d\u8fc7\uff0c\u8fd1\u6765\u6709\u4e00\u6b21\u5b89\u88c5\u597d\u4e00\u4e2aUbuntu\u77ed\u53d1\u7248\uff0c\u53d1\u89c9\u9ed8\u8ba4\u6ca1\u6709\u5b89\u88c5netstat\uff0c\u611f\u89c9\u5341\u5206\u5947\u602a\uff0c\u81ea\u5df1\u81ea\u52a8\u5b89\u88c5\u540e\uff0c\u53d1\u89c9manpages\u63d0\u793a\uff0cnetstat\u547d\u4ee4\u5df2\u7136\u662fdeprecated\u4e86\uff0c\u5efa\u8bae\u4f7f\u7528ss\u547d\u4ee4\u66ff\u4ee3\u3002<\/p>\n Thisprogramismostlyobsolete.Replacementfornetstatisss.Replacementfornetstat-risiproute.Replacementfornetstat-iisip-slink.Replacementfornetstat-gisipmaddr.<\/p>\n netstatmanpages<\/p>\n netstat\u7684\u7528\u6cd5<\/p>\n netstat\u6709\u8bb8\u591a\u8bb8\u591a\u53c2\u6570\uff0c\u6211\u901a\u5e38\u5c31\u7528\u4e00\u79cd\u7ec4\u5408\uff0c\u4ee5\u81f3\u4e8e\u540e\u6765\u65e9\u5df2\u60f3\u4e0d\u4e0a\u53bb\u4e3a\u4f55\u662f\u8fd9\u51e0\u4e2a\u53c2\u6570\u4e86\uff1a<\/p>\n <\/p>\n \n \u5f97\u5230\u7684\u7ed3\u679c\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n \n \u6700\u5e38\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u547d\u4ee4\u7ec4\u5408\uff0c\u5c55\u793a\u7684\u7ed3\u679c\u6709\u4e24\u4e2a\u6bb5\u843d\uff0c\u7b2c\u4e00\u4e2a\u6bb5\u843d\u5c55\u793a\u7684\u662fTCP\/UDP\u5408\u540c\u7684\u4fa6\u542c\u60c5\u51b5\uff0c\u7b2c\u4e8c\u4e2a\u6bb5\u843d\u5c55\u793a\u7684\u662fsocks\u6587\u4ef6\u7684\u4fa6\u542c\u60c5\u51b5\u3002\u53c2\u6570n\u7684\u610f\u601d\u662f\u5c55\u793a\u6570\u5b57\u683c\u5f0f\u7684IP\u5730\u5740\uff0c\u4e0d\u7136\u4f1a\u5c55\u793a\u4e3b\u673a\u540d\u79f0\u6216\u5219\u662f\u57df\u540d\uff0c\u53c2\u6570p\u7684\u610f\u601d\u663e\u793a\u8fdb\u7a0b\u7684\u540d\u5b50\uff08\u6709\u65f6\u4faf\u663e\u793a\u4e0d\u4e0b\u6765\uff09\uff0cl\u7684\u610f\u601d\uff0c\u662f\u5173\u6ce8\u5904\u4e8eLISTENING\u72b6\u6001\u7684socket\u3002<\/p>\n \u901a\u8fc7\u5982\u4e0a\u547d\u4ee4\uff0c\u6211\u4eec\u542c\u5230\u4e86\u7cfb\u7edf\u6240\u6709\u6253\u5f00\u7684socket\uff0c\u5047\u5982\u4f60\u542f\u52a8\u4e00\u79cd\u7f51\u8def\u670d\u52a1\u4e5f\u597d\uff0c\u81ea\u5df1\u5f00\u53d1\u4e00\u4e2a\u7f51\u8def\u670d\u52a1\u6253\u5f00\u7aef\u53e3\u4e5f\u597d\uff0c\u901a\u8fc7\u8fd9\u4e2a\u547d\u4ee4\u90fd\u5e94\u5f53\u80fd\u770b\u89c1\u81ea\u5df1\u6253\u5f00\u7684\u7aef\u53e3\uff0c\u5047\u5982\u770b\u4e0d\u5230\uff0c\u5e94\u5f53\u5c31\u662f\u6ca1\u6709\u624d\u80fd\u6b63\u786e\u6253\u5f00\u7aef\u53e3\uff0c\u8981\u597d\u597d\u67e5\u8be2\u662f\u54ea\u4e9b\u7f18\u7531\u3002\u6240\u4ee5\u8fd9\u662f\u4e00\u4e2a\u633a\u597d\u7528\u7684\u8c03\u8bd5\u547d\u4ee4\u3002<\/p>\n ss\u7684\u7528\u6cd5<\/p>\n \u91cc\u9762\u4ecb\u7ecd\u4e86netstat\u7684\u6700\u6700\u57fa\u672c\u7684\u4e00\u79cd\u7528\u6cd5\uff0c\u5176\u4ed6\u7528\u6cd5\u5176\u5b9e\u8fd8\u6709\u597d\u591a\uff0c\u5e76\u4e14\u5148\u7565\u8fc7\u4e0d\u8868\uff0c\u5047\u5982\u60f3\u4f7f\u7528ss\u547d\u4ee4\u6765\u53d6\u4ee3netstat\u7684\u8bdd\uff0c\u6211\u4eec\u5982\u4f55\u8fbe\u5230\u7c7b\u4f3c\u7684\u7597\u6548\u5462\uff1f<\/p>\n \n \u8fd9\u662f\u6211\u81ea\u5df1\u6478\u7d22\u7684\u4e00\u4e2a\u53c2\u6570\u7ec4\u5408\uff0c\u76ee\u524d\u6211\u80cc\u8bf5\u5f97\u8fd8\u4e0d\u662f\u5f88\u6d41\u5229\uff0c\u6bcf\u6b21\u8fd8\u987b\u8981\u770b\u4e00\u4e0b\u6587\u6863\uff1a<\/p>\n \n \u8fd9\u662fss\u547d\u4ee4\u5448\u73b0\u4e0b\u6765\u7684\u7ed3\u679c\uff0c\u53ef\u4ee5\u770b\u89c1\uff0c\u683c\u5f0f\u548cnetstat\u5f88\u4e0d\u4e00\u6837\uff0c\u4e0d\u50cfnetstat\u547d\u4ee4\u8fd9\u4e48\u7d27\u51d1\u548c\u76f4\u89c2\u3002\u8fd9\u662f\u597d\u591a\u4eba\u975e\u8bae\u8fd9\u4e2a\u547d\u4ee4\u7684\u8bf1\u56e0\u4e4b\u4e00\u3002\u5176\u5b9e\uff0c\u6279\u5224\u8fd9\u4e9b\u6279\u5224\u7684\u58f0\u97f3\u89c9\u5f97\uff0c\u4eba\u4eec\u53ea\u662f\u56fa\u5b88\u4e86\u4e00\u79cd\u4e60\u60ef\uff0c\u4e0d\u613f\u524d\u884c\u3002\u5176\u5b9e\u4e86\uff0c\u90a3\u4e48\u8bf4\u4e5f\u672a\u5c1d\u4e0d\u5bf9\uff0c\u5c31\u62ffCharles\u4e2a\u4eba\u6765\u8bf4\uff0c\u5373\u4f7f\u62112010\u5e74\u51fa\u5e2d\u5de5\u4f5c\uff0c\u624d\u5b66\u4f1anetstat\u547d\u4ee4\uff0c\u90a3\u6211\u5230\u73b0\u4eca\u4e5f\u4f7f\u7528\u4e86\u5c06\u8fd1\u516d\u5e74\uff0c\u4ece\u6765\u6ca1\u6709\u53d8\u8fc7\uff0c\u5176\u5b9e\u770b\u5f97\u65e0\u6bd4\u987a\u773c\u5566\u3002<\/p>\n \u5176\u5b9e\uff0c\u4e5f\u6709\u4e00\u79cd\u7406\u7531\u662f\u9b3c\u4f6c\u63d0\u51fa\u6765\u7684\uff0c\u8bf4ss\u8fd9\u4e2a\u547d\u4ee4\u7684\u540d\u5b50\u4e0d\u597d\uff0c\u867d\u7136ss\u53ef\u80fd\u662fsocketstatistics\u7684\u610f\u601d\uff0c\u7b80\u5199\u4e4b\u540e\uff0c\u5c45\u7136\u53ea\u6709\u4e24\u4e2a\u5b57\u6bcd\uff0c\u4e0d\u592a\u597d\u8054\u60f3\uff0c\u4e0d\u50cfnetstat\u8fd9\u4e48\u76f4\u89c2\u3002\u5176\u5b9e\u8fd9\u662f\u6211\u7684\u89e3\u91ca\uff0c\u4e0d\u662f\u9b3c\u4f6c\u57cb\u6028\u7684\u7406\u7531\uff0c\u5979\u4eec\u57cb\u6028\u7684\u662f\uff0c\u6bcf\u5f53\u63d0\u5230ss\uff0c\u5979\u4eec\u4f1a\u8054\u60f3\u8d77\u5e0c\u7279\u52d2\uff01\u662f\u4e0d\u662f\u532a\u5937\u6240\u601d\uff0c\u6211\u662f80\u540e\uff0c\u6211\u8fd9\u4e2a\u5e74\u4ee3\u7684\u4eba\uff0c\u5bf9\u8fd9\u4e2a\u90fd\u6ca1\u6709\u54ea\u4e9b\u5370\u8c61\uff0c\u5173\u952e\u6211\u4eec\u7528\u82f1\u6587\u4e3a\u4e3blinux man ls<\/strong>\uff0c\u6050\u6015\u4f60\u4eec\u770b\u89c1ss\u6700\u591a\u8054\u60f3\u5230\u68af\u5b50\uff0c\u5982\u4f55\u90fd\u4e0d\u4f1a\u60f3\u5230\u5e0c\u7279\u52d2\u3002\u8fd9\u4e2a\u5927\u7eb3\u7cb9\u6709\u4e00\u4e2a\u6b66\u88c5\u519b\u961f\uff0c\u66fe\u7ecf\u53eb\u515a\u536b\u5175\u975e\u5e38\u673a\u52a8\u519b\u961f\uff0c\u540e\u6765\u66f4\u540d\u53eb\u6b66\u88c5\u515a\u536b\u5175\u3002\u5b83\u7684\u82f1\u8bed\u7b80\u79f0\u6b63\u662fSS\u3002<\/p>\n \u4e0d\u8bf4\u95f2\u8c08\u4e86\uff0c\u8c08\u8c08\u51e0\u4e2a\u53c2\u6570\uff0ca\u53c2\u6570\u662f\u663e\u793a\u6240\u6709\u7684\u610f\u601d\uff0ct\u53c2\u6570\u610f\u601d\u662f\u663e\u793aTCP\u5408\u540c\u7684\uff0cl\u4ee3\u8868\u6b63\u5728LISTENING\u72b6\u6001\u7684\uff0cp\u4ee3\u8868\u8fdb\u7a0b\u4fe1\u606f\u3002\u4ece\u524d\u9762\u7684\u8868\u91cc\uff0c\u6211\u4eec\u770b\u89c1p\u53c2\u6570\u590d\u5370\u7684\u4fe1\u606f\uff0c\u7ec4\u7ec7\u5f97\u4e0d\u5982netstat\u7cbe\u70bc\u3002\u5e76\u4e14\u66f4\u4e3a\u5065\u5168\u4e00\u70b9\uff0c\u663e\u793a\u4e86\u8fdb\u7a0b\u540d\u5b50\u548cPID\u4ee5\u53caFD\u3002\u5e76\u4e14\u7531\u4e8e\u7528\u4e86\u4e24\u91cd\u5c0f\u62ec\u5f27\uff0ckey\/value\u7684\u683c\u5f0f\uff0c\u518d\u52a0\u7834\u6298\u53f7\uff0c\u770b\u4e0a\u53bb\u810f\u4e71\u5dee\u3002\u5176\u5b9e\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u4e00\u4e9b\u547d\u4ee4\u53bb\u4f4e\u683c\u5b83\uff0c\u4e0d\u8fc7\u8fd8\u662f\u592a\u9ebb\u70e6\u4e86\u3002<\/p>\n \u66f4\u6362\u7684\u7f18\u7531\u662f\u54ea\u4e9b\uff1f<\/p>\n \u8fd9\u53ef\u80fd\u662f\u6211\u6700\u4e3a\u597d\u5947\u7684\u4e8b\u60c5\u3002\u4e0d\u8fc7\u7f51\u4e0a\u6211\u641c\u7d22\u4e86\u4e0d\u5c11\u7684\u8d44\u6599\uff0c\u57fa\u672c\u90fd\u8bed\u7109\u4e0d\u8be6\u3002\u8fd9\u4e5f\u6709\u70b9\u8ba9\u6211\u6709\u70b9\u65e0\u5948\u3002<\/p>\n \u5927\u4f53\u4e0a\uff0c\u6211\u4eec\u80fd\u770b\u4e0b\u6765\uff0c\u4e3b\u8981\u662fnet-tools\u8fd9\u4e2a\u5305\uff0c\u5373\u5c06\u88abiproute\u8fd9\u4e2a\u5305\u7ed9\u66ff\u6362\u3002\u7406\u7531\u5927\u7ea6\u662f\uff0c1\uff0c\u8fd9\u4e2a\u5305\u592a\u8001\u4e86\uff0c2\uff0c\u8fd9\u4e2a\u5305\u4e0d\u652f\u6301\u597d\u591a\u5185\u6838\u65b0\u7684\u7279\u70b9\uff08\u5e76\u4e14\u6ca1\u6709\u8bf4\u662f\u4ec0\u4e48\u7279\u70b9\uff09\uff0c\u754c\u9762\u4e0d\u591f\u4f18\u5316\u4f7f\u7528\u56f0\u96be\uff08\u5bf9\u547d\u4ee4\u884c\u4e0d\u53cb\u597d\uff09linux man ls<\/strong>\uff0c3\uff0cnet-tools\u4e0a\u9762\u7684ifconfig\u786e\u5b9e\u7f3a\u70b9\u591a\u591alinux\u7cfb\u7edf\u4ecb\u7ecd\uff0c4\uff0c\u672a\u6765\u4e0d\u518d\u60f3\u7ef4\u62a4net-tools\u4e86\u3002<\/p>\n LukClaesandme,asthecurrentmaintainersofnet-tools,we\u2019vebeenthinkingaboutit\u2019sfuture.Net-toolshasbeenacorepartofDebianandanyotherlinuxbaseddistroformanyyears,butit\u2019sshowingitsage.<\/p>\n Itdoesntsupportmanyofthemodernfeaturesofthelinuxkernel,theinterfaceisfarfromoptimalanddifficulttouseinautomatisation,andalso,ithasn\u2019tgotmuchloveinthelastyears.<\/p>\n Ontheotherside,theiproutesuite,introducedaroundthe2.2kernelline,hasbothamuchbetterandconsistentinterface,ismorepowerful,andisalmosttenyearsold,sonobodywouldsayit\u2019suntested.<\/p>\n Hence,ourplansaretoreplacenet-toolscompletelywithiproute,maybeleadingtherouteforotherdistributionstofollow.Ofcourse,mostpeopleandtoolsuseandrememberthevenerableoldinterface,sothefirststepwouldbetowritewrappers,tryingtobecompatiblewithnet-tools.<\/p>\n Atthesametime,webelievethatmostpackagesusingnet-toolsshouldbepatchedtouseiprouteinstead,whileotherscancontinueusingthewrappersforsometime.Theifupdownpackageisobviouslythefirstcandidate,butitseemsthataversionusingiproutehasbeenavailableinexperimentalsince2007.<\/p>\n <\/p>\n \u4e5f\u6709\u4ece\u539f\u7406\u5c42\u9762\u5256\u6790\u7684\uff1a\u73b0\u4eca\u7684netstat\u548cifconfig\u547d\u4ee4\uff0c\u90fd\u662f\u901a\u8fc7\u8bfb\u5199\/proc\u76ee\u5f55\u4e0b\u7684\u865a\u62df\u6587\u4ef6\u6765\u5b8c\u6210\u4efb\u52a1\u7684\uff0c\u8fd9\u4e2a\u4e1c\u897f\u5728\u5927\u578b\u4e1a\u52a1\u7cfb\u7edf\u4e0a\uff0c\u662f\u6ca1\u95ee\u9898\u7684\uff0c\u5e76\u4e14\u5728\u5927\u89c4\u6a21\u7cfb\u7edf\u91cc\uff0c\u53ef\u80fd\u4f1a\u4f24\u5bb3\u7cfb\u7edf\u7684\u6027\u80fd\u4e4b\u7c7b\u7684\u3002\u76f8\u6bd4\u4e4b\u4e0b\uff0css\u548cip\u4e24\u4e2a\u547d\u4ee4\uff0c\u4f7f\u7528\u7684\u662fLinux\u5185\u6838\u7684netlinksockets\u7279\u70b9\u3002\u6709\u7740\u6839\u672c\u4e0a\u7684\u4e0d\u540c\u3002\u5176\u5b9e\uff0c\u8001\u547d\u4ee4\u4e5f\u53ef\u4ee5\u7528\u65b0\u539f\u7406\u91cd\u753b\uff0c\u800c\u4e14\u4f3c\u4e4e\u5e76\u6ca1\u6709\u4eba\u8fd9\u4e48\u505a\uff0c\u4e3b\u8981\u7531\u4e8e\u4e0d\u540c\u7a0b\u5e8f\u5458\u56e2\u4f53\u7684\u4e00\u4e9bpoliticalissues\uff0c\u4f60\u4eec\u610f\u89c1\u4e0d\u5408\u2026\u2026<\/p>\n \u5176\u5b9e\uff0c\u6df1\u5c42\u6b21\u7684\u8fd8\u6709\uff0c\u6211\u4eec\u4f7f\u7528\u8fd9\u6837\u7684\u8c03\u8bd5\u547d\u4ee4\uff0c\u672c\u8d28\u4e0a\u8fd8\u662f\u5e0c\u671b\u5f97\u77e5\u5185\u6838\u7684\u72b6\u6001\u7684\uff0c\u6bd5\u7adf\uff0c\u5185\u6838\u65e9\u5df2\u6539\u53d8\u4e86networking\u6a21\u5757\u7684\u6574\u4e2a\u539f\u7406\uff0c\u53e6\u4e00\u65b9\u9762\u6211\u8fd8\u8981\u6c42\u547d\u4ee4\u50cf\u4ece\u524d\u90a3\u6837\u53bb\u5c55\u793a\u4fe1\u606f\uff0c\u5c55\u793a\u5c42\u9762\u7684\u683c\u5f0f\u548c\u771f\u5b9e\u539f\u7406\u65e9\u5df2\u80cc\u79bb\uff0c\u6240\u4ee5\uff0c\u4ece\u957f\u8fdc\u770b\uff0c\u53d6\u4ee3\u8fd9\u4e24\u4e2a\u547d\u4ee4\u624d\u662f\u5fc5\u7136\u3002<\/p>\n \u63a8\u8bba<\/p>\n \u4ffa\u4eec\u90a3\u4e9b\u505a\u6280\u672f\u7684\uff0c\u4e5f\u8fd8\u662f\u8981\u4e0e\u65f6\u4ff1\u8fdb\u6bd4\u8f83\u597d\uff0c\u5c3d\u7ba1\uff0c\u539f\u5148\u7684\u8fd9\u4e9b\u547d\u4ee4\u719f\u6089\uff0c\u597d\u7528LINUX\u793e\u533a\uff0c\u624b\u5230\u64d2\u6765\uff0c\u751a\u81f3\u96be\u4ee5\u5fd8\u6389\uff0c\u7136\u800c\u65b0\u7684\u8fd8\u662f\u8981\u4fdd\u6301\u5b66\u4e60\u3002\u5f88\u591a\u53d1\u578b\u7248\u65e9\u5df2\u9ed8\u8ba4\u4e0d\u5e26\u6709net-tools\u5305\u4e86\uff0c\u5c3d\u7ba1\u4f9d\u7136\u53ef\u4ee5\u81ea\u52a8\u5b89\u88c5\u56de\u53bb\uff0c\u800c\u4e14\uff0c\u8fd9\u80cc\u540e\u7684\u5fc3\u6001\u5df2\u7136\u5f88\u660e\u6670\u4e86\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u6211\u4eec\u505a\u6280\u672f\uff0c\u4e5f\u8981\u907f\u514d\u81ea\u5df1\u7684\u8111\u90e8\u6b7b\u677f\uff0c\u8fd8\u662f\u8981\u4fdd\u6301\u5bf9\u65b0\u4e8b\u7269\u7684\u597d\u5947\u5fc3\u548c\u70ed\u60c5\u3002<\/p>\n \u5929\u4e0b\u6570\u636e\u662f\u56fd\u5916\u5c48\u6307\u53ef\u6570\u7684\u62e5\u6709\u591a\u5904\u6d77\u5916\u81ea\u5efa\u673a\u623f\u7684\u65b0\u578bIDC\u670d\u52a1\u5546\uff0c\u88ab\u4e1a\u754c\u516c\u89c9\u5f97\u201c\u4e2d\u56fdIDC\u884c\u4e1a\u9996\u9009\u54c1\u724c\u201d\u3002<\/p>\n \u5929\u4e0b\u6570\u636e\u4e0e\u5168\u7403\u8fd1120\u591a\u4e2a\u56fd\u5bb6\u9876\u5c16\u673a\u623f\u76f4\u63a5\u5408\u4f5c\uff0c\u63d0\u4f9b\u5305\u62ec\u53f0\u6e7e\u3001\u7f8e\u56fd\u3001\u97e9\u56fd\u3001\u65e5\u672c\u3001\u53f0\u6e7e\u3001\u65b0\u52a0\u5761\u3001\u8377\u5170\u3001\u6cd5\u56fd\u3001\u82f1\u56fd\u3001\u5fb7\u56fd\u3001\u57c3\u53ca\u3001\u5357\u975e\u3001\u5df4\u897f\u3001\u5370\u5ea6\u3001\u8d8a\u5357\u7b49\u56fd\u5bb6\u548c\u5730\u533a\u7684\u670d\u52a1\u5668\u3001\u4e91\u670d\u52a1\u5668\u7684\u79df\u7528\u670d\u52a1\uff0c\u987b\u8981\u7684\u8bf7\u8054\u7cfb\u5929\u4e0b\u6570\u636e\u5ba2\u670d\uff01<\/p>\n \u9664\u63d0\u4f9b\u4f20\u7edf\u7684IDC\u4ea7\u54c1\u5916\uff0c\u5929\u4e0b\u6570\u636e\u7684\u4e3b\u8981\u804c\u8d23\u662f\u4e3a\u5927\u5c0f\u578b\u4f01\u4e1a\u63d0\u4f9b\u66f4\u7cbe\u7ec6\u3001\u5b89\u5168\u3001\u6ee1\u8db3\u4e2a\u6027\u9700\u6c42\u7684\u591a\u6837\u5316\u670d\u52a1\u5668\u89e3\u51b3\u65b9\u6848\uff0c\u975e\u5e38\u662f\u5728\u76f4\u9500\u3001\u91d1\u878d\u3001\u89c6\u9891\u3001\u6d41\u5a92\u4f53\u3001\u6e38\u620f\u3001\u7535\u5b50\u5546\u52a1\u3001\u533a\u5757\u94fe\u3001\u5feb\u6d88\u3001\u7269\u8054\u7f51\u3001\u5927\u6570\u636e\u7b49\u4f17\u591a\u884c\u4e1a\uff0c\u4e3a\u5e7f\u5927\u987e\u5ba2\u89e3\u51b3\u670d\u52a1\u5668\u79df\u7528\u4e2d\u9047\u89c1\u7684\u5404\u7c7b\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" linux man lsnetstat\uff0c\u6211\u5e38\u7528\u8fd9\u4e2a\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u670d\u52a1\u5668\u4e0a\u6709\u54ea\u4e9b\u8fdb\u7a0b\u6b63\u5728\u4fa6\u542c\u7aef\u53e3\uff0c\u4e3b\u8981\u7528\u6765\u8bca\u65ad\u7f51\u7edc\u670d\u52a1\u7684\u5de5\u4f5c\u72b6\u6001\u3002socket\uff0c\u5982\u679c\u4f60\u542f\u52a8\u4e00\u79cd\u7f51\u7edc\u670d\u52a1\u4e5f\u597d\uff0c\u81ea\u5df1\u5f00\u53d1\u4e00\u4e2a\u7f51\u7edc\u670d\u52a1\u6253\u5f00\u7aef\u53e3\u4e5f\u597d\uff0c\u901a\u8fc7\u8fd9\u4e2a\u547d\u4ee4\u90fd\u5e94\u8be5\u80fd\u770b\u5230\u81ea\u5df1\u6253\u5f00\u7684\u7aef\u53e3\uff0c\u5982\u679c\u770b\u4e0d\u5230\uff0c\u5e94\u8be5\u5c31\u662f\u6ca1\u6709\u80fd\u591f\u6b63\u786e\u6253\u5f00\u7aef\u53e3\uff0c\u8981\u597d\u597d\u67e5\u8be2\u662f\u4ec0\u4e48\u539f\u56e0\u3002<\/p>\n","protected":false},"author":1,"featured_media":293419,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[3408,3411,3410,1745,3409],"class_list":["post-293418","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-netstat","tag-cszh","tag-gzzt","tag-dk","tag-wlfw"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=293418"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293418\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/293419"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=293418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=293418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=293418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}netstat -npl \n<\/pre>\n<\/p>\n
Active Internet connections (only servers) \nProto Recv-Q Send-Q Local Address Foreign Address State PID\/Program name \ntcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 655\/systemd-resolve \ntcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 890\/sshd \ntcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 30790\/cupsd \ntcp 0 0 0.0.0.0:18025 0.0.0.0:* LISTEN 890\/sshd \ntcp6 0 0 :::22 :::* LISTEN 890\/sshd \ntcp6 0 0 ::1:631 :::* LISTEN 30790\/cupsd \ntcp6 0 0 :::9090 :::* LISTEN 15415\/.\/prometheus \ntcp6 0 0 :::18025 :::* LISTEN 890\/sshd \nudp 0 0 127.0.0.53:53 0.0.0.0:* 655\/systemd-resolve \nudp 0 0 0.0.0.0:631 0.0.0.0:* 30792\/cups-browsed \nudp 0 0 0.0.0.0:5353 0.0.0.0:* 757\/avahi-daemon: r \nudp 0 0 0.0.0.0:42360 0.0.0.0:* 757\/avahi-daemon: r \nudp6 0 0 :::58232 :::* 757\/avahi-daemon: r \nudp6 0 0 :::5353 :::* 757\/avahi-daemon: r \nActive UNIX domain sockets (only servers) \nProto RefCnt Flags Type State I-Node PID\/Program name Path \nunix 2 [ ACC ] STREAM LISTENING 35116 1304\/gnome-session- @\/tmp\/.ICE-unix\/1304 \nunix 2 [ ACC ] SEQPACKET LISTENING 1448 1\/init \/run\/udev\/control \nunix 2 [ ACC ] STREAM LISTENING 34277 1270\/systemd \/run\/user\/1000\/systemd\/private \nunix 2 [ ACC ] STREAM LISTENING 34282 1270\/systemd \/run\/user\/1000\/gnupg\/S.gpg-agent.ssh \nunix 2 [ ACC ] STREAM LISTENING 33510 1270\/systemd \/run\/user\/1000\/gnupg\/S.gpg-agent \nunix 2 [ ACC ] STREAM LISTENING 33511 1270\/systemd \/run\/user\/1000\/pulse\/native \nunix 2 [ ACC ] STREAM LISTENING 33512 1270\/systemd \/run\/user\/1000\/gnupg\/S.gpg-agent.extra \n<\/pre>\n<\/p>\n
ss -atlp \n<\/pre>\n<\/p>\n
State Recv-Q Send-Q Local Address:Port Peer Address:Port \nLISTEN 0 128 127.0.0.53%lo:domain 0.0.0.0:* users:((\"systemd-resolve\",pid=655,fd=13)) \nLISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* users:((\"sshd\",pid=890,fd=5)) \nLISTEN 0 5 127.0.0.1:ipp 0.0.0.0:* users:((\"cupsd\",pid=30790,fd=7)) \nLISTEN 0 128 0.0.0.0:18025 0.0.0.0:* users:((\"sshd\",pid=890,fd=3)) \nLISTEN 0 128 [::]:ssh [::]:* users:((\"sshd\",pid=890,fd=6)) \nLISTEN 0 5 [::1]:ipp [::]:* users:((\"cupsd\",pid=30790,fd=6)) \nLISTEN 0 128 *:9090 *:* users:((\"prometheus\",pid=15415,fd=3)) \nLISTEN 0 128 [::]:18025 [::]:* users:((\"sshd\",pid=890,fd=4)) \n<\/pre>\n<\/p>\n