{"id":63710,"date":"2025-04-29T12:16:24","date_gmt":"2025-04-29T04:16:24","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63710\/"},"modified":"2025-04-29T12:16:24","modified_gmt":"2025-04-29T04:16:24","slug":"linux-tcpdump%e5%90%8e%e6%80%8e%e4%b9%88%e5%8a%9e-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63710\/","title":{"rendered":"linux tcpdump\u540e\u600e\u4e48\u529e"},"content":{"rendered":"<blockquote><p>\n  tcpdump \u7684\u540e\u7eed\u6b65\u9aa4\u5305\u62ec\uff1a\u505c\u6b62 tcpdump\u3001\u4fdd\u5b58\u6570\u636e\u4e3a\u6587\u672c\u6587\u4ef6\u3001libpcap \u6587\u4ef6\u6216\u6d41\u5f0f\u4f20\u8f93\u3001\u8bfb\u53d6 pcap \u6587\u4ef6\uff08\u4f7f\u7528 tcpdump \u6216 wireshark\uff09\u3001\u5206\u6790\u6570\u636e\uff08\u67e5\u770b\u57fa\u672c\u4fe1\u606f\u3001\u8fc7\u6ee4\u6570\u636e\u3001\u83b7\u53d6\u7edf\u8ba1\u4fe1\u606f\uff09\u3001\u4f7f\u7528 tcpdump \u68c0\u67e5\u8be6\u7ec6\u8f93\u51fa\u3001\u4f7f\u7528 tshark \u5206\u6790\u6570\u636e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060413241940577.jpg\" class=\"aligncenter\" title=\"linux tcpdump\u540e\u600e\u4e48\u529e\u63d2\u56fe\" alt=\"linux tcpdump\u540e\u600e\u4e48\u529e\u63d2\u56fe\" \/><\/p>\n<p><strong>Linux tcpdump \u540e\u7eed\u6b65\u9aa4<\/strong><\/p>\n<p><strong>\u76ee\u6807\uff1a<\/strong>\u4e86\u89e3 tcpdump \u540e\u7eed\u5904\u7406\u6570\u636e\u7684\u5e38\u7528\u540e\u7eed\u6b65\u9aa4\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u505c\u6b62 tcpdump<\/strong><\/p>\n<pre>Ctrl + C<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4fdd\u5b58\u6570\u636e<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6\uff1a<\/strong><\/p>\n<pre>tcpdump -w filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u4e3a libpcap \u6587\u4ef6\uff1a<\/strong><\/p>\n<pre>tcpdump -C filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u6d41\u5f0f\u4fdd\u5b58\u5230\u6587\u4ef6\uff1a<\/strong><\/p>\n<pre>tcpdump -w - &gt; filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>3. \u8bfb\u53d6 pcap \u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u4f7f\u7528 tcpdump\uff1a<\/strong><\/p>\n<pre>tcpdump -r filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u4f7f\u7528 Wireshark\uff1a<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 Wireshark\u3002<\/li>\n<li>\u5355\u51fb\u201c\u6587\u4ef6\u201d&gt;\u201c\u6253\u5f00\u201d\u3002<\/li>\n<li>\u9009\u62e9\u8981\u6253\u5f00\u7684 pcap \u6587\u4ef6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>4. \u5206\u6790\u6570\u636e<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u67e5\u770b\u57fa\u672c\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>tcpdump -r filename.pcap -nn<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u8fc7\u6ee4\u6570\u636e\uff1a<\/strong><\/p>\n<pre>tcpdump -r filename.pcap 'filter expression'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u7edf\u8ba1\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>tcpdump -r filename.pcap -c count<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>5. \u7591\u96be\u89e3\u7b54<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u4f7f\u7528 tcpdump -v \u67e5\u770b\u8be6\u7ec6\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>tcpdump -v -r filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u68c0\u67e5 libcap \u8fc7\u6ee4\u5668\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>tcpdump -F -r filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u4f7f\u7528 tshark \u5206\u6790\u6570\u636e\uff1a<\/strong><\/p>\n<pre>tshark -r filename.pcap<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f tcpdump\u540e\u600e\u4e48\u529e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tcpdump \u7684\u540e\u7eed\u6b65\u9aa4\u5305\u62ec\uff1a\u505c\u6b62 tcpdump\u3001\u4fdd\u5b58\u6570\u636e\u4e3a\u6587\u672c\u6587\u4ef6\u3001libpcap \u6587\u4ef6\u6216\u6d41\u5f0f\u4f20\u8f93\u3001\u8bfb\u53d6 pcap \u6587\u4ef6\uff08\u4f7f\u7528 tcpdump \u6216 wireshark\uff09\u3001\u5206\u6790\u6570\u636e\uff08\u67e5\u770b\u57fa\u672c\u4fe1\u606f\u3001\u8fc7\u6ee4\u6570\u636e\u3001\u83b7\u53d6\u7edf\u8ba1\u4fe1\u606f\uff09\u3001\u4f7f\u7528 tcpdump \u68c0\u67e5\u8be6\u7ec6\u8f93\u51fa\u3001\u4f7f\u7528 tshark \u5206\u6790\u6570\u636e\u3002 Linux tcpdump \u540e\u7eed\u6b65\u9aa4 \u76ee\u6807\uff1a\u4e86\u89e3 tcpdump \u540e\u7eed\u5904\u7406\u6570\u636e\u7684\u5e38\u7528\u540e\u7eed\u6b65\u9aa4\u3002 \u6b65\u9aa4\uff1a 1. \u505c\u6b62 tcpdump Ctrl + C \u767b\u5f55\u540e\u590d\u5236 2. \u4fdd\u5b58\u6570\u636e \u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6\uff1a tcpdump -w filename.pcap \u767b\u5f55\u540e\u590d\u5236 \u4fdd\u5b58\u4e3a libpcap \u6587\u4ef6\uff1a tcpdump -C filename.pcap \u767b\u5f55\u540e\u590d\u5236 \u6d41\u5f0f\u4fdd\u5b58\u5230\u6587\u4ef6\uff1a tcpdump -w &#8211; &gt; filename.pcap \u767b\u5f55\u540e\u590d\u5236 3. \u8bfb\u53d6 pcap \u6587\u4ef6 \u4f7f\u7528 tcpdump\uff1a tcpdump [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63710","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63710"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63710\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}