{"id":39124,"date":"2025-05-22T07:36:13","date_gmt":"2025-05-21T23:36:13","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/39124.html"},"modified":"2025-05-22T07:36:13","modified_gmt":"2025-05-21T23:36:13","slug":"linux%e9%97%ae%e9%a2%98%e6%8e%92%e6%9f%a5-%e5%bc%95%e8%b5%b7%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%b8%a6%e5%ae%bd%e4%bd%bf%e7%94%a8%e7%8e%87%e9%ab%98%e7%9a%84%e5%86%85%e9%ac%bc","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/39124.html","title":{"rendered":"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c"},"content":{"rendered":"<h2>Linux\u7f51\u7edc\u6d41\u91cf\u76d1\u63a7\u4e0e\u74f6\u9888\u5206\u6790\u5168\u653b\u7565&#xff1a;\u4ece\u57fa\u7840\u547d\u4ee4\u5230\u8fdb\u7a0b\u7ea7\u65b9\u6848<\/h2>\n<h3>\u4e00\u3001\u7f51\u7edc\u5e26\u5bbd\u67e5\u8be2\u4e0e\u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7<\/h3>\n<h4>1. \u67e5\u8be2\u4e3b\u673a\u7f51\u7edc\u5e26\u5bbd<\/h4>\n<ul>\n<li>\n<p>\u7f51\u5361\u7406\u8bba\u5e26\u5bbd \u901a\u8fc7ethtool\u547d\u4ee4\u67e5\u770b\u7f51\u5361\u6700\u5927\u652f\u6301\u901f\u7387&#xff0c;\u4f8b\u5982&#xff1a;<\/p>\n<p> <span class=\"token function\">ethtool<\/span> eth0  <span class=\"token comment\"># \u66ff\u6362\u4e3a\u5b9e\u9645\u7f51\u5361\u540d&#xff08;\u5982ens33&#xff09;<\/span><\/p>\n<p>\u8f93\u51fa\u4e2d\u7684Speed\u5b57\u6bb5\u663e\u793a\u7f51\u5361\u901f\u7387&#xff08;\u59821000Mb\/s&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u9645\u53ef\u7528\u5e26\u5bbd\u6d4b\u8bd5 \u4f7f\u7528iperf3\u5de5\u5177\u4e0e\u8fdc\u7a0b\u670d\u52a1\u5668\u6d4b\u8bd5\u5b9e\u9645\u4f20\u8f93\u901f\u7387&#xff1a;<\/p>\n<p> iperf3 <span class=\"token parameter variable\">-c<\/span> server_ip  <span class=\"token comment\"># \u9700\u63d0\u524d\u5b89\u88c5iperf3\u670d\u52a1\u7aef<\/span>\n <\/li>\n<\/ul>\n<h4>2. \u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7\u5de5\u5177&#xff1a;iftop\u6df1\u5ea6\u7528\u6cd5<\/h4>\n<h5>&#xff08;1&#xff09;\u57fa\u7840\u547d\u4ee4\u4e0e\u53c2\u6570<\/h5>\n<p>iftop <span class=\"token parameter variable\">-i<\/span> eth0 <span class=\"token parameter variable\">-BnP<\/span>  <span class=\"token comment\"># \u76d1\u63a7eth0\u7f51\u5361&#xff0c;\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d&#xff0c;\u4e0d\u89e3\u6790\u57df\u540d&#xff0c;\u663e\u793a\u7aef\u53e3\u53f7<\/span><br \/>\niftop <span class=\"token parameter variable\">-f<\/span> <span class=\"token string\">&#034;port not 22&#034;<\/span>  <span class=\"token comment\"># \u8fc7\u6ee4\u89c4\u5219&#xff1a;\u6392\u9664SSH\u7aef\u53e3&#xff08;22&#xff09;\u7684\u6d41\u91cf<\/span><\/p>\n<h5>&#xff08;2&#xff09;\u754c\u9762\u64cd\u4f5c\u4e0e\u5feb\u6377\u952e<\/h5>\n<ul>\n<li>\u65b9\u5411\u952e&#xff1a;\u2190\/\u2192\u5207\u6362\u53d1\u9001\/\u63a5\u6536\u6d41\u91cf\u6bd4\u4f8b\u6761&#xff0c;\u2191\/\u2193\u6eda\u52a8\u8fde\u63a5\u5217\u8868\u3002<\/li>\n<li>\u529f\u80fd\u952e&#xff1a;\n<ul>\n<li>P&#xff1a;\u6682\u505c\/\u6062\u590d\u6d41\u91cf\u66f4\u65b0&#xff0c;\u7528\u4e8e\u5b9a\u4f4d\u7279\u5b9a\u8fde\u63a5\u3002<\/li>\n<li>s&#xff1a;\u5207\u6362\u663e\u793a\u5355\u4f4d&#xff08;\u5b57\u8282\/\u6bd4\u7279\u3001\u901f\u7387\/\u603b\u91cf&#xff09;\u3002<\/li>\n<li>l&#xff1a;\u8bbe\u7f6e\u8fc7\u6ee4\u89c4\u5219&#xff08;\u5982port 80\u4ec5\u663e\u793aHTTP\u6d41\u91cf&#xff09;\u3002<\/li>\n<li>t&#xff1a;\u5207\u6362\u754c\u9762\u5e03\u5c40&#xff08;\u5355\u884c\/\u53cc\u884c\/\u4e09\u884c\u6a21\u5f0f&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>&#xff08;3&#xff09;\u8f93\u51fa\u5b57\u6bb5\u89e3\u6790<\/h5>\n<p>Interface: eth0            # \u5f53\u524d\u76d1\u63a7\u7f51\u5361<br \/>\nIP address: 192.168.1.100  # \u672c\u5730IP<br \/>\n&#061;&gt; \u53d1\u9001\u6d41\u91cf      &lt;&#061; \u63a5\u6536\u6d41\u91cf<br \/>\n\u5cf0\u503c\u901f\u7387&#xff1a;       TX: 50Mb\/s  RX: 100Mb\/s  # \u5b9e\u65f6\u5cf0\u503c<br \/>\n\u8fde\u63a5\u5217\u8868&#xff1a;<br \/>\n192.168.1.2:80        &lt;&#061;&#061;&gt;       192.168.1.100:58923  # \u8fde\u63a5\u4e24\u7aefIP:\u7aef\u53e3<br \/>\n                        2.3Mb\/s               1.8Mb\/s               # \u5b9e\u65f6\u901f\u7387<br \/>\n                        10MB                   8MB                   # \u7d2f\u79ef\u6d41\u91cf<\/p>\n<h3>\u4e8c\u3001\u5224\u65ad\u5e26\u5bbd\u662f\u5426\u4e3a\u74f6\u9888&#xff1a;\u591a\u7ef4\u6307\u6807\u5206\u6790<\/h3>\n<h4>1. \u7f51\u5361\u5229\u7528\u7387\u4e0e\u6d41\u91cf\u9608\u503c<\/h4>\n<p>\u4f7f\u7528dstat\u6216sar\u76d1\u63a7\u7f51\u5361\u5b9e\u9645\u6d41\u91cf&#xff0c;\u82e5\u6301\u7eed\u8d85\u8fc7\u7406\u8bba\u5e26\u5bbd\u768470%&#xff08;\u5982\u5343\u5146\u7f51\u5361\u957f\u671f\u9ad8\u4e8e700Mb\/s&#xff09;&#xff0c;\u53ef\u80fd\u5b58\u5728\u74f6\u9888&#xff1a;<\/p>\n<p>dstat <span class=\"token parameter variable\">-nt<\/span> <span class=\"token number\">5<\/span>  <span class=\"token comment\"># \u6bcf5\u79d2\u5237\u65b0&#xff0c;\u89c2\u5bdfrecv\/s\u548csend\/s\u662f\u5426\u63a5\u8fd1\u7f51\u5361\u4e0a\u9650<\/span><br \/>\nsar <span class=\"token parameter variable\">-n<\/span> DEV <span class=\"token number\">1<\/span> <span class=\"token number\">5<\/span>  <span class=\"token comment\"># \u5386\u53f2\u6d41\u91cf\u7edf\u8ba1&#xff0c;\u5206\u6790\u8d8b\u52bf<\/span><\/p>\n<h4>2. \u5e94\u7528\u5c42\u4e0e\u7f51\u7edc\u5c42\u6307\u6807<\/h4>\n<ul>\n<li>\u5ef6\u8fdf\u4e0e\u5361\u987f&#xff1a;\u4e1a\u52a1\u54cd\u5e94\u53d8\u6162\u3001API\u8d85\u65f6\u589e\u52a0&#xff0c;\u4e14CPU\/\u5185\u5b58\u6b63\u5e38\u65f6&#xff0c;\u53ef\u80fd\u662f\u5e26\u5bbd\u4e0d\u8db3\u3002<\/li>\n<li>TCP\u91cd\u4f20\u7387&#xff1a;\u901a\u8fc7netstat -s\u67e5\u770b\u91cd\u4f20\u6b21\u6570&#xff0c;\u82e5\u91cd\u4f20\u7387&gt;1%&#xff0c;\u53ef\u80fd\u56e0\u5e26\u5bbd\u62e5\u585e\u5bfc\u81f4\u4e22\u5305&#xff1a;<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-s<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">egrep<\/span> <span class=\"token string\">&#039;lost|retran&#039;<\/span>\n <\/li>\n<\/ul>\n<h3>\u4e09\u3001\u5b9a\u4f4d\u9ad8\u5e26\u5bbd\u8fdb\u7a0b&#xff1a;\u4eceIP\u5230PID\u7684\u5168\u94fe\u8def\u8ffd\u8e2a<\/h3>\n<h4>1. \u4f20\u7edf\u5de5\u5177&#xff1a;iftop &#043; nethogs\u7ec4\u5408<\/h4>\n<ul>\n<li>\u901a\u8fc7iftop\u5b9a\u4f4d\u5f02\u5e38IP\/\u7aef\u53e3&#xff1a;\u6309P\u6682\u505c\u66f4\u65b0&#xff0c;\u8bb0\u5f55\u53ef\u7591\u8fde\u63a5\u7684\u7aef\u53e3\u53f7&#xff08;\u5982\u8fdc\u7a0bIP:8080&#xff09;\u3002<\/li>\n<li>\u7528nethogs\u6309\u8fdb\u7a0b\u663e\u793a\u6d41\u91cf&#xff1a;nethogs eth0  <span class=\"token comment\"># \u76f4\u63a5\u5217\u51fa\u5404\u8fdb\u7a0b\u5e26\u5bbd\u5360\u7528&#xff0c;\u652f\u6301\u6392\u5e8f<\/span>\n <\/li>\n<\/ul>\n<h4>2. \u53ef\u7f16\u7a0b\u65b9\u6848&#xff1a;\u57fa\u4e8eGo\u7684\u8fdb\u7a0b\u7ea7\u6d41\u91cf\u76d1\u63a7&#xff08;go-netflow&#xff09;<\/h4>\n<h5>&#xff08;1&#xff09;\u6838\u5fc3\u539f\u7406\u4e0e\u67b6\u6784<\/h5>\n<ul>\n<li>\u6570\u636e\u6620\u5c04&#xff1a;\n<ul>\n<li>\u901a\u8fc7\/proc\/net\/tcp\u3001\/proc\/net\/udp\u83b7\u53d6TCP\/UDP\u8fde\u63a5\u7684\u56db\u5143\u7ec4\u548cinode\u3002<\/li>\n<li>\u901a\u8fc7\/proc\/{pid}\/fd\u5efa\u7acbinode\u4e0e\u8fdb\u7a0bPID\u7684\u6620\u5c04\u5173\u7cfb\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u6293\u5305\u5206\u6790&#xff1a;\u4f7f\u7528gopacket\u5e93\u6355\u83b7\u6d41\u91cf&#xff0c;\u89e3\u6790IP\/\u7aef\u53e3\u540e&#xff0c;\u901a\u8fc7\u5730\u5740:\u7aef\u53e3\u2192inode\u2192PID\u94fe\u8def\u5173\u8054\u5230\u8fdb\u7a0b&#xff0c;\u5b9e\u73b0\u6d41\u91cf\u6309PID\u7edf\u8ba1\u3002<\/li>\n<li>\u7f13\u5b58\u4e0e\u6027\u80fd\u4f18\u5316&#xff1a;\n<ul>\n<li>\u4e09\u5c42\u7f13\u5b58&#xff08;connInodesMap\u3001inodePidMap\u3001processMap&#xff09;\u52a8\u6001\u66f4\u65b0\u3002<\/li>\n<li>\u5f02\u6b65\u5904\u7406\u6d41\u91cf\u6570\u636e&#xff0c;\u961f\u5217\u6ee1\u65f6\u4e22\u5f03&#xff08;\u91c7\u6837\u6a21\u5f0f&#xff09;&#xff0c;\u5e76\u901a\u8fc7Linux cgroups\u9650\u5236CPU\/\u5185\u5b58\u5360\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>&#xff08;2&#xff09;\u529f\u80fd\u7279\u6027<\/h5>\n<ul>\n<li>\u8fdb\u7a0b\u7ea7\u76d1\u63a7&#xff1a;\u663e\u793aPID\u3001\u8fdb\u7a0b\u540d\u3001\u8def\u5f84\u3001\u5b9e\u65f6\u6536\u53d1\u901f\u7387&#xff08;\u5982java\u8fdb\u7a0b\u4e0a\u4f20\u901f\u73871.2MB\/s&#xff09;\u3002<\/li>\n<li>PCAP\u6587\u4ef6\u8f93\u51fa&#xff1a;\u652f\u6301\u5c06\u6d41\u91cf\u6570\u636e\u5199\u5165\u6587\u4ef6&#xff0c;\u4f9bWireshark\u5206\u6790\u3002<\/li>\n<li>\u53ef\u7f16\u7a0b\u63a5\u53e3&#xff1a;\u53ef\u96c6\u6210\u5230Prometheus\u7b49\u76d1\u63a7\u7cfb\u7edf&#xff0c;\u5b9e\u73b0\u81ea\u52a8\u5316\u544a\u8b66\u3002<\/li>\n<\/ul>\n<h5>&#xff08;3&#xff09;\u4f7f\u7528\u793a\u4f8b<\/h5>\n<li>\u542f\u52a8\u76d1\u63a7&#xff1a;go run main.go <span class=\"token parameter variable\">-i<\/span> eth0 <span class=\"token parameter variable\">-c<\/span> <span class=\"token number\">0.5<\/span> <span class=\"token parameter variable\">-m<\/span> <span class=\"token number\">1024<\/span>  <span class=\"token comment\"># \u76d1\u63a7eth0&#xff0c;\u9650\u52360.5\u6838CPU\u30011GB\u5185\u5b58<\/span>\n <\/li>\n<li>\u67e5\u8be2\u8fdb\u7a0b\u6d41\u91cf&#xff08;\u5047\u8bbeHTTP\u63a5\u53e3&#xff09;&#xff1a;<span class=\"token function\">curl<\/span> http:\/\/localhost:8080\/process?pid<span class=\"token operator\">&#061;<\/span><span class=\"token number\">12345<\/span><br \/>\n \u8fd4\u56de\u7ed3\u679c&#xff1a;<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;pid&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">12345<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;data-uploader&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;tx_rate&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;48Mb\/s&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;rx_rate&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;2Mb\/s&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span>\n <\/li>\n<h3>\u56db\u3001\u5de5\u5177\u5bf9\u6bd4\u4e0e\u7ec4\u5408\u5b9e\u8df5<\/h3>\n<table>\n<tr>\u5de5\u5177\u4f18\u52bf\u573a\u666f\u6570\u636e\u7c92\u5ea6\u6269\u5c55\u6027<\/tr>\n<tbody>\n<tr>\n<td>iftop<\/td>\n<td>\u5b9e\u65f6\u7f51\u5361\u6d41\u91cf\u76d1\u63a7\u3001IP\/\u7aef\u53e3\u7ea7\u5206\u6790<\/td>\n<td>\u7f51\u5361\/IP\/\u7aef\u53e3<\/td>\n<td>\u9002\u5408\u4eba\u5de5\u6392\u67e5<\/td>\n<\/tr>\n<tr>\n<td>nethogs<\/td>\n<td>\u5feb\u901f\u5b9a\u4f4d\u9ad8\u6d41\u91cf\u8fdb\u7a0b&#xff08;\u547d\u4ee4\u884c\u5de5\u5177&#xff09;<\/td>\n<td>\u8fdb\u7a0b&#xff08;PID&#xff09;<\/td>\n<td>\u8f7b\u91cf\u7ea7\u5373\u7528<\/td>\n<\/tr>\n<tr>\n<td>go-netflow<\/td>\n<td>\u53ef\u7f16\u7a0b\u63a5\u53e3\u3001\u81ea\u52a8\u5316\u96c6\u6210<\/td>\n<td>\u8fdb\u7a0b&#xff08;PID&#xff09;<\/td>\n<td>\u9002\u5408DevOps<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u5178\u578b\u6392\u67e5\u6d41\u7a0b<\/h4>\n<li>\u521d\u6b65\u8bca\u65ad&#xff1a;\u7528iftop\u53d1\u73b0\u7f51\u5361\u6d41\u91cf\u5f02\u5e38&#xff08;\u5982eth0\u5229\u7528\u7387\u8fbe90%&#xff09;&#xff0c;\u5b9a\u4f4d\u5f02\u5e38IP\/\u7aef\u53e3&#xff08;\u5982192.168.1.200:443&#xff09;\u3002<\/li>\n<li>\u8fdb\u7a0b\u7ea7\u5b9a\u4f4d&#xff1a;\n<ul>\n<li>\u82e5\u9700\u5feb\u901f\u67e5\u770b&#xff0c;\u7528nethogs eth0\u76f4\u63a5\u83b7\u53d6\u8fdb\u7a0b\u5217\u8868\u3002<\/li>\n<li>\u82e5\u9700\u96c6\u6210\u5230\u7cfb\u7edf&#xff0c;\u8c03\u7528go-netflow\u63a5\u53e3\u67e5\u8be2\u5bf9\u5e94\u7aef\u53e3\u7684PID\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u4f18\u5316\u4e0e\u9a8c\u8bc1&#xff1a;\n<ul>\n<li>\u901a\u8fc7tc\u6d41\u91cf\u63a7\u5236\u9650\u5236\u8fdb\u7a0b\u5e26\u5bbd&#xff08;\u5982tc qdisc add dev eth0 root handle 1: htb default 10&#xff09;\u3002<\/li>\n<li>\u518d\u6b21\u7528iftop\u786e\u8ba4\u7f51\u5361\u5229\u7528\u7387\u4e0b\u964d\u81f3\u5b89\u5168\u8303\u56f4\u3002<\/li>\n<\/ul>\n<\/li>\n<h3>\u4e94\u3001\u5de5\u5177\u5b89\u88c5\u4e0e\u6269\u5c55<\/h3>\n<h4>1. \u57fa\u7840\u5de5\u5177\u5b89\u88c5<\/h4>\n<p><span class=\"token comment\"># Ubuntu\/Debian<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt-get<\/span> <span class=\"token function\">install<\/span> iftop nethogs dstat sysstat<\/p>\n<p><span class=\"token comment\"># CentOS\/RHEL<\/span><br \/>\n<span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> iftop nethogs dstat sysstat<\/p>\n<h4>2. go-netflow\u90e8\u7f72<\/h4>\n<p><span class=\"token function\">git<\/span> clone https:\/\/github.com\/rfyiamcool\/go-netflow<br \/>\n<span class=\"token builtin class-name\">cd<\/span> go-netflow<br \/>\ngo build <span class=\"token parameter variable\">-o<\/span> netflow<br \/>\n.\/netflow <span class=\"token parameter variable\">-h<\/span>  <span class=\"token comment\"># \u67e5\u770b\u5e2e\u52a9\u6587\u6863<\/span><\/p>\n<p>\u901a\u8fc7\u7ec4\u5408\u4f7f\u7528\u5b9e\u65f6\u76d1\u63a7\u5de5\u5177\u4e0e\u53ef\u7f16\u7a0b\u65b9\u6848&#xff0c;\u53ef\u6784\u5efa\u4ece\u201c\u6d41\u91cf\u5f02\u5e38\u53d1\u73b0\u201d\u5230\u201c\u8fdb\u7a0b\u7ea7\u5b9a\u4f4d\u201d\u518d\u5230\u201c\u81ea\u52a8\u5316\u4f18\u5316\u201d\u7684\u5b8c\u6574\u94fe\u8def&#xff0c;\u6709\u6548\u89e3\u51b3Linux\u7cfb\u7edf\u7684\u7f51\u7edc\u5e26\u5bbd\u74f6\u9888\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb910\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u672c\u6587\u5168\u9762\u4ecb\u7ecd\u4e86Linux\u7f51\u7edc\u6d41\u91cf\u76d1\u63a7\u4e0e\u74f6\u9888\u5206\u6790\u7684\u591a\u79cd\u5de5\u5177\u548c\u65b9\u6cd5\u3002\u9996\u5148\uff0c\u901a\u8fc7ethtool\u548ciperf3\u67e5\u8be2\u548c\u6d4b\u8bd5\u7f51\u7edc\u5e26\u5bbd\uff0c\u4f7f\u7528iftop\u8fdb\u884c\u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7\uff0c\u5e76\u8be6\u7ec6\u89e3\u6790\u4e86\u5176\u754c\u9762\u64cd\u4f5c\u548c\u8f93\u51fa\u5b57\u6bb5\u3002\u63a5\u7740\uff0c\u901a\u8fc7dstat\u548csar\u7b49\u5de5\u5177\u5206\u6790\u7f51\u5361\u5229\u7528\u7387\uff0c\u7ed3\u5408\u5e94\u7528\u5c42\u548c\u7f51\u7edc\u5c42\u6307\u6807\u5224\u65ad\u5e26\u5bbd\u74f6\u9888\u3002\u8fdb\u4e00\u6b65\uff0c\u4f7f\u7528iftop\u548cnethogs\u7ec4\u5408\u5b9a\u4f4d\u9ad8\u5e26\u5bbd\u8fdb\u7a0b\uff0c\u5e76\u4ecb\u7ecd\u4e86\u57fa\u4e8eGo\u7684\u8fdb\u7a0b\u7ea7\u6d41\u91cf\u76d1\u63a7\u5de5\u5177go-netflow\uff0c\u5176\u6838\u5fc3\u539f\u7406\u662f\u901a\u8fc7\/proc\u76ee\u5f55\u548cgopacket\u5e93\u5b9e\u73b0\u6d41\u91cf\u4e0e\u8fdb\u7a0b\u7684\u5173\u8054\u3002\u6700\u540e\uff0c\u5bf9\u6bd4\u4e86\u4e0d\u540c\u5de5\u5177\u7684\u4f18\u52bf\u573a\u666f\uff0c<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,3493,56,43,3494,44,2550,176],"topic":[],"class_list":{"0":"post-39124","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-linux","9":"tag-56","10":"tag-43","11":"tag-3494","12":"tag-44","13":"tag-2550","14":"tag-176"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/39124.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb910\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u672c\u6587\u5168\u9762\u4ecb\u7ecd\u4e86Linux\u7f51\u7edc\u6d41\u91cf\u76d1\u63a7\u4e0e\u74f6\u9888\u5206\u6790\u7684\u591a\u79cd\u5de5\u5177\u548c\u65b9\u6cd5\u3002\u9996\u5148\uff0c\u901a\u8fc7ethtool\u548ciperf3\u67e5\u8be2\u548c\u6d4b\u8bd5\u7f51\u7edc\u5e26\u5bbd\uff0c\u4f7f\u7528iftop\u8fdb\u884c\u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7\uff0c\u5e76\u8be6\u7ec6\u89e3\u6790\u4e86\u5176\u754c\u9762\u64cd\u4f5c\u548c\u8f93\u51fa\u5b57\u6bb5\u3002\u63a5\u7740\uff0c\u901a\u8fc7dstat\u548csar\u7b49\u5de5\u5177\u5206\u6790\u7f51\u5361\u5229\u7528\u7387\uff0c\u7ed3\u5408\u5e94\u7528\u5c42\u548c\u7f51\u7edc\u5c42\u6307\u6807\u5224\u65ad\u5e26\u5bbd\u74f6\u9888\u3002\u8fdb\u4e00\u6b65\uff0c\u4f7f\u7528iftop\u548cnethogs\u7ec4\u5408\u5b9a\u4f4d\u9ad8\u5e26\u5bbd\u8fdb\u7a0b\uff0c\u5e76\u4ecb\u7ecd\u4e86\u57fa\u4e8eGo\u7684\u8fdb\u7a0b\u7ea7\u6d41\u91cf\u76d1\u63a7\u5de5\u5177go-netflow\uff0c\u5176\u6838\u5fc3\u539f\u7406\u662f\u901a\u8fc7\/proc\u76ee\u5f55\u548cgopacket\u5e93\u5b9e\u73b0\u6d41\u91cf\u4e0e\u8fdb\u7a0b\u7684\u5173\u8054\u3002\u6700\u540e\uff0c\u5bf9\u6bd4\u4e86\u4e0d\u540c\u5de5\u5177\u7684\u4f18\u52bf\u573a\u666f\uff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/39124.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-21T23:36:13+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39124.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/39124.html\",\"name\":\"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-21T23:36:13+00:00\",\"dateModified\":\"2025-05-21T23:36:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/39124.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/39124.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/39124.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/39124.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb910\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf12\u6b21\u3002\u672c\u6587\u5168\u9762\u4ecb\u7ecd\u4e86Linux\u7f51\u7edc\u6d41\u91cf\u76d1\u63a7\u4e0e\u74f6\u9888\u5206\u6790\u7684\u591a\u79cd\u5de5\u5177\u548c\u65b9\u6cd5\u3002\u9996\u5148\uff0c\u901a\u8fc7ethtool\u548ciperf3\u67e5\u8be2\u548c\u6d4b\u8bd5\u7f51\u7edc\u5e26\u5bbd\uff0c\u4f7f\u7528iftop\u8fdb\u884c\u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7\uff0c\u5e76\u8be6\u7ec6\u89e3\u6790\u4e86\u5176\u754c\u9762\u64cd\u4f5c\u548c\u8f93\u51fa\u5b57\u6bb5\u3002\u63a5\u7740\uff0c\u901a\u8fc7dstat\u548csar\u7b49\u5de5\u5177\u5206\u6790\u7f51\u5361\u5229\u7528\u7387\uff0c\u7ed3\u5408\u5e94\u7528\u5c42\u548c\u7f51\u7edc\u5c42\u6307\u6807\u5224\u65ad\u5e26\u5bbd\u74f6\u9888\u3002\u8fdb\u4e00\u6b65\uff0c\u4f7f\u7528iftop\u548cnethogs\u7ec4\u5408\u5b9a\u4f4d\u9ad8\u5e26\u5bbd\u8fdb\u7a0b\uff0c\u5e76\u4ecb\u7ecd\u4e86\u57fa\u4e8eGo\u7684\u8fdb\u7a0b\u7ea7\u6d41\u91cf\u76d1\u63a7\u5de5\u5177go-netflow\uff0c\u5176\u6838\u5fc3\u539f\u7406\u662f\u901a\u8fc7\/proc\u76ee\u5f55\u548cgopacket\u5e93\u5b9e\u73b0\u6d41\u91cf\u4e0e\u8fdb\u7a0b\u7684\u5173\u8054\u3002\u6700\u540e\uff0c\u5bf9\u6bd4\u4e86\u4e0d\u540c\u5de5\u5177\u7684\u4f18\u52bf\u573a\u666f\uff0c","og_url":"https:\/\/www.wsisp.com\/helps\/39124.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-21T23:36:13+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/39124.html","url":"https:\/\/www.wsisp.com\/helps\/39124.html","name":"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-21T23:36:13+00:00","dateModified":"2025-05-21T23:36:13+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/39124.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/39124.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/39124.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u95ee\u9898\u6392\u67e5-\u5f15\u8d77\u670d\u52a1\u5668\u5e26\u5bbd\u4f7f\u7528\u7387\u9ad8\u7684\u5185\u9b3c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=39124"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/39124\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=39124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=39124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=39124"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=39124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}