{"id":43664,"date":"2024-10-06T02:31:33","date_gmt":"2024-10-05T18:31:33","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43664\/"},"modified":"2024-10-06T02:31:33","modified_gmt":"2024-10-05T18:31:33","slug":"centos-7-%e9%85%8d%e7%bd%ae%e7%b6%b2%e5%8d%a1%e7%ab%af%e5%8f%a3%e9%8f%a1%e5%83%8f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43664\/","title":{"rendered":"CentOS 7 \u914d\u7f6e\u7db2\u5361\u7aef\u53e3\u93e1\u50cf"},"content":{"rendered":"<h1 id=\"centos-7-%e9%85%8d%e7%bd%ae%e7%b6%b2%e5%8d%a1%e7%ab%af%e5%8f%a3%e9%8f%a1%e5%83%8f-QUVqDidQUF\">CentOS 7 \u914d\u7f6e\u7db2\u5361\u7aef\u53e3\u93e1\u50cf<\/h1>\n<p>\u5728\u7db2\u7d61\u7ba1\u7406\u4e2d\uff0c\u7aef\u53e3\u93e1\u50cf\u662f\u4e00\u7a2e\u91cd\u8981\u7684\u6280\u8853\uff0c\u901a\u5e38\u7528\u65bc\u76e3\u63a7\u548c\u5206\u6790\u7db2\u7d61\u6d41\u91cf\u3002\u900f\u904e\u7aef\u53e3\u93e1\u50cf\uff0c\u7cfb\u7d71\u7ba1\u7406\u54e1\u53ef\u4ee5\u5c07\u4e00\u500b\u7db2\u5361\u7684\u6d41\u91cf\u8907\u88fd\u5230\u53e6\u4e00\u500b\u7db2\u5361\u4e0a\uff0c\u9019\u6a23\u5c31\u53ef\u4ee5\u4f7f\u7528\u6d41\u91cf\u5206\u6790\u5de5\u5177\u9032\u884c\u6df1\u5165\u7684\u6d41\u91cf\u6aa2\u67e5\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u7cfb\u7d71\u4e2d\u914d\u7f6e\u7db2\u5361\u7aef\u53e3\u93e1\u50cf\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e7%ab%af%e5%8f%a3%e9%8f%a1%e5%83%8f%ef%bc%9f-QUVqDidQUF\">\u4ec0\u9ebc\u662f\u7aef\u53e3\u93e1\u50cf\uff1f<\/h2>\n<p>\u7aef\u53e3\u93e1\u50cf\uff08Port Mirroring\uff09\u662f\u4e00\u7a2e\u7db2\u7d61\u6280\u8853\uff0c\u5141\u8a31\u7528\u6236\u5c07\u4e00\u500b\u6216\u591a\u500b\u7aef\u53e3\u7684\u6d41\u91cf\u8907\u88fd\u5230\u53e6\u4e00\u500b\u7aef\u53e3\u3002\u9019\u5c0d\u65bc\u6d41\u91cf\u76e3\u63a7\u3001\u6545\u969c\u6392\u9664\u548c\u5b89\u5168\u5206\u6790\u975e\u5e38\u6709\u7528\u3002\u901a\u904e\u7aef\u53e3\u93e1\u50cf\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u4f7f\u7528\u5982 Wireshark \u7b49\u5de5\u5177\u4f86\u6355\u7372\u548c\u5206\u6790\u7db2\u7d61\u6d41\u91cf\uff0c\u800c\u4e0d\u6703\u5f71\u97ff\u5230\u539f\u59cb\u6d41\u91cf\u7684\u50b3\u8f38\u3002<\/p>\n<h2 id=\"%e5%9c%a8-centos-7-%e4%b8%ad%e9%85%8d%e7%bd%ae%e7%ab%af%e5%8f%a3%e9%8f%a1%e5%83%8f%e7%9a%84%e6%ad%a5%e9%a9%9f-QUVqDidQUF\">\u5728 CentOS 7 \u4e2d\u914d\u7f6e\u7aef\u53e3\u93e1\u50cf\u7684\u6b65\u9a5f<\/h2>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e5%b7%a5%e5%85%b7-QUVqDidQUF\">\u6b65\u9a5f 1\uff1a\u5b89\u88dd\u5fc5\u8981\u7684\u5de5\u5177<\/h3>\n<p>\u5728\u958b\u59cb\u914d\u7f6e\u4e4b\u524d\uff0c\u78ba\u4fdd\u4f60\u7684 CentOS 7 \u7cfb\u7d71\u5df2\u7d93\u5b89\u88dd\u4e86\u5fc5\u8981\u7684\u7db2\u7d61\u5de5\u5177\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd tcpdump \u548c iproute2\uff1a<\/p>\n<pre><code>sudo yum install tcpdump iproute<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e6%9f%a5%e6%89%be%e7%b6%b2%e5%8d%a1%e5%90%8d%e7%a8%b1-QUVqDidQUF\">\u6b65\u9a5f 2\uff1a\u67e5\u627e\u7db2\u5361\u540d\u7a31<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u67e5\u627e\u7cfb\u7d71\u4e2d\u7684\u7db2\u5361\u540d\u7a31\uff1a<\/p>\n<pre><code>ip link show<\/code><\/pre>\n<p>\u9019\u5c07\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u7db2\u5361\uff0c\u8a18\u4e0b\u4f60\u60f3\u8981\u93e1\u50cf\u7684\u6e90\u7db2\u5361\u548c\u76ee\u6a19\u7db2\u5361\u7684\u540d\u7a31\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e9%85%8d%e7%bd%ae%e7%ab%af%e5%8f%a3%e9%8f%a1%e5%83%8f-QUVqDidQUF\">\u6b65\u9a5f 3\uff1a\u914d\u7f6e\u7aef\u53e3\u93e1\u50cf<\/h3>\n<p>\u5728 CentOS 7 \u4e2d\uff0c\u7aef\u53e3\u93e1\u50cf\u7684\u914d\u7f6e\u901a\u5e38\u662f\u901a\u904e\u7db2\u7d61\u4ea4\u63db\u6a5f\u4f86\u5b8c\u6210\u7684\uff0c\u4f46\u5982\u679c\u4f60\u60f3\u5728\u672c\u5730\u9032\u884c\u6e2c\u8a66\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u914d\u7f6e\u93e1\u50cf\uff1a<\/p>\n<pre><code>ip link set dev eth0 master bond0\nip link set dev eth1 master bond0<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c\u5047\u8a2d eth0 \u662f\u6e90\u7db2\u5361\uff0ceth1 \u662f\u76ee\u6a19\u7db2\u5361\uff0cbond0 \u662f\u4e00\u500b\u865b\u64ec\u7db2\u5361\uff0c\u7528\u65bc\u63a5\u6536\u93e1\u50cf\u6d41\u91cf\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-4%ef%bc%9a%e5%95%9f%e7%94%a8%e9%8f%a1%e5%83%8f-QUVqDidQUF\">\u6b65\u9a5f 4\uff1a\u555f\u7528\u93e1\u50cf<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u555f\u7528\u93e1\u50cf\uff1a<\/p>\n<pre><code>ip link set bond0 up<\/code><\/pre>\n<p>\u9019\u6a23\u5c31\u5b8c\u6210\u4e86\u7aef\u53e3\u93e1\u50cf\u7684\u57fa\u672c\u914d\u7f6e\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 tcpdump \u4f86\u6355\u7372\u6d41\u91cf\uff1a<\/p>\n<pre><code>tcpdump -i bond0<\/code><\/pre>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-QUVqDidQUF\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<ul>\n<li>\u78ba\u4fdd\u4f60\u7684\u7db2\u7d61\u4ea4\u63db\u6a5f\u652f\u6301\u7aef\u53e3\u93e1\u50cf\u529f\u80fd\u3002<\/li>\n<li>\u5728\u9032\u884c\u93e1\u50cf\u914d\u7f6e\u6642\uff0c\u8acb\u6ce8\u610f\u7db2\u7d61\u6027\u80fd\uff0c\u904e\u591a\u7684\u93e1\u50cf\u6d41\u91cf\u53ef\u80fd\u6703\u5f71\u97ff\u7db2\u7d61\u7684\u6b63\u5e38\u904b\u884c\u3002<\/li>\n<li>\u5b9a\u671f\u6aa2\u67e5\u548c\u6e05\u7406\u6355\u7372\u7684\u6578\u64da\uff0c\u4ee5\u907f\u514d\u4f54\u7528\u904e\u591a\u7684\u5b58\u5132\u7a7a\u9593\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-QUVqDidQUF\">\u7e3d\u7d50<\/h2>\n<p>\u7aef\u53e3\u93e1\u50cf\u662f\u4e00\u7a2e\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u7cfb\u7d71\u7ba1\u7406\u54e1\u76e3\u63a7\u548c\u5206\u6790\u7db2\u7d61\u6d41\u91cf\u3002\u5728 CentOS 7 \u4e2d\u914d\u7f6e\u7aef\u53e3\u93e1\u50cf\u76f8\u5c0d\u7c21\u55ae\uff0c\u53ea\u9700\u5e7e\u500b\u6b65\u9a5f\u5373\u53ef\u5b8c\u6210\u3002\u900f\u904e\u9019\u7a2e\u6280\u8853\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3\u7db2\u7d61\u884c\u70ba\uff0c\u53ca\u6642\u767c\u73fe\u6f5b\u5728\u7684\u554f\u984c\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u5404\u7a2e\u9700\u6c42\u3002\u7121\u8ad6\u662f\u4f01\u696d\u7d1a\u61c9\u7528\u9084\u662f\u500b\u4eba\u9805\u76ee\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u4f60\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728CentOS 7\u4e2d\u914d\u7f6e\u7db2\u5361\u7aef\u53e3\u93e1\u50cf\uff0c\u4ee5\u4fbf\u76e3\u63a7\u548c\u5206\u6790\u7db2\u7d61\u6d41\u91cf\uff0c\u63d0\u5347\u7db2\u7d61\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43664","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43664"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43664\/revisions"}],"predecessor-version":[{"id":43665,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43664\/revisions\/43665"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}