﻿{"id":723,"date":"2012-02-07T09:34:54","date_gmt":"2012-02-07T01:34:54","guid":{"rendered":"http:\/\/nick.workao.org\/?p=723"},"modified":"2012-02-07T09:34:55","modified_gmt":"2012-02-07T01:34:55","slug":"%e8%bd%aclinux%e6%b5%81%e9%87%8f%e7%9b%91%e6%8e%a7%e5%b7%a5%e5%85%b7-iftop-%e6%9c%80%e5%85%a8%e9%9d%a2%e7%9a%84iftop%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/nick.txtcc.com\/index.php\/linux\/723","title":{"rendered":"\u8f6cLinux\u6d41\u91cf\u76d1\u63a7\u5de5\u5177 &#8211; iftop (\u6700\u5168\u9762\u7684iftop\u6559\u7a0b)"},"content":{"rendered":"<p>\u5728\u7c7bUnix\u7cfb\u7edf\u4e2d\u53ef\u4ee5\u4f7f\u7528top\u67e5\u770b\u7cfb\u7edf\u8d44\u6e90\u3001\u8fdb\u7a0b\u3001\u5185\u5b58\u5360\u7528\u7b49\u4fe1\u606f\u3002\u67e5\u770b\u7f51\u7edc\u72b6\u6001\u53ef\u4ee5\u4f7f\u7528netstat\u3001nmap\u7b49\u5de5\u5177\u3002\u82e5\u8981\u67e5\u770b\u5b9e\u65f6\u7684\u7f51\u7edc\u6d41\u91cf\uff0c\u76d1\u63a7TCP\/IP\u8fde\u63a5\u7b49\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528<a href=\"http:\/\/www.vpser.net\/manage\/iftop.html\" target=\"_blank\">iftop<\/a>\u3002<\/p>\n<h2>\u4e00\u3001iftop\u662f\u4ec0\u4e48\uff1f<\/h2>\n<p><a href=\"http:\/\/www.vpser.net\/manage\/iftop.html\" target=\"_blank\">iftop<\/a>\u662f\u7c7b\u4f3c\u4e8etop\u7684\u5b9e\u65f6\u6d41\u91cf\u76d1\u63a7\u5de5\u5177\u3002<\/p>\n<p>\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"http:\/\/www.ex-parrot.com\/%7Epdw\/iftop\/\" target=\"_blank\"><a href=\"http:\/\/www.ex-parrot.com\/~pdw\/iftop\/\">http:\/\/www.ex-parrot.com\/~pdw\/iftop\/<\/a><\/a><\/p>\n<h2>\u4e8c\u3001iftop\u6709\u4ec0\u4e48\u7528\uff1f<\/h2>\n<p><a href=\"http:\/\/www.vpser.net\/manage\/iftop.html\" target=\"_blank\">iftop<\/a>\u53ef\u4ee5\u7528\u6765\u76d1\u63a7\u7f51\u5361\u7684\u5b9e\u65f6\u6d41\u91cf\uff08\u53ef\u4ee5\u6307\u5b9a\u7f51\u6bb5\uff09\u3001\u53cd\u5411\u89e3\u6790IP\u3001\u663e\u793a\u7aef\u53e3\u4fe1\u606f\u7b49\uff0c\u8be6\u7ec6\u7684\u5c06\u4f1a\u5728\u540e\u9762\u7684\u4f7f\u7528\u53c2\u6570\u4e2d\u8bf4\u660e\u3002<\/p>\n<h2>\u4e09\u3001\u5b89\u88c5iftop<\/h2>\n<h3><strong>\u5b89\u88c5\u65b9\u6cd51\u3001<\/strong>\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<p>\u5982\u679c\u91c7\u7528\u7f16\u8bd1\u5b89\u88c5\u53ef\u4ee5\u5230<a href=\"http:\/\/www.ex-parrot.com\/%7Epdw\/iftop\/\" target=\"_blank\">iftop\u5b98\u7f51<\/a>\u4e0b\u8f7d\u6700\u65b0\u7684\u6e90\u7801\u5305\u3002<\/p>\n<p>\u5b89\u88c5\u524d\u9700\u8981\u5df2\u7ecf\u5b89\u88c5\u597d\u57fa\u672c\u7684\u7f16\u8bd1\u6240\u9700\u7684\u73af\u5883\uff0c\u6bd4\u5982make\u3001gcc\u3001autoconf\u7b49\u3002\u5b89\u88c5iftop\u8fd8\u9700\u8981\u5b89\u88c5libpcap\u548clibcurses\u3002<\/p>\n<p><strong>CentOS\u4e0a\u5b89\u88c5\u6240\u9700\u4f9d\u8d56\u5305\uff1a<\/strong><\/p>\n<p>yum install flex byacc\u00a0 libpcap ncurses ncurses-devel libpcap-devel<\/p>\n<p><strong>Debian\u4e0a\u5b89\u88c5\u6240\u9700\u4f9d\u8d56\u5305\uff1a<\/strong><\/p>\n<p>apt-get install flex byacc\u00a0 libpcap0.8 libncurses5<\/p>\n<p>\u4e0b\u8f7diftop<\/p>\n<blockquote>wget http:\/\/www.ex-parrot.com\/pdw\/iftop\/download\/iftop-0.17.tar.gz\n\ntar zxvf iftop-0.17.tar.gz\n\ncd iftop-0.17\n\n.\/configure\n\nmake &#038;&#038; make install<\/blockquote>\n<h3>\u5b89\u88c5\u65b9\u6cd52\uff1a(\u61d2\u4eba\u529e\u6cd5\uff0c\u6700\u7b80\u5355)<\/h3>\n<p>\u76f4\u63a5\u7701\u7565\u4e0a\u9762\u7684\u6b65\u9aa4<\/p>\n<p>CentOS\u7cfb\u7edf\uff1a<\/p>\n<p>yum install flex byacc\u00a0 libpcap ncurses ncurses-devel<\/p>\n<p>wget ftp:\/\/fr2.rpmfind.net\/linux\/dag\/redhat\/el5\/en\/i386\/dag\/RPMS\/iftop-0.17-1.el5.rf.i386.rpm<\/p>\n<p>rpm -ivh iftop-0.17-1.el5.rf.i386.rpm<\/p>\n<p>Debian\u7cfb\u7edf \u8fd0\u884c\uff1aapt-get install iftop<\/p>\n<h2>\u56db\u3001\u8fd0\u884ciftop<\/h2>\n<p>\u76f4\u63a5\u8fd0\u884c\uff1a iftop<\/p>\n<p>\u6548\u679c\u5982\u4e0b\u56fe\uff1a<\/p>\n<img loading=\"lazy\" decoding=\"async\" title=\"iftop-interface\" src=\"http:\/\/nick.txtcc.com\/wp-content\/uploads\/remote_image\/2012\/02\/013455yQo.jpg\" alt=\"\" width=\"646\" height=\"341\" \/>\n<h2>\u4e94\u3001\u76f8\u5173\u53c2\u6570\u53ca\u8bf4\u660e<\/h2>\n<h3>1\u3001iftop\u754c\u9762\u76f8\u5173\u8bf4\u660e<\/h3>\n<p>\u754c\u9762\u4e0a\u9762\u663e\u793a\u7684\u662f\u7c7b\u4f3c\u523b\u5ea6\u5c3a\u7684\u523b\u5ea6\u8303\u56f4\uff0c\u4e3a\u663e\u793a\u6d41\u91cf\u56fe\u5f62\u7684\u957f\u6761\u4f5c\u6807\u5c3a\u7528\u7684\u3002<\/p>\n<p>\u4e2d\u95f4\u7684<= =>\u8fd9\u4e24\u4e2a\u5de6\u53f3\u7bad\u5934\uff0c\u8868\u793a\u7684\u662f\u6d41\u91cf\u7684\u65b9\u5411\u3002<\/p>\n<p>TX\uff1a\u53d1\u9001\u6d41\u91cf\nRX\uff1a\u63a5\u6536\u6d41\u91cf\nTOTAL\uff1a\u603b\u6d41\u91cf\nCumm\uff1a\u8fd0\u884ciftop\u5230\u76ee\u524d\u65f6\u95f4\u7684\u603b\u6d41\u91cf\npeak\uff1a\u6d41\u91cf\u5cf0\u503c\nrates\uff1a\u5206\u522b\u8868\u793a\u8fc7\u53bb 2s 10s 40s \u7684\u5e73\u5747\u6d41\u91cf<\/p>\n<h3>2\u3001iftop\u76f8\u5173\u53c2\u6570<\/h3>\n<h3>\u5e38\u7528\u7684\u53c2\u6570<\/h3>\n<p>-i\u8bbe\u5b9a\u76d1\u6d4b\u7684\u7f51\u5361\uff0c\u5982\uff1a# iftop -i eth1<\/p>\n<p>-B \u4ee5bytes\u4e3a\u5355\u4f4d\u663e\u793a\u6d41\u91cf(\u9ed8\u8ba4\u662fbits)\uff0c\u5982\uff1a# iftop -B<\/p>\n<p>-n\u4f7fhost\u4fe1\u606f\u9ed8\u8ba4\u76f4\u63a5\u90fd\u663e\u793aIP\uff0c\u5982\uff1a# iftop -n<\/p>\n<p>-N\u4f7f\u7aef\u53e3\u4fe1\u606f\u9ed8\u8ba4\u76f4\u63a5\u90fd\u663e\u793a\u7aef\u53e3\u53f7\uff0c\u5982: # iftop -N<\/p>\n<p>-F\u663e\u793a\u7279\u5b9a\u7f51\u6bb5\u7684\u8fdb\u51fa\u6d41\u91cf\uff0c\u5982# iftop -F 10.10.1.0\/24\u6216# iftop -F 10.10.1.0\/255.255.255.0<\/p>\n<p>-h\uff08display this message\uff09\uff0c\u5e2e\u52a9\uff0c\u663e\u793a\u53c2\u6570\u4fe1\u606f<\/p>\n<p>-p\u4f7f\u7528\u8fd9\u4e2a\u53c2\u6570\u540e\uff0c\u4e2d\u95f4\u7684\u5217\u8868\u663e\u793a\u7684\u672c\u5730\u4e3b\u673a\u4fe1\u606f\uff0c\u51fa\u73b0\u4e86\u672c\u673a\u4ee5\u5916\u7684IP\u4fe1\u606f;<\/p>\n<p>-b\u4f7f\u6d41\u91cf\u56fe\u5f62\u6761\u9ed8\u8ba4\u5c31\u663e\u793a;<\/p>\n<p>-f\u8fd9\u4e2a\u6682\u65f6\u8fd8\u4e0d\u592a\u4f1a\u7528\uff0c\u8fc7\u6ee4\u8ba1\u7b97\u5305\u7528\u7684;<\/p>\n<p>-P\u4f7fhost\u4fe1\u606f\u53ca\u7aef\u53e3\u4fe1\u606f\u9ed8\u8ba4\u5c31\u90fd\u663e\u793a;<\/p>\n<p>-m\u8bbe\u7f6e\u754c\u9762\u6700\u4e0a\u8fb9\u7684\u523b\u5ea6\u7684\u6700\u5927\u503c\uff0c\u523b\u5ea6\u5206\u4e94\u4e2a\u5927\u6bb5\u663e\u793a\uff0c\u4f8b\uff1a# iftop -m 100M<\/p>\n<h3>\u8fdb\u5165iftop\u753b\u9762\u540e\u7684\u4e00\u4e9b\u64cd\u4f5c\u547d\u4ee4(\u6ce8\u610f\u5927\u5c0f\u5199)<\/h3>\n<p>\u6309h\u5207\u6362\u662f\u5426\u663e\u793a\u5e2e\u52a9;<\/p>\n<p>\u6309n\u5207\u6362\u663e\u793a\u672c\u673a\u7684IP\u6216\u4e3b\u673a\u540d;<\/p>\n<p>\u6309s\u5207\u6362\u662f\u5426\u663e\u793a\u672c\u673a\u7684host\u4fe1\u606f;<\/p>\n<p>\u6309d\u5207\u6362\u662f\u5426\u663e\u793a\u8fdc\u7aef\u76ee\u6807\u4e3b\u673a\u7684host\u4fe1\u606f;<\/p>\n<p>\u6309t\u5207\u6362\u663e\u793a\u683c\u5f0f\u4e3a2\u884c\/1\u884c\/\u53ea\u663e\u793a\u53d1\u9001\u6d41\u91cf\/\u53ea\u663e\u793a\u63a5\u6536\u6d41\u91cf;<\/p>\n<p>\u6309N\u5207\u6362\u663e\u793a\u7aef\u53e3\u53f7\u6216\u7aef\u53e3\u670d\u52a1\u540d\u79f0;<\/p>\n<p>\u6309S\u5207\u6362\u662f\u5426\u663e\u793a\u672c\u673a\u7684\u7aef\u53e3\u4fe1\u606f;<\/p>\n<p>\u6309D\u5207\u6362\u662f\u5426\u663e\u793a\u8fdc\u7aef\u76ee\u6807\u4e3b\u673a\u7684\u7aef\u53e3\u4fe1\u606f;<\/p>\n<p>\u6309p\u5207\u6362\u662f\u5426\u663e\u793a\u7aef\u53e3\u4fe1\u606f;<\/p>\n<p>\u6309P\u5207\u6362\u6682\u505c\/\u7ee7\u7eed\u663e\u793a;<\/p>\n<p>\u6309b\u5207\u6362\u662f\u5426\u663e\u793a\u5e73\u5747\u6d41\u91cf\u56fe\u5f62\u6761;<\/p>\n<p>\u6309B\u5207\u6362\u8ba1\u7b972\u79d2\u621610\u79d2\u621640\u79d2\u5185\u7684\u5e73\u5747\u6d41\u91cf;<\/p>\n<p>\u6309T\u5207\u6362\u662f\u5426\u663e\u793a\u6bcf\u4e2a\u8fde\u63a5\u7684\u603b\u6d41\u91cf;<\/p>\n<p>\u6309l\u6253\u5f00\u5c4f\u5e55\u8fc7\u6ee4\u529f\u80fd\uff0c\u8f93\u5165\u8981\u8fc7\u6ee4\u7684\u5b57\u7b26\uff0c\u6bd4\u5982ip,\u6309\u56de\u8f66\u540e\uff0c\u5c4f\u5e55\u5c31\u53ea\u663e\u793a\u8fd9\u4e2aIP\u76f8\u5173\u7684\u6d41\u91cf\u4fe1\u606f;<\/p>\n<p>\u6309L\u5207\u6362\u663e\u793a\u753b\u9762\u4e0a\u8fb9\u7684\u523b\u5ea6;\u523b\u5ea6\u4e0d\u540c\uff0c\u6d41\u91cf\u56fe\u5f62\u6761\u4f1a\u6709\u53d8\u5316;<\/p>\n<p>\u6309j\u6216\u6309k\u53ef\u4ee5\u5411\u4e0a\u6216\u5411\u4e0b\u6eda\u52a8\u5c4f\u5e55\u663e\u793a\u7684\u8fde\u63a5\u8bb0\u5f55;<\/p>\n<p>\u63091\u62162\u62163\u53ef\u4ee5\u6839\u636e\u53f3\u4fa7\u663e\u793a\u7684\u4e09\u5217\u6d41\u91cf\u6570\u636e\u8fdb\u884c\u6392\u5e8f;<\/p>\n<p>\u6309<\u6839\u636e\u5de6\u8fb9\u7684\u672c\u673a\u540d\u6216IP\u6392\u5e8f;<\/p>\n<p>\u6309>\u6839\u636e\u8fdc\u7aef\u76ee\u6807\u4e3b\u673a\u7684\u4e3b\u673a\u540d\u6216IP\u6392\u5e8f;<\/p>\n<p>\u6309o\u5207\u6362\u662f\u5426\u56fa\u5b9a\u53ea\u663e\u793a\u5f53\u524d\u7684\u8fde\u63a5;<\/p>\n<p>\u6309f\u53ef\u4ee5\u7f16\u8f91\u8fc7\u6ee4\u4ee3\u7801\uff0c\u8fd9\u662f\u7ffb\u8bd1\u8fc7\u6765\u7684\u8bf4\u6cd5\uff0c\u6211\u8fd8\u6ca1\u7528\u8fc7\u8fd9\u4e2a\uff01<\/p>\n<p>\u6309!\u53ef\u4ee5\u4f7f\u7528shell\u547d\u4ee4\uff0c\u8fd9\u4e2a\u6ca1\u7528\u8fc7\uff01\u6ca1\u641e\u660e\u767d\u5565\u547d\u4ee4\u5728\u8fd9\u597d\u7528\u5462\uff01<\/p>\n<p>\u6309q\u9000\u51fa\u76d1\u63a7\u3002<\/p>\n<h2>\u516d\u3001\u5e38\u89c1\u95ee\u9898<\/h2>\n<p>1\u3001make: yacc: Command not found\nmake: *** [grammar.c] Error 127<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1aapt-get install byacc\u00a0\u00a0 \/\u00a0\u00a0 yum install byacc<\/p>\n<p>2\u3001configure: error: Curses! Foiled again!\n(Can&#8217;t find a curses library supporting mvchgat.)\nConsider installing ncurses.<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1aapt-get install libncurses5-dev\u00a0 \/ \u00a0\u00a0 yum\u00a0 install ncurses-devel<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5728\u7c7bUnix\u7cfb\u7edf\u4e2d\u53ef\u4ee5\u4f7f\u7528top\u67e5\u770b\u7cfb\u7edf\u8d44\u6e90\u3001\u8fdb\u7a0b\u3001\u5185\u5b58\u5360\u7528\u7b49\u4fe1\u606f\u3002\u67e5\u770b\u7f51\u7edc\u72b6\u6001\u53ef\u4ee5\u4f7f\u7528netstat\u3001nmap\u7b49\u5de5\u5177\u3002\u82e5\u8981\u67e5\u770b\u5b9e\u65f6\u7684\u7f51\u7edc\u6d41\u91cf\uff0c\u76d1\u63a7TCP\/IP\u8fde\u63a5\u7b49\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528iftop\u3002 \u4e00\u3001if&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-723","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=723"}],"version-history":[{"count":2,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":727,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/723\/revisions\/727"}],"wp:attachment":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}