{"id":2554,"date":"2021-10-14T16:15:06","date_gmt":"2021-10-14T23:15:06","guid":{"rendered":"https:\/\/www.xh86.me\/?p=2554"},"modified":"2021-10-14T16:15:06","modified_gmt":"2021-10-14T23:15:06","slug":"%e5%8d%8e%e4%b8%ba%e4%ba%a4%e6%8d%a2%e6%9c%ba%e9%85%8d%e7%bd%ae%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=2554","title":{"rendered":"\u534e\u4e3a\u4ea4\u6362\u673a\u914d\u7f6e\u7b14\u8bb0"},"content":{"rendered":"<p>\u4ea4\u6362\u673a\u662f\u4e00\u79cd\u4ea4\u6362\u5f0f\u96c6\u7ebf\u5668,\u5176\u57fa\u4e8eMAC\u5730\u5740\u8bc6\u522b,\u80fd\u5b8c\u6210\u5c01\u88c5\u8f6c\u53d1\u6570\u636e\u5305\u529f\u80fd\u7684\u7f51\u7edc\u8bbe\u5907.\u4ea4\u6362\u673a\u53ef\u4ee5\u5b66\u4e60MAC\u5730\u5740,\u5e76\u628a\u5176\u5b58\u653e\u5728\u5185\u90e8\u5730\u5740\u8868\u4e2d,\u901a\u8fc7\u5728\u6570\u636e\u5e27\u7684\u59cb\u53d1\u8005\u548c\u76ee\u6807\u63a5\u6536\u8005\u4e4b\u95f4\u5efa\u7acb\u4e34\u65f6\u7684\u4ea4\u6362\u8def\u5f84,\u4f7f\u6570\u636e\u5e27\u76f4\u63a5\u7531\u6e90\u5730\u5740\u5230\u8fbe\u76ee\u7684\u5730\u5740.<\/p>\n<p>\u4ea4\u6362\u673a\u5185\u90e8\u62e5\u6709\u4e00\u6761\u5f88\u9ad8\u5e26\u5bbd\u7684\u80cc\u677f\u603b\u7ebf\u548c\u5185\u90e8\u4ea4\u6362\u77e9\u9635\u6240\u6709\u7684\u7aef\u53e3\u90fd\u6302\u63a5\u5728\u8fd9\u6761\u80cc\u677f\u603b\u7ebf\u4e0a\u63a7\u5236\u7535\u8def\u6536\u5230\u6570\u636e\u5305\u4ee5\u540e,\u5904\u7406\u7aef\u53e3\u4f1a\u67e5\u627e\u5185\u5b58\u4e2d\u7684\u5730\u5740\u5bf9\u7167\u8868\u4ee5\u786e\u5b9a\u76ee\u7684MAC\u5730\u5740\u7684\u7f51\u5361NIC\u6302\u63a5\u5728\u54ea\u4e2a\u7aef\u53e3\u4e0a,\u901a\u8fc7\u5185\u90e8\u4ea4\u6362\u77e9\u9635\u8fc5\u901f\u5c06\u6570\u636e\u5305\u4f20\u9001\u5230\u76ee\u7684\u7aef\u53e3\u76ee\u7684MAC\u82e5\u4e0d\u5b58\u5728\u624d\u5e7f\u64ad\u5230\u6240\u6709\u7684\u7aef\u53e3,\u63a5\u6536\u7aef\u53e3\u56de\u5e94\u540e\u4ea4\u6362\u673a\u4f1a\u5b66\u4e60\u65b0\u7684\u5730\u5740,\u5e76\u628a\u5b83\u6dfb\u52a0\u5165\u5185\u90e8MAC\u5730\u5740\u8868\u4e2d.<\/p>\n<p>\u5173\u4e8e\u4ea4\u6362\u673a\u7684\u5206\u7c7b:<\/p>\n<p>1.\u6839\u636e\u7f51\u7edc\u8986\u76d6\u8303\u56f4\u5212\u5206\u4ea4\u6362\u673a:\u5e7f\u57df\u7f51\u4ea4\u6362\u673a\u548c\u5c40\u57df\u7f51\u4ea4\u6362\u673a<br \/>\n2.\u6839\u636e\u4ea4\u6362\u673a\u7aef\u53e3\u7ed3\u6784\u5212\u5206\u4ea4\u6362\u673a:\u56fa\u5b9a\u7aef\u53e3\u4ea4\u6362\u673a\u548c\u6a21\u5757\u5316\u4ea4\u6362\u673a<br \/>\n3.\u6839\u636e\u5de5\u4f5c\u534f\u8bae\u5c42\u5212\u5206\u4ea4\u6362\u673a:\u4e8c\u5c42\u4ea4\u6362\u673a\u3001\u4e09\u5c42\u4ea4\u6362\u673a\u3001\u56db\u5c42\u4ea4\u6362\u673a<br \/>\n4.\u6839\u636e\u652f\u6301\u7f51\u7ba1\u529f\u80fd\u5212\u5206\u4ea4\u6362\u673a:\u7f51\u7ba1\u578b\u4ea4\u6362\u673a\u548c\u975e\u7f51\u7ba1\u7406\u578b\u4ea4\u6362\u673a<br \/>\n5.\u6839\u636e\u4f20\u8f93\u4ecb\u8d28\u5212\u5206\u4ea4\u6362\u673a:\u4ee5\u592a\u7f51\u4ea4\u6362\u673a\u3001\u5feb\u901f\u4ee5\u592a\u7f51\u4ea4\u6362\u673a\u3001ATM\u4ea4\u6362\u673a\u3001FDDI\u4ea4\u6362\u673a\u3001\u4ee4\u724c\u73af\u4ea4\u6362\u673a<br \/>\n6.\u6839\u636e\u5e94\u7528\u7f51\u7edc\u5c42\u6b21\u5212\u5206\u4ea4\u6362\u673a:\u4f01\u4e1a\u7ea7\u4ea4\u6362\u673a\u3001\u6821\u56ed\u7f51\u4ea4\u6362\u673a\u3001\u90e8\u95e8\u7ea7\u4ea4\u6362\u673a\u3001\u5de5\u4f5c\u7ec4\u4ea4\u6362\u673a\u3001\u684c\u673a\u4ea4\u6362\u673a<\/p>\n<p>\u5173\u4e8e\u4e8c\u5c42\u4ea4\u6362\u673a:<\/p>\n<p>\u4e8c\u5c42\u4ea4\u6362\u673a\u662f\u5bf9\u5e94\u4e8eOSI\/RM\u7684\u7b2c\u4e8c\u534f\u8bae\u5c42\u6765\u5b9a\u4e49\u7684,\u56e0\u4e3a\u5b83\u53ea\u80fd\u5de5\u4f5c\u5728OSI\/RM\u5f00\u653e\u4f53\u7cfb\u6a21\u578b\u7684\u7b2c\u4e8c\u5c42,\u5373\u6570\u636e\u94fe\u8def\u5c42.\u4e8c\u5c42\u4ea4\u6362\u673a\u4f9d\u8d56\u4e8e\u94fe\u8def\u5c42\u4e2d\u7684\u4fe1\u606f(\u5982MAC\u5730\u5740)\u5b8c\u6210\u4e0d\u540c\u7aef\u53e3\u6570\u636e\u95f4\u7684\u7ebf\u901f\u4ea4\u6362,\u4e00\u822c\u5e94\u7528\u4e8e\u5c0f\u578b\u4f01\u4e1a\u6216\u4e2d\u578b\u4ee5\u4e0a\u4f01\u4e1a\u7f51\u7edc\u7684\u684c\u9762\u5c42\u6b21.<\/p>\n<p>\u5173\u4e8e\u4e09\u5c42\u4ea4\u6362\u673a:<\/p>\n<p>\u4e09\u5c42\u4ea4\u6362\u673a\u662f\u5bf9\u5e94\u4e8eOSI\/RM\u5f00\u653e\u4f53\u7cfb\u6a21\u578b\u7684\u7b2c\u4e09\u5c42,\u5373\u7f51\u7edc\u5c42\u6765\u5b9a\u4e49\u7684,\u4e5f\u5c31\u662f\u8bf4\u8fd9\u7c7b\u4ea4\u6362\u673a\u53ef\u4ee5\u5de5\u4f5c\u5728\u7f51\u7edc\u5c42,\u5b83\u6bd4\u7b2c\u4e8c\u5c42\u4ea4\u6362\u673a\u66f4\u52a0\u9ad8\u6863,\u529f\u80fd\u66f4\u52a0\u5f3a.\u5f53\u7f51\u7edc\u89c4\u6a21\u8f83\u5927\u65f6,\u53ef\u4ee5\u6839\u636e\u7279\u6b8a\u5e94\u7528\u9700\u6c42\u5212\u5206\u4e3a\u5c0f\u9762\u72ec\u7acb\u7684VLAN\u7f51\u6bb5,\u4ee5\u51cf\u5c0f\u5e7f\u64ad\u6240\u9020\u6210\u7684\u5f71\u54cd,\u901a\u5e38\u8fd9\u7c7b\u4ea4\u6362\u673a\u662f\u91c7\u7528\u6a21\u5757\u5316\u7ed3\u6784,\u4ee5\u9002\u5e94\u7075\u6d3b\u914d\u7f6e\u7684\u9700\u8981.<\/p>\n<p>&nbsp;<\/p>\n<h3>\u4ea4\u6362\u673a\u7684\u521d\u59cb\u5316<\/h3>\n<p><strong>Console\u5bc6\u7801\u8ba4\u8bc1:<\/strong>\u00a0\u914d\u7f6e\u4e0e\u6e05\u9664Console\u63a5\u53e3\u7684\u767b\u9646\u5bc6\u7801,cipher\/simple\u5206\u522b\u4e3a\u914d\u7f6e\u5bc6\u6587\u4e0e\u660e\u6587\u5bc6\u7801.<\/p>\n<p># &#8212;-\u914d\u7f6e\u5bc6\u7801&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view \/\/ \u8fdb\u5165\u914d\u7f6e\u89c6\u56fe<\/p>\n<p>[Huawei] sysname switch1 \/\/ \u914d\u7f6e\u4e3b\u673a\u540d\u79f0<\/p>\n<p>[Huawei] user-interface console 0 \/\/ \u8fdb\u5165Console<\/p>\n<p>[Huawei-ui-console0] authentication-mode password \/\/ \u6307\u5b9a\u5bc6\u7801\u914d\u7f6e<\/p>\n<p>[Huawei-ui-console0] set authentication password cipher 1233 \/\/ \u914d\u7f6e\u5bc6\u6587\u5bc6\u7801<\/p>\n<p>[Huawei-ui-console0] set authentication password simple 1233 \/\/ \u914d\u7f6e\u660e\u6587\u5bc6\u7801<\/p>\n<p>[Huawei-ui-console0] display this \/\/ \u663e\u793a\u67e5\u8be2\u7ed3\u679c<\/p>\n<p>[Huawei-ui-console0] return<\/p>\n<p>&lt;Huawei&gt; save<\/p>\n<p># &#8212;-\u6e05\u9664\u5bc6\u7801&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view \/\/ \u8fdb\u5165\u914d\u7f6e\u89c6\u56fe<\/p>\n<p>[Huawei] user-interface console 0 \/\/ \u8fdb\u5165Console0<\/p>\n<p>[Huawei] undo authentication-mode \/\/ \u6e05\u7406\u7528\u6237\u914d\u7f6e\u5bc6\u7801<\/p>\n<p>[Huawei] undo set authentication password \/\/ \u6e05\u7406\u7528\u6237\u914d\u7f6e\u5bc6\u7801<\/p>\n<p>[Huawei] display this \/\/ \u663e\u793a\u67e5\u8be2\u7ed3\u679c<\/p>\n<p>[Huawei] return<\/p>\n<p>&lt;Huawei&gt; save<\/p>\n<p><strong>AAA\u8d26\u53f7\u5bc6\u7801\u8ba4\u8bc1:<\/strong>\u00a0\u542f\u7528\u7528\u6237\u540d\u5bc6\u7801\u8ba4\u8bc1,\u7528\u6237\u540dlyshark,\u5bc6\u7801\u662f1233,\u4e0b\u6b21\u767b\u9646\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u4e0e\u5bc6\u7801.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] user-interface console 0<\/p>\n<p>[Huawei-ui-console0] authentication-mode aaa<\/p>\n<p>[Huawei-ui-console0] quit<\/p>\n<p>[Huawei] aaa<\/p>\n<p>[Huawei-aaa] local-user lyshark password cipher 1233<\/p>\n<p>[Huawei-aaa] local-user lyshark service-type terminal<\/p>\n<p>[Huawei-aaa] display this<\/p>\n<p>[Huawei-aaa] return<\/p>\n<p>&lt;Huawei&gt; save<\/p>\n<p><strong>\u914d\u7f6e\u8def\u7531\u5668\u8fdc\u7a0b\u767b\u9646:<\/strong>\u00a0\u7ed9\u8def\u7531\u5668\u914d\u7f6e\u6307\u5b9a\u7684IP\u5730\u5740,\u5e76\u80fd\u591f\u901a\u8fc7Telnet\u8fdc\u7a0b\u8fde\u63a5\u5230\u8def\u7531\u5668.<\/p>\n<p># &#8212;-\u914d\u7f6eIP\u5730\u5740&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] interface Ethernet 0\/0\/0 \/\/ \u9009\u62e9\u4ee5\u592a\u7f51\u63a5\u53e3<\/p>\n<p>[Huawei-Ethernet0\/0\/0]<\/p>\n<p>[Huawei-Ethernet0\/0\/0] ip address 192.168.10.10 24 \/\/ \u914d\u7f6eIP\u5730\u5740<\/p>\n<p>[Huawei-Ethernet0\/0\/0] quit<\/p>\n<p># &#8212;-\u914d\u7f6e\u5bc6\u7801\u8ba4\u8bc1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[Huawei] aaa<\/p>\n<p>[Huawei-aaa] local-user lyshark password cipher 123123<\/p>\n<p>[Huawei-aaa] local-user lyshark privilege level 3<\/p>\n<p>[Huawei-aaa] qui<\/p>\n<p>[Huawei] user-interface maximum-vty 5 \/\/ \u6307\u5b9a\u6700\u5927\u767b\u9646\u7528\u6237<\/p>\n<p>[Huawei] user-interface vty 0 4 \/\/ \u6307\u5b9a\u7f16\u53f70-4<\/p>\n<p>[Huawei-ui-vty0-4] authentication-mode aaa \/\/ \u542f\u7528AAA\u8ba4\u8bc1<\/p>\n<p>[Huawei-ui-vty0-4] protocol inbound telnet \/\/ \u914d\u7f6etelnet\u534f\u8bae<\/p>\n<p>[Huawei-ui-vty0-4] quit<\/p>\n<p># &#8212;-\u67e5\u8be2\u548c\u4fdd\u5b58&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; display telnet server status\u3000\u3000\u3000 \/\/ \u67e5\u770btelnet\u662f\u5426\u751f\u6548<\/p>\n<p>&lt;Huawei&gt; display ip interface brief \/\/ \u67e5\u770b\u8def\u7531\u5668\u7aef\u53e3\u60c5\u51b5<\/p>\n<p>&lt;Huawei&gt; display ip routing-table \/\/ \u67e5\u8be2\u8def\u7531\u4fe1\u606f<\/p>\n<p>&lt;Huawei&gt; display interface \/\/ \u770b\u6709\u591a\u5c11\u63a5\u53e3<\/p>\n<p>&lt;Huawei&gt; save \/\/ \u4fdd\u5b58\u914d\u7f6e\u9009\u9879<\/p>\n<p><strong>\u914d\u7f6e\u4ea4\u6362\u673a\u8fdc\u7a0b\u767b\u9646:<\/strong>\u00a0\u7ed9\u4ea4\u6362\u673a\u914d\u7f6e\u8fdc\u7a0b\u767b\u9646\u5730\u5740,\u5e76\u80fd\u591f\u901a\u8fc7Telnet\u8fde\u63a5\u5230\u4ea4\u6362\u673a.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p># &#8212;-\u914d\u7f6e\u5bc6\u7801\u8ba4\u8bc1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[Huawei] aaa<\/p>\n<p>[Huawei-aaa] local-user lyshark password cipher 123123<\/p>\n<p>[Huawei-aaa] local-user lyshark service-type telnet<\/p>\n<p>[Huawei-aaa] local-user lyshark privilege level 15<\/p>\n<p>[Huawei-aaa] display telnet server status<\/p>\n<p>[Huawei-aaa] quit<\/p>\n<p># &#8212;-\u5f00\u542f\u8fdc\u7a0b\u7ec8\u7aef&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[Huawei] user-interface vty 0 4 \/\/ \u8fdb\u5165vty0-4\u865a\u62df\u7ec8\u7aef<\/p>\n<p>[Huawei-ui-vty0-4] authentication-mode aaa \/\/ \u914d\u7f6eAAA\u8ba4\u8bc1\u673a\u5236<\/p>\n<p>[Huawei-ui-vty0-4] user privilege level 15 \/\/ \u914d\u7f6e\u8ba4\u8bc1\u7ea7\u522b<\/p>\n<p>[Huawei-ui-vty0-4] protocol inbound telnet \/\/ \u914d\u7f6eTelnet\u534f\u8bae<\/p>\n<p>[Huawei-ui-vty0-4] quit \/\/ \u9000\u51fa\u7cfb\u7edf\u89c6\u56fe<\/p>\n<p># &#8212;-\u914d\u7f6e\u7ec8\u7aefIP\u5730\u5740&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>[Huawei] interface Vlanif 1<\/p>\n<p>[Huawei-Vlanif1] ip address 192.168.10.10 255.255.255.0<\/p>\n<p>[Huawei-Vlanif1] quit<\/p>\n<p>&lt;Huawei&gt; save<\/p>\n<p>\u914d\u7f6e\u4ea4\u6362\u673a\u8fdc\u7a0b\u767b\u9646\u9700\u8981\u6ce8\u610f,\u4ea4\u6362\u673a\u63a5\u53e3\u4e0d\u5141\u8bb8\u914d\u7f6eIP\u5730\u5740,\u6211\u4eec\u53ea\u80fd\u5728\u865a\u62dfVLAN\u63a5\u53e3\u4e2d\u914d\u7f6eIP\u5730\u5740\u624d\u53ef\u4ee5\u4f7f\u7528\u8fdc\u7a0b\u767b\u9646\u529f\u80fd.<\/p>\n<p>&nbsp;<\/p>\n<h3>\u4ea4\u6362\u673a\u5e38\u7528\u53c2\u6570<\/h3>\n<p><strong>\u57fa\u672c\u914d\u7f6e\u547d\u4ee4:<\/strong>\u00a0\u4ea4\u6362\u673a\u4e0e\u8def\u7531\u5668\u7684\u57fa\u672c\u67e5\u8be2\u6307\u4ee4.<\/p>\n<p>[Huawei] display current-configuration \/\/ \u663e\u793a\u5f53\u524d\u751f\u6548\u7684\u914d\u7f6e<\/p>\n<p>[Huawei] display saved-configuration \/\/ \u663e\u793aflash\u4e2d\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>[Huawei] reset saved-configuration \/\/ \u6aab\u9664\u65e7\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>[Huawei] reboot \/\/ \u4ea4\u6362\u673a\u91cd\u542f<\/p>\n<p>[Huawei] display version \/\/ \u663e\u793a\u7cfb\u7edf\u7248\u672c\u4fe1\u606f<\/p>\n<p>[Huawei] sysname \/\/ \u4ea4\u6362\u673a\u547d\u540d<\/p>\n<p><strong>\u7528\u6237\u89c6\u56fe:<\/strong>\u00a0\u521a\u5f00\u59cb\u767b\u5165\u4ea4\u6362\u673a\u65f6\u7684\u89c6\u56fe,\u4e00\u822c\u770b\u5230\u7684\u662f\u5c16\u62ec\u53f7&lt;&gt;\u8868\u793a\u7528\u6237\u89c6\u56fe.<\/p>\n<p>&lt;Huawei&gt; save \/\/ \u914d\u7f6e\u5b8c\u6210\u4fdd\u5b58\u914d\u7f6e<\/p>\n<p>&lt;Huawei&gt; system-view \/\/ \u8fdb\u5165\u7cfb\u7edf\u89c6\u56fe\u7684\u547d\u4ee4<\/p>\n<p>&lt;Huawei&gt; clock timezone \/\/ \u8bbe\u7f6e\u65f6\u533a<\/p>\n<p>&lt;Huawei&gt; clock datetime 22:12:00 2019-04-01 \/\/ \u8bbe\u7f6e\u4ea4\u6362\u673a\u7684\u65f6\u95f4<\/p>\n<p><strong>\u7cfb\u7edf\u89c6\u56fe:<\/strong>\u00a0\u5728\u7528\u6237\u89c6\u56fe\u4e0b\u8f93\u5165system-view\u540e\u8fdb\u5165\u7cfb\u7edf\u89c6\u56fe,\u4e00\u822c\u4e3a\u65b9\u62ec\u53f7[]\u8868\u793a\u7cfb\u7edf\u89c6\u56fe.<\/p>\n<p>[Huawei] display current-configuration \/\/ \u663e\u793a\u5f53\u524d\u914d\u7f6e<\/p>\n<p>[Huawei] user-interface maximum-vty 15 \/\/ \u914d\u7f6evty\u6700\u5927\u8fde\u63a5\u6570<\/p>\n<p>[Huawei] user-interface vty 0 14 \/\/ \u8fdb\u5165vty\u7528\u6237\u754c\u9762\u89c6\u56fe<\/p>\n<p>[Huawei] user privilege level 2 \/\/ \u8bbe\u7f6evty\u767b\u5165\u7684\u7528\u6237\u7b49\u7ea7\u4e3a2(\u914d\u7f6e\u7528\u6237\u7ea7\u522b)<\/p>\n<p>[Huawei] authentication-mode aaa \/\/ \u8bbe\u7f6evty\u767b\u5165\u65f6\u7684\u9a8c\u8bc1\u6a21\u5f0f\u4e3a\u7528\u6237\u540d\u548c\u5bc6\u7801\u9a8c\u8bc1<\/p>\n<p><strong>\u7aef\u53e3\u914d\u7f6e:<\/strong>\u00a0\u5e38\u7528\u7684\u7aef\u53e3\u914d\u7f6e\u547d\u4ee4\u6574\u7406.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] interface Gig<\/p>\n<p>[Huawei] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9\u4e00\u4e2a\u7aef\u53e3<\/p>\n<p>[Huawei] duplex {half|full|auto} \/\/ \u914d\u7f6e\u7aef\u53e3\u5de5\u4f5c\u72b6\u6001<\/p>\n<p>[Huawei] speed {10|100|auto} \/\/ \u914d\u7f6e\u7aef\u53e3\u5de5\u4f5c\u901f\u7387<\/p>\n<p>[Huawei] flow-control \/\/ \u914d\u7f6e\u7aef\u53e3\u6d41\u63a7<\/p>\n<p>[Huawei] mdi {across|auto|normal} \/\/ \u914d\u7f6e\u7aef\u53e3\u5e73\u63a5\u626d\u63a5<\/p>\n<p>[Huawei] port link-type {trunk|access|hybrid} \/\/ \u8bbe\u7f6e\u7aef\u53e3\u5de5\u4f5c\u6a21\u5f0f<\/p>\n<p>[Huawei] undo shutdown \/\/ \u6fc0\u6d3b\u7aef\u53e3<\/p>\n<p>[Huawei] quit \/\/ \u9000\u51fa\u7cfb\u7edf\u89c6\u56fe<\/p>\n<p><strong>\u6279\u91cf\u914d\u7f6e\u7aef\u53e3:<\/strong>\u00a0\u901a\u8fc7\u547d\u4ee4\u6279\u91cf\u7684\u9009\u62e9\u4e00\u4e9b\u4ea4\u6362\u673a\u6216\u8def\u7531\u5668\u7684\u63a5\u53e3.<\/p>\n<p>[Huawei] vlan batch 10 20 \/\/ \u521b\u5efavlan10\u548cvlan20<\/p>\n<p>[Huawei] port-group group-member Gig0\/0\/1 to Gig0\/0\/10 \/\/ \u9009\u62e91-10\u53f7\u7aef\u53e3<\/p>\n<p>[Huawei] port link-type access \/\/ \u914d\u7f6e\u6210access\u6a21\u5f0f<\/p>\n<p>[Huawei] port default vlan 10 \/\/ \u5e94\u7528\u5230vlan10<\/p>\n<p><strong>\u6e05\u9664\u7aef\u53e3\u72b6\u6001:<\/strong>\u00a0\u6e05\u9664\u67d0\u4e2a\u7aef\u53e3\u7684\u914d\u7f6e,\u7528\u4e8e\u521d\u59cb\u5316\u7aef\u53e3.<\/p>\n<p>[Huawei] interface Gigabitethernet 0\/0\/1<\/p>\n<p>[Huawei] clear configuration this<\/p>\n<p>[Huawei] undo shutdown<\/p>\n<p>[Huawei] interface gigabitethernet 0\/0\/3<\/p>\n<p>[Huawei] undo port default vlan \/\/access \u6a21\u5f0f\u7684\u7aef\u53e3<\/p>\n<p>[Huawei] undo port link-type<\/p>\n<p>[Huawei] undo port hybrid pvid vlan vlanid \/\/hybrid \u6a21\u5f0f\u7684\u7aef\u53e3<\/p>\n<p>[Huawei] undo port hybrid untagged vlan vlanid<\/p>\n<p>[Huawei] undo port hybrid tagged vlan vlanid<\/p>\n<p>[Huawei] undo port trunk pvid vlan \/\/trunk \u6a21\u5f0f\u7684\u7aef\u53e3<\/p>\n<p>[Huawei] undo port trunk allow-pass vlan vlanid<\/p>\n<p>[Huawei] undo port link-type<\/p>\n<p>&nbsp;<\/p>\n<h3>\u4ea4\u6362\u673a\u5b9e\u73b0VLAN<\/h3>\n<p>VLAN(Virtual Local Area Network),\u4e2d\u6587\u540d\u4e3a\u865a\u62df\u5c40\u57df\u7f51,\u662f\u4e00\u79cd\u4f7f\u7528\u4ea4\u6362\u673a\u5c06\u5c40\u57df\u7f51\u5185\u7684\u8bbe\u5907\u5728\u903b\u8f91\u4e0a\u5212\u5206\u6210\u4e00\u4e2a\u4e2a\u7f51\u6bb5\u7684\u6280\u672f,\u5373\u5728\u7269\u7406\u7f51\u7edc\u4e0a\u8fdb\u4e00\u6b65\u5212\u5206\u903b\u8f91\u7f51\u7edc,VLAN\u53ef\u4ee5\u7a81\u7834\u5730\u7406\u4f4d\u7f6e\u7684\u9650\u5236,\u5b8c\u5168\u57fa\u4e8e\u5b9e\u9645\u7ba1\u7406\u9700\u8981\u6765\u5212\u5206\u7f51\u7edc,\u4f8b\u5982\u5728\u5355\u4e2a\u4ea4\u6362\u673a\u5185\u5212\u5206\u4e3a\u4e0d\u540c\u7684\u533a\u57df,\u4e0d\u540c\u533a\u57df\u4e4b\u95f4\u65e0\u6cd5\u4e92\u76f8\u901a\u4fe1,\u6765\u5b9e\u73b0\u76f8\u4e92\u9694\u79bb.<\/p>\n<p>VLAN\u5177\u6709\u4e0e\u666e\u901a\u5c40\u57df\u7f51\u76f8\u540c\u7684\u5c5e\u6027,\u7b2c\u4e8c\u5c42\u7684\u5355\u64ad,\u591a\u64ad\u548c\u5e7f\u64ad\u5e27\u53ea\u80fd\u5728\u76f8\u540c\u7684VLAN\u5185\u8f6c\u53d1,\u6269\u6563,\u800c\u4e0d\u4f1a\u76f4\u63a5\u8fdb\u5165\u5176\u4ed6VLAN\u4e2d,\u56e0\u6b64\u540c\u4e00\u4e2aVLAN\u5185\u7684\u4e3b\u673a\u5373\u4f7f\u4f4d\u4e8e\u4e0d\u540c\u7684\u4ea4\u6362\u673a\u4e0a,\u4e5f\u53ef\u4ee5\u4e92\u76f8\u8bbf\u95ee,\u800c\u4e0d\u662f\u540c\u4e00VLAN\u7684\u4e3b\u673a,\u5373\u4f7f\u8fde\u63a5\u5728\u540c\u4e00\u4ea4\u6362\u673a\u4e0a,\u4e5f\u65e0\u6cd5\u901a\u8fc7\u6570\u636e\u94fe\u8def\u5c42\u4e92\u76f8\u8bbf\u95ee.\u5982\u679c\u4e00\u4e2aVLAN\u5185\u7684\u4e3b\u673a\u60f3\u8bbf\u95ee\u53e6\u4e00\u4e2aVLAN\u5185\u7684\u4e3b\u673a,\u5fc5\u987b\u901a\u8fc7\u4e00\u4e2a\u4e09\u5c42\u8bbe\u5907,\u5982\u8def\u7531\u5668\u6216\u4e09\u5c42\u4ea4\u6362\u673a\u5b9e\u73b0\u901a\u4fe1.<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u5355\u4ea4\u6362\u673a\u5b9e\u73b0VLAN\u25c6<\/h3>\n<p>\u5982\u524d\u6240\u8ff0,\u57fa\u4e8e\u7aef\u53e3\u7684VLAN\u5c5e\u4e8e\u9759\u6001VLAN,\u5b83\u662f\u5212\u5206\u7f51\u7edc\u6700\u7b80\u5355,\u6700\u6709\u6548\u548c\u6700\u5e38\u7528\u7684\u65b9\u6cd5,\u4e0b\u9762\u5c06\u5728\u5355\u53f0\u4ea4\u6362\u673a\u4e0a\u914d\u7f6e\u9759\u6001VLAN,\u6765\u5b9e\u73b0\u4e24\u4e2a\u7f51\u6bb5\u7684\u6570\u636e\u9694\u79bb,\u4ee5\u4e0b\u5b9e\u9a8c\u662f\u4e00\u79cd\u7f51\u7edc\u62d3\u6251\u4e2d\u6700\u7b80\u5355\u7684\u62d3\u6251\u7ed3\u6784\u56fe,\u9002\u5408\u4e8e\u5c0f\u578b\u529e\u516c\u7f51\u7edc,\u5176\u5b9e\u9a8c\u62d3\u6251\u56fe\u5982\u4e0b.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1053\" height=\"406\" class=\"wp-image-2555\" src=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-18.jpeg\" alt=\"Diagram\n\nDescription automatically generated\" srcset=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-18.jpeg 1053w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-18-300x116.jpeg 300w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-18-1024x395.jpeg 1024w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-18-768x296.jpeg 768w\" sizes=\"auto, (max-width: 1053px) 100vw, 1053px\" \/><\/p>\n<p><strong>\u521b\u5efaVLAN\u533a\u57df:<\/strong>\u00a0\u521b\u5efa\u4e24\u4e2aVLAN\u533a\u57df,\u5206\u522b\u4e3avlan10\u548cvlan20\u7528\u6765\u4ee3\u8868\u4e24\u4e2a\u90e8\u95e8,\u547d\u4ee4\u5982\u4e0b.<\/p>\n<p>&lt;Huawei&gt;system-view \/\/ \u8fdb\u5165\u7cfb\u7edf\u89c6\u56fe\u6a21\u5f0f<\/p>\n<p>[Huawei] vlan 10 \/\/ \u521b\u5efaVLAN10<\/p>\n<p>[Huawei-vlan10] quit<\/p>\n<p>[Huawei] vlan 20 \/\/ \u521b\u5efaVLAN20<\/p>\n<p>[Huawei-vlan20] quit<\/p>\n<p>[Huawei] display vlan \/\/ \u663e\u793a\u5f53\u524dVLAN\u60c5\u51b5<\/p>\n<p>VID Status Property MAC-LRN Statistics Description<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1 enable default enable disable VLAN 0001<\/p>\n<p>10 enable default enable disable VLAN 0010<\/p>\n<p>20 enable default enable disable VLAN 0020<\/p>\n<p>[Huawei] quit<\/p>\n<p>&lt;Huawei&gt; save \/\/ \u4fdd\u5b58\u66f4\u6539<\/p>\n<p><strong>\u6279\u91cf\u6dfb\u52a0VLAN:<\/strong>\u00a0\u63a5\u7740\u5c06PC1-\u81f3-&gt;PC3\u6279\u91cf\u6dfb\u52a0\u5230VLAN10\u8fd9\u4e2a\u533a\u57df\u5185.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] port-group group-member GigabitEthernet 0\/0\/1 to GigabitEthernet 0\/0\/3<\/p>\n<p>[Huawei-port-group] port link-type access<\/p>\n<p>[Huawei-port-group] port default vlan 10<\/p>\n<p>[Huawei-port-group] display vlan<\/p>\n<p>VID Type Ports<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>10 common UT:GE0\/0\/1(U) GE0\/0\/2(U) GE0\/0\/3(U)<\/p>\n<p>20 common<\/p>\n<p>VID Status Property MAC-LRN Statistics Description<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1 enable default enable disable VLAN 0001<\/p>\n<p>10 enable default enable disable VLAN 0010<\/p>\n<p>20 enable default enable disable VLAN 0020<\/p>\n<p>undo port link-type<\/p>\n<p>undo port default vlan<\/p>\n<p><strong>\u5355\u72ec\u6dfb\u52a0VLAN:<\/strong>\u00a0\u63a5\u7740\u5c06PC4-\u81f3-&gt;PC5\u5355\u72ec\u6dfb\u52a0\u5230VLAN20\u8fd9\u4e2a\u533a\u57df\u5185.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] interface GigabitEthernet 0\/0\/4<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/4] port link-type access<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/4] port default vlan 20<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/4] quit<\/p>\n<p>[Huawei] interface GigabitEthernet 0\/0\/5<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/5] port link-type access<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/5] port default vlan 20<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/5] quit<\/p>\n<p>[Huawei-port-group] display vlan<\/p>\n<p>10 common UT:GE0\/0\/1(U) GE0\/0\/2(U) GE0\/0\/3(U)<\/p>\n<p>20 common UT:GE0\/0\/4(U) GE0\/0\/5(U)<\/p>\n<p>VID Status Property MAC-LRN Statistics Description<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1 enable default enable disable VLAN 0001<\/p>\n<p>10 enable default enable disable VLAN 0010<\/p>\n<p>20 enable default enable disable VLAN 0020<\/p>\n<p><strong>\u6d4b\u8bd5\u73af\u8282:<\/strong>\u00a0\u6700\u540e\u5206\u522b\u7ed9\u4e94\u53f0\u8bbe\u5907\u914d\u7f6e\u597dIP\u5730\u5740,\u5e76\u901a\u8fc7ping\u547d\u4ee4\u6d4b\u8bd5\u8054\u901a\u6027.<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u5ba2\u6237\u4e3b\u673aIP\u5730\u5740+\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[\u4e3b\u673a\u540d] [\u4e3b\u673aIP] [\u5b50\u7f51]<\/p>\n<p>PC0 192.168.1.1 24<\/p>\n<p>PC1 192.168.1.2 24<\/p>\n<p>PC2 192.168.1.3 24<\/p>\n<p>PC3 192.168.1.4 24<\/p>\n<p>PC4 192.168.1.5 24<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u597d\u540e\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>C:\\&gt;ping 192.168.1.1<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.1.2<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.1.4<\/p>\n<p>error<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u8de8\u4ea4\u6362\u673a\u5b9e\u73b0VLAN\u25c6<\/h3>\n<p>\u5728\u5b9e\u9645\u7684\u5de5\u4f5c\u73af\u5883\u4e2d,\u53ea\u5728\u4e00\u53f0\u4ea4\u6362\u673a\u4e0a\u5b9e\u73b0VLAN\u662f\u8fdc\u8fdc\u4e0d\u591f\u7684,\u901a\u5e38\u9700\u8981\u8de8\u8d8a\u591a\u53f0\u4ea4\u6362\u673a\u5b9e\u73b0VLAN\u5212\u5206\u7f51\u6bb5,\u534e\u4e3a\u4ea4\u6362\u673a\u901a\u8fc7\u4f7f\u7528Trunk\u5e72\u9053\u7aef\u53e3\u7684\u65b9\u5f0f\u5b9e\u73b0\u591a\u53f0\u4ea4\u6362\u673a\u6570\u636e\u5171\u4eab,\u5e76\u5b9e\u73b0\u8de8\u4ea4\u6362\u673a\u4e0a\u7684\u540c\u4e00\u4e2aVLAN\u4e4b\u95f4\u7684\u6570\u636e\u901a\u4fe1,\u5176\u62d3\u6251\u7ed3\u6784\u56fe\u5982\u4e0b.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1010\" height=\"533\" class=\"wp-image-2556\" src=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-19.jpeg\" alt=\"Diagram\n\nDescription automatically generated\" srcset=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-19.jpeg 1010w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-19-300x158.jpeg 300w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-19-768x405.jpeg 768w\" sizes=\"auto, (max-width: 1010px) 100vw, 1010px\" \/><\/p>\n<p><strong>\u5f00\u542f\u4e24\u53f0\u4ea4\u6362\u673a:<\/strong>\u00a0\u5206\u522b\u5f00\u542f\u4e24\u53f0\u4ea4\u6362\u673a\u7684\u7aef\u53e3,\u8fd9\u91cc\u6fc0\u6d3bgit 0\/0\/1 &#8211; 0\/0\/3\u7aef\u53e3.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei]sysname LSW1<\/p>\n<p>[LSW1] clear configuration int gi 0\/0\/1 \/\/ \u6e05\u7a7a\u63a5\u53e3\u914d\u7f6e<\/p>\n<p>[LSW1] port-group group-member Gig0\/0\/1 to Gig0\/0\/3 \/\/ \u9009\u62e9Gig1-Gig3\u53f7\u63a5\u53e3<\/p>\n<p>[LSW1-port-group] undo shutdown \/\/ \u5f00\u542f\u63a5\u53e3\u9009\u9879<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei]sysname LSW2<\/p>\n<p>[LSW2] clear configuration int gi 0\/0\/1 \/\/ \u6e05\u7a7a\u63a5\u53e3\u914d\u7f6e<\/p>\n<p>[LSW2]port-group group-member Gig0\/0\/1 to Gig0\/0\/3 \/\/ \u9009\u62e9Gig1-Gig3\u53f7\u63a5\u53e3<\/p>\n<p>[LSW2-port-group]undo shutdown \/\/ \u5f00\u542f\u63a5\u53e3\u9009\u9879<\/p>\n<p><strong>\u914d\u7f6eTrunk\u63a5\u53e3(\u4e24\u53f0):<\/strong>\u00a0\u63a5\u4e0b\u6765\u5728\u4ea4\u6362\u673a\u4e0a\u914d\u7f6eGig0\/0\/1\u63a5\u53e3\u4e3aTrunk\u5e72\u9053\u901a\u4fe1\u63a5\u53e3,\u8fd9\u91cc\u4e24\u53f0\u90fd\u9700\u8981\u914d\u7f6e.<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;LSW1&gt; system-view<\/p>\n<p>[LSW1] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9\u4e00\u4e2a\u63a5\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1]port link-type trunk \/\/ \u5c06\u8be5\u63a5\u53e3\u914d\u7f6e\u4e3atrunk\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1]port trunk allow-pass vlan all \/\/ \u5b9a\u4e49trunk\u5141\u8bb8vlan\u901a\u8fc7<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1]display this<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW2&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;LSW2&gt; system-view<\/p>\n<p>[LSW2] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9\u4e00\u4e2a\u63a5\u53e3<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1]port link-type trunk \/\/ \u5c06\u8be5\u63a5\u53e3\u914d\u7f6e\u4e3atrunk\u53e3<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1]port trunk allow-pass vlan all \/\/ \u5b9a\u4e49trunk\u5141\u8bb8vlan\u901a\u8fc7<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1]display this<\/p>\n<p><strong>\u914d\u7f6eVLAN(\u4e24\u53f0):<\/strong>\u00a0\u5206\u522b\u914d\u7f6e\u4e24\u53f0\u4ea4\u6362\u673aVLAN10\u548cVLAN20\u63a5\u53e3,\u5e76\u5c06PC1-PC2\u52a0\u5165VLAN10,PC3-PC4\u52a0\u5165VLAN20.<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;LSW1&gt;system-view \/\/ \u8fdb\u5165\u7cfb\u7edf\u89c6\u56fe\u6a21\u5f0f<\/p>\n<p>[LSW1] vlan batch 10 20 \/\/ \u521b\u5efavlan10,vlan20<\/p>\n<p>[LSW1] interface Gig0\/0\/2 \/\/ \u8fdb\u5165\u7b2c2\u4e2a\u4e1a\u52a1\u7f51\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] port link-type access \/\/ \u5f00\u542f\u63a5\u53e3\u6a21\u5f0f\u4e3aaccess<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] port default vlan 10 \/\/ \u5c06\u4ee5\u4e0a\u63a5\u53e3\u52a0\u5165\u5230vlan10<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] quit<\/p>\n<p>[LSW1] interface Gig0\/0\/3 \/\/\u8fdb\u5165\u7b2c3\u4e2a\u4e1a\u52a1\u7f51\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/3] port link-type access \/\/ \u5f00\u542f\u63a5\u53e3\u6a21\u5f0f\u4e3aaccess<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/3] port default vlan 20 \/\/ \u5c06\u4ee5\u4e0a\u63a5\u53e3\u52a0\u5165\u5230vlan20<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW2&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;LSW2&gt;system-view \/\/ \u8fdb\u5165\u7cfb\u7edf\u89c6\u56fe\u6a21\u5f0f<\/p>\n<p>[LSW2] vlan batch 10 20 \/\/ \u521b\u5efavlan10,vlan20<\/p>\n<p>[LSW2] interface Gig0\/0\/2 \/\/ \u8fdb\u5165\u7b2c2\u4e2a\u4e1a\u52a1\u7f51\u53e3<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] port link-type access \/\/ \u5f00\u542f\u63a5\u53e3\u6a21\u5f0f\u4e3aaccess<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] port default vlan 10 \/\/ \u5c06\u4ee5\u4e0a\u63a5\u53e3\u52a0\u5165\u5230vlan10<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] quit<\/p>\n<p>[LSW2] interface Gig0\/0\/3 \/\/\u8fdb\u5165\u7b2c3\u4e2a\u4e1a\u52a1\u7f51\u53e3<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/3] port link-type access \/\/ \u5f00\u542f\u63a5\u53e3\u6a21\u5f0f\u4e3aaccess<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/3] port default vlan 20 \/\/ \u5c06\u4ee5\u4e0a\u63a5\u53e3\u52a0\u5165\u5230vlan20<\/p>\n<p><strong>\u6d4b\u8bd5\u73af\u8282:<\/strong>\u00a0\u6700\u540e\u5206\u522b\u7ed9\u56db\u53f0\u8bbe\u5907\u914d\u7f6e\u597dIP\u5730\u5740,\u5e76\u901a\u8fc7ping\u547d\u4ee4\u6d4b\u8bd5\u8054\u901a\u6027.<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u5ba2\u6237\u4e3b\u673aIP\u5730\u5740+\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[\u4e3b\u673a\u540d] [\u4e3b\u673aIP] [\u5b50\u7f51]<\/p>\n<p>PC1 192.168.10.1 24<\/p>\n<p>PC2 192.168.10.2 24<\/p>\n<p>PC3 192.168.20.1 24<\/p>\n<p>PC4 192.168.20.2 24<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u597d\u540e\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>C:\\&gt;ping 192.168.10.1<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.20.1<\/p>\n<p>error<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u672c\u5f81VLAN\u5b9e\u73b0\u901a\u4fe1\u25c6<\/h3>\n<p>\u4e0b\u9762\u7684\u5b9e\u9a8c\u7528\u4e8e\u7406\u89e3\u672c\u5f81VLAN\u7684\u4e00\u4e9b\u7279\u6027,\u5e76\u65e0\u5b9e\u9645\u4f5c\u7528,\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u77e5\u9053\u5728\u601d\u79d1\u8bbe\u5907\u4e2d,\u9ed8\u8ba4\u89c4\u5b9a\u7684VLAN\u88ab\u79f0\u4f5c\u672c\u5f81VLAN,\u800c\u5728\u534e\u4e3a\u8bbe\u5907\u4e2d\u53eb\u505a\u9ed8\u8ba4VLAN(PIID),\u672c\u5f81VLAN\u7684\u4f5c\u7528\u662f\u7528\u6765\u7ed9\u62a5\u6587\u6253\u6807\u7b7e\u7684,\u5982\u679c\u6ca1\u6709\u6807\u7b7e\u5219\u8bf4\u660e\u9ed8\u8ba4\u5c31\u662fVLAN1,\u9ed8\u8ba4\u7684VLAN\u5728\u53d1\u9001\u6570\u636e\u5305\u65f6\u662f\u4e0d\u9700\u8981\u6253\u6807\u7b7e\u7684,\u534e\u4e3a\u7684\u8bbe\u5907\u5982\u679c\u4e0d\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c,\u5219\u9ed8\u8ba4\u672c\u5f81VLAN\u5c31\u662f1\u53f7.<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u9053\u9762\u8bd5\u9898,\u5176\u76ee\u7684\u662f\u53ea\u7ed9\u4f60\u4e24\u4e2a\u4ea4\u6362\u673a,\u4e14\u6709\u4e24\u53f0\u8de8\u7f51\u6bb5\u7684\u4e3b\u673a,\u8fd9\u4e24\u53f0\u4e3b\u673a\u5206\u522b\u5206\u5e03\u5728VLAN10\u548cVLAN20\u4e24\u4e2a\u865a\u62df\u5c40\u57df\u7f51\u4e2d,\u5728\u4e0d\u52a0\u8def\u7531\u8bbe\u5907\u7684\u60c5\u51b5\u4e0b,\u901a\u8fc7\u5176\u4ed6\u7684\u624b\u6bb5\u5b9e\u73b0\u4e24\u53f0\u8de8VLAN\u4e3b\u673a\u7684\u901a\u4fe1,\u5176\u5b9e\u5c31\u7528\u5230\u4e86\u672c\u5f81VLAN,\u62d3\u6251\u7ed3\u6784\u56fe\u5982\u4e0b\u6240\u793a:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"528\" class=\"wp-image-2557\" src=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-20.jpeg\" alt=\"Diagram\n\nDescription automatically generated\" srcset=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-20.jpeg 1000w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-20-300x158.jpeg 300w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-20-768x406.jpeg 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p><strong>\u914d\u7f6e\u4ea4\u6362\u673a(\u4e24\u53f0):<\/strong>\u00a0\u5206\u522b\u914d\u7f6e\u4e24\u53f0\u4ea4\u6362\u673a,\u5c06Gig0\/0\/1\u914d\u7f6e\u6210trunk\u63a5\u53e3,\u5c06Gig0\/0\/2\u914d\u7f6e\u6210access\u63a5\u53e3.<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] sysname LSW1 \/\/ \u5c06\u4ea4\u6362\u673a\u547d\u540d\u4e3aLSW1<\/p>\n<p>[LSW1] vlan 10 \/\/ \u521b\u5efaVlan10\u63a5\u53e3<\/p>\n<p>[LSW1-vlan10] quit<\/p>\n<p>[LSW1] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9Gig0\/0\/1\u63a5\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port link-type trunk \/\/ \u914d\u7f6e\u6210trunk<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port trunk allow-pass vlan all \/\/ \u5bf9\u6240\u6709VLAN\u751f\u6548<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] quit<\/p>\n<p>[LSW1] interface GigabitEthernet 0\/0\/2 \/\/ \u9009\u62e9Gig0\/0\/2\u63a5\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] port link-type access \/\/ \u914d\u7f6e\u6210access<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] port default vlan 10 \/\/ \u5c06\u6b64\u63a5\u53e3\u52a0\u5165vlan10<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/2] quit<\/p>\n<p>[LSW1] display port vlan active \/\/ \u67e5\u8be2vlan\u63a5\u53e3\u914d\u7f6e\u60c5\u51b5<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW2&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] sysname LSW2<\/p>\n<p>[LSW2] vlan 20<\/p>\n<p>[LSW2-vlan20] quit<\/p>\n<p>[LSW2] interface GigabitEthernet 0\/0\/1<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1] port link-type trunk<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1] port trunk allow-pass vlan all<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1] quit<\/p>\n<p>[LSW2] interface GigabitEthernet 0\/0\/2<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] port link-type access<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] port default vlan 20<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/2] quit<\/p>\n<p>[LSW2] display port vlan active<\/p>\n<p><strong>\u914d\u7f6e\u672c\u5f81VLAN(\u4e24\u53f0):<\/strong>\u00a0\u6700\u540e\u5206\u522b\u5728LSW1\u548cLSW2\u4e24\u53f0\u4ea4\u6362\u673a\u5206\u522b\u914d\u7f6e\u672c\u5f81VLAN.<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[LSW1] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9Gig0\/0\/1\u63a5\u53e3<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port trunk pvid vlan 10 \/\/ \u914d\u7f6e\u672c\u5f81vlan\u4e3avlan10<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] quit<\/p>\n<p># &#8212;-\u914d\u7f6e\u4ea4\u6362\u673aLSW2&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[LSW2] interface GigabitEthernet 0\/0\/1<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1] port trunk pvid vlan 20 \/\/ \u914d\u7f6e\u672c\u5f81vlan\u4e3avlan20<\/p>\n<p>[LSW2-GigabitEthernet0\/0\/1] quit<\/p>\n<p><strong>\u6d4b\u8bd5\u73af\u8282:<\/strong>\u00a0\u6700\u540e\u5206\u522b\u7ed9\u56db\u53f0\u8bbe\u5907\u914d\u7f6e\u597dIP\u5730\u5740,\u5e76\u901a\u8fc7ping\u547d\u4ee4\u6d4b\u8bd5\u8054\u901a\u6027.<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u5ba2\u6237\u4e3b\u673aIP\u5730\u5740+\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[\u4e3b\u673a\u540d] [\u4e3b\u673aIP] [\u5b50\u7f51] [VLAN]<\/p>\n<p>PC1 192.168.10.1 24 VLAN 10<\/p>\n<p>PC2 192.168.10.2 24 VLAN 20<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u597d\u540e\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>C:\\&gt;ping 192.168.10.1<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.10.2<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u4e09\u5c42\u4ea4\u6362\u5b9e\u73b0VLAN\u25c6<\/h3>\n<p>\u5982\u679c\u8981\u5728\u4e0d\u540c\u7684VLAN\u4e4b\u95f4\u8fdb\u884c\u6570\u636e\u901a\u4fe1,\u5219\u5fc5\u987b\u5229\u7528\u4e00\u4e2a\u5177\u6709\u4e09\u5c42(\u7f51\u7edc\u5c42)\u529f\u80fd\u7684\u8bbe\u5907\u6765\u5b9e\u73b0,\u76ee\u524d\u5e38\u7528\u7684\u8bbe\u5907\u6709\u4e09\u5c42\u4ea4\u6362\u673a\u548c\u8def\u7531\u5668,\u5728\u7ec4\u5efa\u5927\u578b\u7f51\u7edc\u65f6\u51fa\u4e8e\u5b89\u5168\u8003\u8651,\u5fc5\u987b\u628a\u5c40\u57df\u7f51\u6309\u7167\u529f\u80fd\u5212\u5206\u4e3a\u4e00\u4e2a\u4e2a\u5c0f\u7684\u5c40\u57df\u7f51,\u6765\u4fdd\u8bc1\u5b89\u5168\u6027,\u8fd9\u5c31\u4f7f\u5f97VLAN\u6280\u672f\u5f97\u4ee5\u8fd0\u7528,\u4f46\u6709\u65f6\u5019\u6211\u4eec\u8fd8\u9700\u8981\u5b9e\u73b0\u8de8\u7f51\u6bb5\u901a\u4fe1,\u5219\u4e09\u5c42\u4ea4\u6362\u673a\u53ef\u4ee5\u5b9e\u73b0\u6211\u4eec\u7684\u9700\u6c42.<\/p>\n<p>\u867d\u7136\u8def\u7531\u5668\u53ef\u4ee5\u5b8c\u6210\u4e0d\u540c\u7f51\u6bb5\u4e4b\u95f4\u8de8\u7f51\u6bb5\u901a\u4fe1,\u4f46\u662f\u7531\u4e8e\u8def\u7531\u5668\u7aef\u53e3\u6570\u91cf\u6709\u9650,\u4e14\u8def\u7531\u901f\u5ea6\u6162,\u56e0\u6b64\u4e09\u5c42\u4ea4\u6362\u673a\u5c31\u8bde\u751f\u4e86,\u4e09\u5c42\u4ea4\u6362\u673a\u662f\u6307\u5177\u6709\u8def\u7531\u529f\u80fd\u7684\u4ea4\u6362\u673a,\u4e5f\u5c31\u662f\u5b9e\u73b0\u4e86\u4e8c\u5c42\u7684\u8f6c\u53d1\u548c\u4e09\u5c42\u7684\u4ea4\u6362,\u5176\u4ef7\u683c\u4fbf\u5b9c\u6027\u4ef7\u6bd4\u9ad8,\u76ee\u524d\u662f\u7ec4\u7f51\u7684\u7edd\u4f73\u9009\u62e9,\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4e09\u5c42\u4ea4\u6362\u673a\u7ec4\u7f51\u5c0f\u6848\u4f8b,\u4e0d\u4ec5\u5b9e\u73b0\u4e86VLAN\u7684\u9694\u79bb,\u8fd8\u53ef\u4ee5\u5b9e\u73b0\u8de8\u7f51\u6bb5\u901a\u4fe1.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1100\" height=\"706\" class=\"wp-image-2558\" src=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-21.jpeg\" alt=\"Diagram\n\nDescription automatically generated\" srcset=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-21.jpeg 1100w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-21-300x193.jpeg 300w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-21-1024x657.jpeg 1024w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-21-768x493.jpeg 768w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p><strong>\u914d\u7f6e\u4e8c\u5c42\u4ea4\u6362(\u4e24\u53f0):<\/strong>\u00a0\u9996\u5148\u914d\u7f6e2\u4e2a\u4e8c\u5c42\u4ea4\u6362\u673a,\u5c06Ethernet 0\/0\/1\u914d\u6210Trunk\u63a5\u53e3,\u7136\u540e\u5c06Ethernet 0\/0\/2\u914d\u6210vlan10,Ethernet 0\/0\/3\u914d\u6210vlan20.<\/p>\n<p>&lt;Huawei&gt;system-view<\/p>\n<p>#&#8212;-\u914d\u7f6etrunk&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[Huawei] interface Ethernet 0\/0\/1 \/\/ \u9009\u62e9Eth0\/0\/1\u63a5\u53e3<\/p>\n<p>[Huawei-Ethernet0\/0\/1] port link-type trunk \/\/ \u914d\u7f6e\u6210Trunk\u6a21\u5f0f<\/p>\n<p>[Huawei-Ethernet0\/0\/1] port trunk allow-pass vlan all \/\/ \u9488\u5bf9\u6240\u6709VLAN<\/p>\n<p>[Huawei-Ethernet0\/0\/1] quit<\/p>\n<p>#&#8212;-\u914d\u7f6eVLAN&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[Huawei] vlan 10 \/\/ \u521b\u5efaVLAN10<\/p>\n<p>[Huawei-vlan10] quit<\/p>\n<p>[Huawei] vlan 20 \/\/ \u521b\u5efaVLAN20<\/p>\n<p>[Huawei-vlan20] quit<\/p>\n<p>#&#8212;-\u52a0\u5165VLAN\u7ec4&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>[Huawei] interface Ethernet 0\/0\/2 \/\/ \u9009\u62e92\u53f7\u7aef\u53e3<\/p>\n<p>[Huawei-Ethernet0\/0\/2] port link-type access \/\/ \u914d\u7f6e\u6210access\u6a21\u5f0f<\/p>\n<p>[Huawei-Ethernet0\/0\/2] port default vlan 10 \/\/ \u5c06\u5176\u52a0\u5165\u5230vlan10<\/p>\n<p>[Huawei-Ethernet0\/0\/2] quit<\/p>\n<p>[Huawei] interface Ethernet 0\/0\/3<\/p>\n<p>[Huawei-Ethernet0\/0\/3] port link-type access<\/p>\n<p>[Huawei-Ethernet0\/0\/3] port default vlan 20<\/p>\n<p>[Huawei-Ethernet0\/0\/3] quit<\/p>\n<p>[Huawei]display vlan \/\/ \u663e\u793aVLAN\u7aef\u53e3\u914d\u7f6e\u60c5\u51b5<\/p>\n<p>The total number of vlans is : 3<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>10 common UT:Eth0\/0\/2(U)<\/p>\n<p>20 common UT:Eth0\/0\/3(U)<\/p>\n<p>VID Status Property MAC-LRN Statistics Description<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1 enable default enable disable VLAN 0001<\/p>\n<p>10 enable default enable disable VLAN 0010<\/p>\n<p>20 enable default enable disable VLAN 0020<\/p>\n<p><strong>\u914d\u7f6e\u4e09\u5c42\u4ea4\u6362\u673a:<\/strong>\u00a0\u6dfb\u52a0vlan10,20\u7aef\u53e3,\u5e76\u5c06Gig0\/0\/1\u5230Gig0\/0\/2\u8bbe\u7f6e\u4e3atrunk\u6a21\u5f0f,\u7528\u4e8e\u4f9b\u4e8c\u5c42\u4ea4\u6362\u673a\u4ea4\u6362\u6570\u636e.<\/p>\n<p>#&#8212;-\u914d\u7f6eVLAN&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] sysname LSW1<\/p>\n<p>[LSW1] vlan batch 10 20 \/\/ \u5206\u522b\u521b\u5efa vlan 10,20<\/p>\n<p>#&#8212;-\u914d\u7f6e\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>[LSW1] interface GigabitEthernet 0\/0\/1<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port link-type trunk<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port trunk allow-pass vlan all<\/p>\n<p>[LSW1]interface GigabitEthernet 0\/0\/2<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port link-type trunk<\/p>\n<p>[LSW1-GigabitEthernet0\/0\/1] port trunk allow-pass vlan all<\/p>\n<p>[LSW1] display vlan<\/p>\n<p><strong>\u914d\u7f6e\u4e09\u5c42\u4ea4\u6362\u7f51\u5173:<\/strong>\u00a0\u5f00\u542fSVI\u8def\u7531\u529f\u80fd,\u5206\u522b\u4e3avlan 10 \u548c vlan 20\u00a0\u914d\u7f6e\u597d\u7f51\u5173\u5730\u5740.<\/p>\n<p>[LSW1] interface vlanif 10 \/\/ \u521b\u5efa\u4ea4\u6362\u673a\u865a\u62df\u63a5\u53e3<\/p>\n<p>[LSW1] ip add 192.168.10.1 24 \/\/ \u914d\u7f6eip\u5730\u5740<\/p>\n<p>[LSW1] interface vlanif 20 \/\/ \u521b\u5efa\u4ea4\u6362\u673a\u865a\u62df\u63a5\u53e3<\/p>\n<p>[LSW1] ip add 192.168.20.1 24 \/\/ \u914d\u7f6eip\u5730\u5740<\/p>\n<p>[LSW1] display ip interface brief \/\/ \u663e\u793a\u63a5\u53e3<\/p>\n<p>[LSW1] display ip routing-table \/\/ \u663e\u793a\u8def\u7531\u8868<\/p>\n<p><strong>\u5ba2\u6237\u673a\u914d\u7f6e\u7f51\u5173:<\/strong>\u00a0\u7ed9\u6bcf\u4e2a\u5ba2\u6237\u673a\u914d\u7f6e\u597dIP\u5730\u5740\u548c\u7f51\u5173\u53c2\u6570,\u5e76\u6d4b\u8bd5\u8fde\u901a\u6027,\u6210\u529f\u540e\u5219\u540cVLAN\u56db\u4e2aIP\u90fd\u80fd\u4e92\u76f8PING\u901a.<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u5ba2\u6237\u4e3b\u673aIP\u5730\u5740+\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[\u4e3b\u673a\u540d] [\u4e3b\u673aIP] [\u7f51\u5173]<\/p>\n<p>PC1 192.168.10.2 192.168.10.1<\/p>\n<p>PC2 192.168.20.2 192.168.20.1<\/p>\n<p>PC3 192.168.10.3 192.168.10.1<\/p>\n<p>PC4 192.168.20.3 192.168.20.1<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u597d\u540e\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>C:\\&gt;ping 192.168.10.1<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.10.2<\/p>\n<p>Reply from 192.168.10.2: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.10.3<\/p>\n<p>Reply from 192.168.10.3: bytes=32 time=1ms TTL=127<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u5355\u81c2\u8def\u7531\u5b9e\u73b0VLAN\u25c6<\/h3>\n<p>\u5355\u81c2\u8def\u7531\u662f\u6307\u5728\u8def\u7531\u5668\u7684\u4e00\u4e2a\u7269\u7406\u63a5\u53e3\u4e0a\u901a\u8fc7\u914d\u7f6e\u5b50\u63a5\u53e3\u7684\u65b9\u5f0f,\u5b9e\u73b0\u539f\u6765\u76f8\u4e92\u9694\u79bb\u7684\u4e0d\u540cVLAN\u4e4b\u95f4\u7684\u901a\u4fe1,\u5b50\u63a5\u53e3\u662f\u5728\u7269\u7406\u63a5\u53e3\u4e0a\u884d\u751f\u51fa\u6765\u7684\u903b\u8f91\u63a5\u53e3,\u4e00\u4e2a\u7269\u7406\u63a5\u53e3\u53ef\u4ee5\u884d\u751f\u51fa\u8bb8\u591a\u7684\u903b\u8f91\u63a5\u53e3.<\/p>\n<p>\u4e00\u822c\u8def\u7531\u5668\u7684\u7269\u7406\u63a5\u53e3\u6570\u91cf\u6709\u9650,\u5982\u679c\u6bcf\u4e2aVLAN\u90fd\u4f7f\u7528\u4e00\u4e2a\u7269\u7406\u63a5\u53e3\u8fdb\u884c\u8fde\u63a5,\u5728\u7f51\u7edc\u4e2dVLAN\u6570\u91cf\u8f83\u591a\u7684\u60c5\u51b5\u4e0b\u9700\u8981\u4f7f\u7528\u591a\u53f0\u8def\u7531\u5668\u624d\u80fd\u5b9e\u73b0VLAN\u4e4b\u95f4\u7684\u901a\u4fe1,\u800c\u901a\u8fc7\u4f7f\u7528\u5b50\u63a5\u53e3\u53ef\u4ee5\u5728\u4e00\u4e2a\u7269\u7406\u63a5\u53e3\u4e0a\u5bb9\u7eb3\u66f4\u591a\u7684VLAN,\u4ece\u800c\u5f88\u597d\u7684\u89e3\u51b3\u4e86\u6b64\u95ee\u9898.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1100\" height=\"685\" class=\"wp-image-2559\" src=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-diagram-description-automatically-generate-1.jpeg\" alt=\"Chart, diagram\n\nDescription automatically generated with medium confidence\" srcset=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-diagram-description-automatically-generate-1.jpeg 1100w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-diagram-description-automatically-generate-1-300x187.jpeg 300w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-diagram-description-automatically-generate-1-1024x638.jpeg 1024w, https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-diagram-description-automatically-generate-1-768x478.jpeg 768w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p><strong>\u914d\u7f6e\u4ea4\u6362\u673a:<\/strong>\u00a0\u5728\u4ea4\u6362\u673a\u4e0a\u521b\u5efa\u865a\u62df\u5c40\u57df\u7f51vlan10\u548cvlan20,\u5e76\u5c06Gig0\/0\/2\u81f3Gig0\/0\/3\u7aef\u53e3\u52a0\u5165\u5230vlan10,\u7136\u540e\u5c06Gig0\/0\/4\u81f3Gig0\/0\/5\u7aef\u53e3\u52a0\u5165\u5230vlan20.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] vlan batch 10 20 \/\/ \u521b\u5efaVLAN10\u548cVLAN20<\/p>\n<p>[Huawei] port-group group-member Gig0\/0\/2 to Gig0\/0\/3 \/\/ \u9009\u62e9Gig2-3\u7aef\u53e3<\/p>\n<p>[Huawei-port-group] undo shutdown \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>[Huawei-port-group] port link-type access \/\/ \u914d\u7f6e\u6210access\u6a21\u5f0f<\/p>\n<p>[Huawei-port-group] port default vlan 10 \/\/ \u5c06\u7aef\u53e3\u52a0\u5165\u5230vlan 10<\/p>\n<p>[Huawei] port-group group-member Gig0\/0\/4 to Gig0\/0\/5<\/p>\n<p>[Huawei-port-group] undo shutdown<\/p>\n<p>[Huawei-port-group] port link-type access<\/p>\n<p>[Huawei-port-group] port default vlan 20<\/p>\n<p><strong>\u8bbe\u7f6eTrunk\u6a21\u5f0f:<\/strong>\u00a0\u5c06\u4ea4\u6362\u673a\u4e0e\u8def\u7531\u5668\u76f8\u8fde\u7684\u7aef\u53e3\u8bbe\u7f6e\u4e3aTrunk\u6a21\u5f0f,\u6b64\u5904\u8bbe\u7f6e\u4ea4\u6362\u673a\u7684Gig0\/0\/1\u53e3\u5c06\u5176\u8bbe\u7f6e\u4e3aTrunk\u5e72\u9053\u6a21\u5f0f.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] interface GigabitEthernet 0\/0\/1 \/\/ \u9009\u62e9Gig0\/0\/1\u63a5\u53e3<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/1] port link-type trunk \/\/ \u914d\u7f6e\u6210trunk\u6a21\u5f0f<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/1] port trunk allow-pass vlan all \/\/ \u5e94\u7528\u4e8e\u6240\u6709\u63a5\u53e3<\/p>\n<p>[Huawei-GigabitEthernet0\/0\/1] display this \/\/ \u663e\u793a\u914d\u7f6e\u7ed3\u679c<\/p>\n<p>#<\/p>\n<p>interface GigabitEthernet0\/0\/1<\/p>\n<p>port link-type trunk<\/p>\n<p>port trunk allow-pass vlan 2 to 4094<\/p>\n<p>#<\/p>\n<p><strong>\u914d\u7f6e\u8def\u7531\u5668\u5b50\u63a5\u53e3:<\/strong>\u00a0\u5728\u8def\u7531\u5668\u7684Ethernet0\/0\/0\u63a5\u53e3\u4e0a\u521b\u5efa\u903b\u8f91\u63a5\u53e3,\u5e76\u4f7f\u7528IEEE802.1Q\u534f\u8bae\u5c01\u88c5,\u6b64\u5904\u6211\u4eec\u521b\u5efa\u4e24\u4e2a\u5b50\u63a5\u53e3\u5373\u53ef.<\/p>\n<p>&lt;Huawei&gt; system-view<\/p>\n<p>[Huawei] sysname R1<\/p>\n<p>[R1] interface Ethernet 0\/0\/0.1 \/\/ \u521b\u5efa\u4e00\u4e2a\u5b50\u63a5\u53e3<\/p>\n<p>[R1-Ethernet0\/0\/0.1] ip add 192.168.10.1 24 \/\/ \u6307\u5b9a\u5b50\u63a5\u53e3ip\u5730\u5740<\/p>\n<p>[R1-Ethernet0\/0\/0.1] dot1q termination vid 10 \/\/ \u548cvlan10\u76f8\u5173\u8054<\/p>\n<p>[R1-Ethernet0\/0\/0.1] arp broadcast enable \/\/ \u5f00\u542farp\u5e7f\u64ad\u5305<\/p>\n<p>[R1] interface Ethernet 0\/0\/0.2 \/\/ \u521b\u5efa\u4e00\u4e2a\u5b50\u63a5\u53e3<\/p>\n<p>[R1-Ethernet0\/0\/0.1] ip add 192.168.20.1 24 \/\/ \u6307\u5b9a\u5b50\u63a5\u53e3ip\u5730\u5740<\/p>\n<p>[R1-Ethernet0\/0\/0.1] dot1q termination vid 20 \/\/ \u548cvlan10\u76f8\u5173\u8054<\/p>\n<p>[R1-Ethernet0\/0\/0.1] arp broadcast enable \/\/ \u5f00\u542farp\u5e7f\u64ad\u5305<\/p>\n<p>[R1-Ethernet0\/0\/0.1] quit<\/p>\n<p>[R1] display ip routing-table \/\/ \u67e5\u8be2\u8def\u7531\u8bb0\u5f55<\/p>\n<p><strong>\u5ba2\u6237\u673a\u914d\u7f6e\u7f51\u5173:<\/strong>\u00a0\u7ed9\u6bcf\u4e2a\u5ba2\u6237\u673a\u914d\u7f6e\u597dIP\u5730\u5740\u548c\u7f51\u5173\u53c2\u6570,\u5e76\u6d4b\u8bd5\u8fde\u901a\u6027.<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u5ba2\u6237\u4e3b\u673aIP\u5730\u5740+\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>[\u4e3b\u673a\u540d] [\u4e3b\u673aIP] [\u7f51\u5173]<\/p>\n<p>PC1 192.168.10.2 192.168.10.1<\/p>\n<p>PC2 192.168.10.3 192.168.10.1<\/p>\n<p>PC3 192.168.20.2 192.168.20.1<\/p>\n<p>PC4 192.168.20.3 192.168.20.1<\/p>\n<p>#&#8212;-\u8bbe\u7f6e\u597d\u540e\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>C:\\&gt;ping 192.168.10.2<\/p>\n<p>Reply from 192.168.10.2: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.10.3<\/p>\n<p>Reply from 192.168.10.3: bytes=32 time=1ms TTL=127<\/p>\n<p>C:\\&gt;ping 192.168.20.2<\/p>\n<p>error<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ea4\u6362\u673a\u662f\u4e00\u79cd\u4ea4\u6362\u5f0f\u96c6\u7ebf\u5668,\u5176\u57fa\u4e8eMAC\u5730\u5740\u8bc6\u522b,\u80fd\u5b8c\u6210\u5c01\u88c5\u8f6c\u53d1\u6570\u636e\u5305\u529f\u80fd\u7684\u7f51\u7edc\u8bbe\u5907.\u4ea4\u6362\u673a\u53ef\u4ee5\u5b66\u4e60MAC\u5730\u5740, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-2554","post","type-post","status-publish","format-standard","hentry","category-hw"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2554"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2554\/revisions"}],"predecessor-version":[{"id":2560,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2554\/revisions\/2560"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}