{"id":2520,"date":"2021-10-14T15:59:38","date_gmt":"2021-10-14T22:59:38","guid":{"rendered":"https:\/\/www.xh86.me\/?p=2520"},"modified":"2021-10-14T16:00:47","modified_gmt":"2021-10-14T23:00:47","slug":"%e6%80%9d%e7%a7%91%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=2520","title":{"rendered":"\u601d\u79d1\u4ea4\u6362\u673a\u914d\u7f6e\u7b14\u8bb0"},"content":{"rendered":"<p>\u4ea4\u6362\u673a(Switch)\u662f\u4e00\u79cd\u7528\u4e8e\u7535\u4fe1\u53f7\u8f6c\u53d1\u7684\u7f51\u7edc\u8bbe\u5907,\u5b83\u53ef\u4ee5\u4e3a\u63a5\u5165\u4ea4\u6362\u673a\u7684\u4efb\u610f\u4e24\u4e2a\u7f51\u7edc\u8282\u70b9\u63d0\u4f9b\u72ec\u4eab\u7684\u7535\u4fe1\u53f7\u901a\u8def,\u6700\u5e38\u89c1\u7684\u4ea4\u6362\u673a\u662f\u4ee5\u592a\u7f51\u4ea4\u6362\u673a,\u5176\u4ed6\u5e38\u89c1\u7684\u8fd8\u6709\u7535\u8bdd\u8bed\u97f3\u4ea4\u6362\u673a\u3001\u5149\u7ea4\u4ea4\u6362\u673a\u7b49,\u4ea4\u6362\u673a\u662f\u96c6\u7ebf\u5668\u7684\u5347\u7ea7\u66ff\u4ee3\u4ea7\u54c1,\u7406\u8bba\u4e0a\u8bb2\u4ea4\u6362\u673a\u5c31\u662f\u6309\u7167\u901a\u4fe1\u4e24\u7aef\u4f20\u8f93\u4fe1\u606f\u7684\u9700\u6c42,\u5c06\u9700\u8981\u7684\u4fe1\u606f\u53d1\u9001\u5230\u76ee\u6807\u8bbe\u5907\u4e0a\u7684\u7f51\u7edc\u7ec4\u4ef6.<\/p>\n<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<h2>\u4ea4\u6362\u673a\u7684\u521d\u59cb\u5316<\/h2>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u65b9\u5f0f\u5c06\u5bf9\u4ea4\u6362\u673a\u7684\u57fa\u672c\u914d\u7f6e,\u5305\u62ec\u914d\u7f6e\u4ea4\u6362\u673a\u4e3b\u673a\u540d,\u7279\u6743\u6a21\u5f0f\u5bc6\u7801,\u7ba1\u7406\u63a5\u53e3,IP\u5730\u5740\u7b49.<\/p>\n<p>1.\u9996\u5148\u767b\u9646\u601d\u79d1\u4ea4\u6362\u673a,\u5e76\u8fdb\u5165\u7279\u6743\u6a21\u5f0f,\u5e76\u914d\u7f6e\u597d\u4e3b\u673a\u540d\u79f0,\u6b64\u5904\u4ea4\u6362\u673a\u540d\u79f0\u914d\u7f6e\u4e3alyshark.<\/p>\n<p>Switch&gt; enable \/\/ \u8fdb\u5165\u7279\u6743\u6a21\u5f0f<\/p>\n<p>Switch# configure terminal \/\/ \u4f7f\u7528\u5168\u5c40\u914d\u7f6e\u6a21\u5f0f<\/p>\n<p>Switch(config)# hostname lyshark \/\/ \u914d\u7f6e\u4ea4\u6362\u673a\u540d\u79f0<\/p>\n<p>lyshark(config)#<\/p>\n<p>2.\u5f00\u542f0\u53f7\u6a21\u5757\u4e0b\u76841-3\u53f7\u63a5\u53e3,\u914d\u7f6e\u4ea4\u6362\u673a\u7aef\u53e3\u901f\u7387\u5e76\u542f\u7528\u6307\u5b9a\u7aef\u53e3.<\/p>\n<p>lyshark(config)# interface range fa0\/1-3 \/\/ \u9009\u62e9\u914d\u7f6e\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# speed 100 \/\/ \u914d\u7f6e\u6240\u9009\u7aef\u53e3\u7684\u901f\u7387<\/p>\n<p>lyshark(config-if-range)# no shutdown \/\/ \u5f00\u542f\u6240\u9009\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# exit \/\/ \u9000\u51fa\u6240\u9009\u7aef\u53e3<\/p>\n<p>3.\u914d\u7f6e\u4ea4\u6362\u673a\u865a\u62df\u7ba1\u7406\u63a5\u53e3\u7684\u540d\u79f0,IP\u5730\u5740\u548c\u5b50\u7f51\u63a9\u7801,\u5e76\u5f00\u542f\u7ba1\u7406\u63a5\u53e3,\u65b9\u4fbf\u8fdc\u7a0b\u7ef4\u62a4.<\/p>\n<p>lyshark(config)# interface vlan 1 \/\/ \u521b\u5efa\u865a\u62df\u63a5\u53e3vlan1\u5e76\u8fdb\u5165<\/p>\n<p>lyshark(config-if)# ip address 192.168.1.10 255.255.255.0 \/\/ \u914d\u7f6eIP\u548c\u5b50\u7f51\u63a9\u7801<\/p>\n<p>lyshark(config-if)# no shutdown \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>lyshark(config-if)# exit<\/p>\n<p>4.\u914d\u7f6e\u597d\u865a\u62df\u7ec8\u7aef\u4ee5\u53ca\u5bc6\u7801,\u5e76\u5141\u8bb8\u8fdc\u7a0bTelnet\u767b\u9646.<\/p>\n<p>lyshark(config)# line vty 0 2 \/\/ \u914d\u7f6e\u5e8f\u53f7\u4e3a0-2\u76843\u4e2a\u865a\u62df\u7ec8\u7aef<\/p>\n<p>lyshark(config-line)# password admin \/\/ \u914d\u7f6e\u865a\u62df\u7ec8\u7aef\u767b\u9646\u5bc6\u7801\u4e3aadmin<\/p>\n<p>lyshark(config-line)# login \/\/ \u5f00\u542f\u767b\u9646,\u5141\u8bb8\u8fdc\u7a0b\u767b\u9646<\/p>\n<p>lyshark(config-line)# exit<\/p>\n<p>\u82e5\u8981\u5173\u95ed\u865a\u62df\u7ec8\u7aef\u767b\u9646\u529f\u80fd,\u5219\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4,\u53d6\u6d88\u865a\u62df\u7ec8\u7aef\u7684\u767b\u9646.<\/p>\n<p>lyshark(config)# line vty 0 2 \/\/ \u9009\u62e9\u5e8f\u53f7\u4e3a0-2\u76843\u4e2a\u865a\u62df\u7ec8\u7aef<\/p>\n<p>lyshark(config-line)# no password \/\/ \u53d6\u6d88\u767b\u9646\u5bc6\u7801<\/p>\n<p>lyshark(config-line)# no login \/\/ \u8bbe\u7f6e\u4e3a\u4e0d\u5141\u8bb8\u8fdc\u7a0b\u767b\u9646<\/p>\n<p>lyshark(config-line)# exit<\/p>\n<p>5.\u5728\u5168\u5c40\u6a21\u5f0f\u4e0b\u914d\u7f6e\u7279\u6743\u5bc6\u7801,\u5982\u679c\u660e\u6587\u4e0e\u5bc6\u6587\u5bc6\u7801\u540c\u65f6\u914d\u7f6e,\u5219\u9ed8\u8ba4\u4f7f\u7528\u5bc6\u6587\u5bc6\u7801\u4e3a\u51c6.<\/p>\n<p>lyshark(config)# enable password 123123 \/\/ \u914d\u7f6e\u660e\u6587\u5bc6\u7801<\/p>\n<p>lyshark(config)# enable secret 123321 \/\/ \u914d\u7f6e\u5bc6\u6587\u5bc6\u7801<\/p>\n<p>lyshark(config)# exit<\/p>\n<p>6.\u5168\u90e8\u914d\u7f6e\u5b8c\u6210\u4ee5\u540e,\u53ef\u4ee5\u4f7f\u7528running-config(\u67e5\u770b\u5185\u5b58\u914d\u7f6e\u6570\u636e),\u4e5f\u53efstartup-config(\u67e5\u770bRAM\u5b58\u50a8\u5668\u914d\u7f6e).<\/p>\n<p>lyshark# show running-config \/\/ \u67e5\u770b\u4e34\u65f6\u914d\u7f6e\u6570\u636e<\/p>\n<p>lyshark# show startup-config \/\/ \u67e5\u770bRAM\u6c38\u4e45\u914d\u7f6e\u6570\u636e<\/p>\n<p>Building configuration&#8230;<\/p>\n<p>Current configuration : 1201 bytes<\/p>\n<p>!<\/p>\n<p>version 12.2 \/\/ \u4ea4\u6362\u673a\u7248\u672c<\/p>\n<p>hostname lyshark \/\/ \u4e3b\u673a\u540d\u79f0<\/p>\n<p>!<\/p>\n<p>enable secret 5 $1$mERr$vPfXBroDs2s.F.9FQ1Le20 \/\/ \u5bc6\u6587\u5bc6\u7801<\/p>\n<p>enable password 123123 \/\/ \u660e\u6587\u5bc6\u7801<\/p>\n<p>!<\/p>\n<p>interface Vlan1 \/\/ Vlan1 \u63a5\u53e3\u4fe1\u606f<\/p>\n<p>ip address 192.168.1.10 255.255.255.0 \/\/ Vlan1 \u7684\u7ba1\u7406\u63a5\u53e3\u5730\u5740<\/p>\n<p>!<\/p>\n<p>line con 0<\/p>\n<p>!<\/p>\n<p>line vty 0 2 \/\/ \u8fdc\u7a0b\u7ba1\u7406\u7ec8\u7aef<\/p>\n<p>password admin \/\/ \u7ec8\u7aef\u5bc6\u7801<\/p>\n<p>login<\/p>\n<p>end<\/p>\n<p>7.\u4ee5\u4e0a\u914d\u7f6e\u5185\u5bb9,\u5f53\u4ea4\u6362\u673a\u65ad\u7535\u540e\u6570\u636e\u4e5f\u5c06\u4f1a\u6e05\u7a7a,\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5bf9\u914d\u7f6e\u6570\u636e\u6c38\u4e45\u5b58\u50a8\u8d77\u6765.<\/p>\n<p>lyshark# write \/\/ \u5199\u5165\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>lyshark# erase startup-config \/\/ \u6e05\u7a7a\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>lyshark# reload \/\/ \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>8.\u901a\u8fc7telnet\u5ba2\u6237\u7aef,\u8fde\u63a5192.168.1.10\u8f93\u5165\u5bc6\u7801\u5373\u53ef\u767b\u9646\u4ea4\u6362\u673a.<\/p>\n<p>Trying 192.168.1.10 &#8230;Open<\/p>\n<p>User Access Verification<\/p>\n<p>Password:<\/p>\n<p>lyshark&gt;<\/p>\n<p>lyshark&gt;enable<\/p>\n<p>Password:<\/p>\n<p>lyshark#<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4ea4\u6362\u673a\u5e38\u7528\u53c2\u6570<\/h2>\n<p><strong>\u5e38\u7528\u67e5\u8be2\u547d\u4ee4:<\/strong><\/p>\n<p>lyshark# show hosts \/\/ \u67e5\u8be2\u4e3b\u673a\u8868<\/p>\n<p>lyshark# show ip interface \/\/ \u67e5\u770b\u7aef\u53e3IP\u914d\u7f6e\u4fe1\u606f<\/p>\n<p>lyshark# show history \/\/ \u67e5\u770b\u5386\u53f2\u8bb0\u5f55<\/p>\n<p>lyshark# show terminal \/\/ \u67e5\u770b\u7ec8\u7aef\u8bb0\u5f55\u5927\u5c0f<\/p>\n<p>lyshark# show version \/\/ \u67e5\u8be2\u4ea4\u6362\u673a\u7248\u672c<\/p>\n<p>lyshark# show running-config \/\/ \u663e\u793a\u6240\u6709\u7684\u914d\u7f6e<\/p>\n<p>lyshark# show interface \/\/ \u67e5\u8be2\u6240\u6709\u63a5\u53e3<\/p>\n<p><strong>\u7aef\u53e3\u9009\u62e9\u547d\u4ee4:<\/strong><\/p>\n<p>lyshark# configure terminal \/\/ \u8fdb\u5165\u7ec8\u7aef\u914d\u7f6e\u6a21\u5f0f<\/p>\n<p>lyshark(config)#<\/p>\n<p>lyshark(config)# interface fa0\/1 \/\/ \u9009\u62e90\u53f7\u6a21\u5757\u76841\u53f7\u7aef\u53e3<\/p>\n<p>lyshark(config-if)#<\/p>\n<p>lyshark(config-if)# exit<\/p>\n<p>lyshark(config)# interface range fa0\/1-5 \/\/ \u9009\u62e90\u53f7\u6a21\u5757\u76841-5\u53f7\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)#<\/p>\n<p><strong>\u914d\u7f6e\u7aef\u53e3\u63cf\u8ff0:<\/strong><\/p>\n<p>lyshark(config)# interface range fa0\/1-5<\/p>\n<p>lyshark(config-if-range)# description MyInterface<\/p>\n<p><strong>\u5f00\u542f\u914d\u7f6e\u7aef\u53e3:<\/strong><\/p>\n<p>lyshark# configure terminal \/\/ \u8fdb\u5165\u547d\u4ee4\u914d\u7f6e\u9875\u9762<\/p>\n<p>lyshark(config)# interface range fa0\/1-5 \/\/ \u9009\u62e9\u914d\u7f6e\u7684\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# switchport mode access \/\/ \u8bbe\u7f6e\u4e3a\u901a\u7528\u6a21\u5f0f<\/p>\n<p>lyshark(config-if-range)# speed 100 \/\/ \u8bbe\u7f6e\u7aef\u53e3\u901f\u7387<\/p>\n<p>lyshark(config-if-range)# duplex auto \/\/ \u8bbe\u7f6e\u5de5\u4f5c\u6a21\u5f0f<\/p>\n<p>lyshark(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u7aef\u53e3\u6a21\u5f0f:<\/strong><\/p>\n<p>lyshark# configure terminal<\/p>\n<p>lyshark(config)# interface fa0\/1<\/p>\n<p>lyshark(config-if)# switchport mode access \/\/ \u8bbe\u7f6e\u4e3a\u901a\u7528\u6a21\u5f0f<\/p>\n<p>lyshark(config-if)# switchport mode multi \/\/ \u8be5\u6a21\u5f0f\u5f88\u5c11\u7528<\/p>\n<p>lyshark(config-if)# switchport mode trunk \/\/ \u8bbe\u7f6e\u4e3a\u4ea4\u6362\u673a\u6a21\u5f0f<\/p>\n<p><strong>\u542f\u7528\/\u7981\u7528\u7aef\u53e3:<\/strong><\/p>\n<p>lyshark# configure terminal \/\/ \u8fdb\u5165\u547d\u4ee4\u914d\u7f6e\u6a21\u5f0f<\/p>\n<p>lyshark(config)# interface range fa0\/1-24 \/\/ \u9009\u62e91-24\u53e3<\/p>\n<p>lyshark(config-if-range)# shutdown \/\/ \u5173\u95ed\u6240\u6709\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# exit<\/p>\n<p>lyshark(config)# interface range Gig0\/1-2 \/\/ \u9009\u62e9\u9ad8\u901f\u901a\u4fe1\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# shutdown \/\/ \u5173\u95ed\u6240\u6709\u7aef\u53e3<\/p>\n<p>lyshark(config-if-range)# no shutdown \/\/ \u5f00\u542f\u6240\u6709\u7aef\u53e3<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4ea4\u6362\u673a\u5b9e\u73b0VLAN<\/h2>\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><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-3.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"457\" class=\"wp-image-2521\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-3.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Diagram Description automatically generated\"  sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/div><\/p>\n<p><strong>\u521d\u59cb\u5316\u914d\u7f6e:<\/strong>\u00a0\u521d\u59cb\u5316\u4ea4\u6362\u673a,\u5f00\u542f5\u4e2a\u4ea4\u6362\u53e3,\u5176\u4ed6\u4ea4\u6362\u53e3\u5173\u95ed\u4fdd\u8bc1\u5b89\u5168\u6027.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch0 \/\/ \u914d\u7f6e\u4e3b\u673a\u540d\u79f0<\/p>\n<p>Switch0(config)# interface range fa0\/1-5 \/\/ \u9009\u62e91-5\u53f7\u7aef\u53e3<\/p>\n<p>Switch0(config-if-range)# speed 100 \/\/ \u8bbe\u7f6e\u7aef\u53e3\u901f\u7387<\/p>\n<p>Switch0(config-if-range)# no shutdown \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>Switch0(config-if-range)# exit<\/p>\n<p><strong>\u521b\u5efaVLAN\u533a\u57df:<\/strong>\u00a0\u521b\u5efa\u4e24\u4e2aVLAN\u533a\u57df,\u5206\u522b\u547d\u540d\u4e3avlan10\u4e3aCaiWu\u90e8\u548cvlan20\u4e3aXiaoShou\u90e8\u4e24\u4e2a\u90e8\u95e8,\u547d\u4ee4\u5982\u4e0b.<\/p>\n<p>Switch0&gt; enable<\/p>\n<p>Switch0# configure terminal<\/p>\n<p>Switch0(config)# vlan 10 \/\/ \u5c06VLAN 10\u914d\u7f6e\u4e3aCaiWu\u90e8\u95e8<\/p>\n<p>Switch0(config-vlan)# name CaiWu<\/p>\n<p>Switch0(config-vlan)# exit<\/p>\n<p>Switch0(config)# vlan 20 \/\/ \u5c06VLAN 20\u914d\u7f6e\u4e3aXiaoShou\u90e8\u95e8<\/p>\n<p>Switch0(config-vlan)# name XiaoShou<\/p>\n<p>Switch0(config-vlan)# exit<\/p>\n<p><strong>\u6dfb\u52a0VLAN\u7aef\u53e3:<\/strong>\u00a0\u6307\u5b9a\u7aef\u53e3\u52a0\u5165\u5230\u65b0\u521b\u5efa\u7684VLAN\u4e2d,\u5c06fa0\/1-3\u53f7\u7aef\u53e3\u653e\u5230CaiWu,fa0\/4-5\u53f7\u7aef\u53e3\u653e\u5230XiaoShou\u91cc.<\/p>\n<p>Switch0(config)# interface range fa0\/1-3 \/\/ \u9009\u62e91-3\u53f7\u7aef\u53e3<\/p>\n<p>Switch0(config-if-range)# switchport mode access \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>Switch0(config-if-range)# switchport access vlan 10 \/\/ \u6307\u5b9a\u5c061-3\u53f7\u7aef\u53e3\u52a0\u5165\u5230vlan10<\/p>\n<p>Switch0(config-if-range)# exit<\/p>\n<p>Switch0(config)# interface range fa0\/4-5<\/p>\n<p>Switch0(config-if-range)# switchport mode access<\/p>\n<p>Switch0(config-if-range)# switchport access vlan 20 \/\/ \u6307\u5b9a\u5c064-5\u53f7\u7aef\u53e3\u52a0\u5165\u5230vlan20<\/p>\n<p>Switch0(config-if-range)# exit<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.10.2 192.168.10.254<\/p>\n<p>PC2 192.168.10.3 192.168.10.254<\/p>\n<p>PC3 192.168.20.1 192.168.20.254<\/p>\n<p>PC4 192.168.20.2 192.168.20.254<\/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>C:\\&gt;ping 192.168.10.3<\/p>\n<p>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/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,\u601d\u79d1\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><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-with.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"440\" class=\"wp-image-2522\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-with.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Diagram Description automatically generated with low confidence\"  sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/div><\/p>\n<p><strong>\u914d\u7f6e\u4e24\u53f0\u4ea4\u6362\u673a:<\/strong>\u00a0\u5206\u522b\u521d\u59cb\u5316\u4e24\u53f0\u4ea4\u6362\u673a,\u91cd\u547d\u540d\u4e24\u4e2a\u4ea4\u6362\u673a\u540d\u5b57,\u5e76\u5206\u522b\u5728\u4e24\u53f0\u4ea4\u6362\u673a\u4e0a\u5f00\u542f3\u4e2a\u7aef\u53e3.<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch0 \/\/ \u6307\u5b9a\u4ea4\u6362\u673a1\u4e3aswitch0<\/p>\n<p>switch0(config)# interface range fa0\/1-3 \/\/ \u5f00\u542f0\u6a21\u5757\u4e0a\u9762\u76841-3\u53f7\u7aef\u53e3<\/p>\n<p>switch0(config-if-range)# speed auto \/\/ \u914d\u7f6e\u4e3a\u81ea\u52a8\u6a21\u5f0f<\/p>\n<p>switch0(config-if-range)# no shutdown \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>switch0(config-if-range)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch1<\/p>\n<p>switch1(config)# interface range fa0\/1-3<\/p>\n<p>switch1(config-if-range)# speed auto<\/p>\n<p>switch1(config-if-range)# no shutdown<\/p>\n<p>switch1(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u4ea4\u6362\u673aTrunk:<\/strong>\u00a0\u914d\u7f6eTrunk\u5e72\u9053\u901a\u4fe1,\u4e5f\u5c31\u662f\u5c06\u4e24\u53f0\u4ea4\u6362\u673a\u4e92\u76f8\u8fde\u63a5,\u6b64\u5904\u914d\u7f6efa0\/1\u63a5\u53e3\u4e3a\u5e72\u9053\u7f51\u7edc\u63a5\u53e3.<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0&gt; enable<\/p>\n<p>switch0# configure terminal<\/p>\n<p>switch0(config)#<\/p>\n<p>switch0(config)# interface fa0\/1 \/\/ \u9009\u62e9Fa0\/1\u7aef\u53e3<\/p>\n<p>switch0(config-if)# switchport mode trunk \/\/ \u5c061\u53f7\u7aef\u53e3\u8bbe\u7f6e\u4e3atrunk\u6a21\u5f0f<\/p>\n<p>switch0(config-if)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1&gt; enable<\/p>\n<p>switch1# configure terminal<\/p>\n<p>switch1(config)#<\/p>\n<p>switch1(config)# interface fa0\/1<\/p>\n<p>switch1(config-if)# switchport mode trunk<\/p>\n<p>switch1(config-if)# exit<\/p>\n<p><strong>\u914d\u7f6eSwitch0:<\/strong>\u00a0\u914d\u7f6eswitch0\u4ea4\u6362\u673a,\u521b\u5efaVlan10\u548cVlan20,\u5e76\u5206\u522b\u5c06\u4e24\u4e2a\u4e3b\u673aPC0\u52a0\u5165Vlan10\u5c06PC1\u52a0\u5165\u5230Vlan20.<\/p>\n<p>switch0&gt; enable<\/p>\n<p>switch0# configure terminal<\/p>\n<p>#&#8212;-\u521b\u5efa\u63a5\u53e3\u4fe1\u606f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0(config)#<\/p>\n<p>switch0(config)# vlan 10 \/\/ \u521b\u5efavlan11<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>switch0(config)# vlan 20 \/\/ \u521b\u5efavlan20<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6e\u63a5\u53e3\u4fe1\u606f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0(config)# interface fa0\/2 \/\/ \u5c06fa0\/2\u53f7\u63a5\u53e3\u52a0\u5165\u5230vlan10<\/p>\n<p>switch0(config-if)# switchport mode access<\/p>\n<p>switch0(config-if)# switchport access vlan 10<\/p>\n<p>switch0(config-if)# exit<\/p>\n<p>switch0(config)# interface fa0\/3 \/\/ \u5c06fa0\/3\u53f7\u63a5\u53e3\u52a0\u5165\u5230vlan20<\/p>\n<p>switch0(config-if)# switchport mode access<\/p>\n<p>switch0(config-if)# switchport access vlan 20<\/p>\n<p>switch0(config-if)# exit<\/p>\n<p><strong>\u914d\u7f6eSwitch1:<\/strong>\u00a0\u914d\u7f6eswitch1\u4ea4\u6362\u673a,\u521b\u5efaVlan10\u548cVlan20,\u5e76\u5206\u522b\u5c06\u4e24\u4e2a\u4e3b\u673aPC2\u52a0\u5165Vlan10\u5c06PC3\u52a0\u5165\u5230Vlan20.<\/p>\n<p>switch1&gt; enable<\/p>\n<p>switch1# configure terminal<\/p>\n<p>#&#8212;-\u521b\u5efa\u63a5\u53e3\u4fe1\u606f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1(config)# vlan 10<\/p>\n<p>switch1(config-vlan)# exit<\/p>\n<p>switch1(config)# vlan 20<\/p>\n<p>switch1(config-vlan)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6e\u63a5\u53e3\u4fe1\u606f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1(config)# interface fa0\/2<\/p>\n<p>switch1(config-if)# switchport mode access<\/p>\n<p>switch1(config-if)# switchport access vlan 10<\/p>\n<p>switch1(config-if)# exit<\/p>\n<p>switch1(config)# interface fa0\/3<\/p>\n<p>switch1(config-if)# switchport mode access<\/p>\n<p>switch1(config-if)# switchport access vlan 20<\/p>\n<p>switch1(config-if)# exit<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.20.1 192.168.20.254<\/p>\n<p>PC2 192.168.10.2 192.168.10.254<\/p>\n<p>PC3 192.168.20.2 192.168.20.254<\/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>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>&nbsp;<\/p>\n<h3>\u25c6\u901a\u8fc7VTP\u7ba1\u7406VLAN\u25c6<\/h3>\n<p>\u5982\u679c\u7f51\u7edc\u4e2d\u6709\u591a\u53f0\u4ea4\u6362\u673a,\u6bcf\u53f0\u4ea4\u6362\u673a\u4e0a\u6709\u591a\u4e2aVLAN,\u6b64\u65f6\u91c7\u7528\u4f20\u7edf\u65b9\u6cd5\u5728\u6bcf\u53f0\u4ea4\u6362\u673a\u4e0a\u4e00\u4e2a\u4e2a\u914d\u7f6eVLAN\u4e0d\u4ec5\u6548\u7387\u4f4e\u800c\u4e14\u589e\u52a0\u4e86\u7ba1\u7406\u96be\u5ea6,\u4e3a\u6b64\u601d\u79d1\u5f00\u53d1\u4e86VTP\u6280\u672f\u6765\u5b9e\u73b0\u4ea4\u6362\u673a\u4e4b\u95f4\u81ea\u52a8\u5b9e\u73b0\u6570\u636e\u7684\u540c\u6b65.<\/p>\n<p>VTP\u5b83\u662fVLAN\u4e2d\u7ee7\u534f\u8bae,\u88ab\u79f0\u4e3aVLAN\u94fe\u8def\u805a\u96c6\u534f\u8bae,\u5b83\u53ef\u4ee5\u5b9e\u73b0\u5c5e\u4e8e\u540c\u4e00VTP\u57df\u7684\u4ea4\u6362\u673a\u4e4b\u95f4\u81ea\u52a8\u540c\u6b65\u548c\u4f20\u64adVLAN\u4fe1\u606f,\u8fd9\u6837\u53ea\u9700\u8981\u5728Server\u670d\u52a1\u7aef\u6dfb\u52a0VLAN\u4fe1\u606f,\u90a3\u4e48\u5ba2\u6237\u7aef\u5c06\u4f1a\u81ea\u52a8\u540c\u6b65,\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\u540c\u6b65\u65f6\u53ea\u80fd\u540c\u6b65VLAN\u5206\u7ec4,\u81f3\u4e8e\u7aef\u53e3\u7684\u6dfb\u52a0\u8fd8\u5f97\u9700\u8981\u624b\u52a8\u5728\u6bcf\u53f0\u4ea4\u6362\u673a\u4e0a\u6dfb\u52a0,\u56e0\u4e3a\u6bcf\u4e00\u79cd\u4ea4\u6362\u673a\u7684\u63a5\u53e3\u6570\u91cf\u90fd\u4e0d\u592a\u76f8\u540c,\u6545\u5f88\u96be\u5b9e\u73b0\u7edf\u4e00.<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-4.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"397\" class=\"wp-image-2523\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-4.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Diagram Description automatically generated\"  sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/div><\/p>\n<p><strong>\u914d\u7f6e\u4e24\u53f0\u4ea4\u6362\u673a:<\/strong>\u00a0\u5206\u522b\u521d\u59cb\u5316\u4e24\u53f0\u4ea4\u6362\u673a,\u91cd\u547d\u540d\u4e24\u4e2a\u4ea4\u6362\u673a\u540d\u5b57,\u5e76\u5206\u522b\u5728\u4e24\u53f0\u4ea4\u6362\u673a\u4e0a\u5f00\u542f3\u4e2a\u7aef\u53e3.<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch0 \/\/ \u914d\u7f6e\u4ea4\u6362\u673a\u540d\u79f0<\/p>\n<p>switch0(config)# interface range fa0\/1-3 \/\/ \u5f00\u542f1-3\u53f7\u7aef\u53e3<\/p>\n<p>switch0(config-if-range)# speed auto \/\/ \u8bbe\u7f6e\u7aef\u53e3\u901f\u7387\u4e3a\u81ea\u52a8\u6a21\u5f0f<\/p>\n<p>switch0(config-if-range)# no shutdown \/\/ \u5f00\u542f\u72b6\u6001<\/p>\n<p>switch0(config-if-range)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch1<\/p>\n<p>switch1(config)# interface range fa0\/1-3<\/p>\n<p>switch1(config-if-range)# speed auto<\/p>\n<p>switch1(config-if-range)# no shutdown<\/p>\n<p>switch1(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u4ea4\u6362\u673aTrunk:<\/strong>\u00a0\u5c06\u4e24\u53f0\u4ea4\u6362\u673a\u7684fa0\/1\u7aef\u53e3,\u914d\u7f6e\u6210Trunk\u901a\u4fe1\u6a21\u5f0f,\u540c\u6b65\u6570\u636e\u4f7f\u7528.<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0&gt; enable<\/p>\n<p>switch0# configure terminal<\/p>\n<p>switch0(config)# interface fa0\/1 \/\/ \u9009\u62e91\u53f7\u7aef\u53e3<\/p>\n<p>switch0(config-if)# switchport mode trunk \/\/ \u5c06\u7aef\u53e3\u8bbe\u7f6e\u6210trunk\u6a21\u5f0f<\/p>\n<p>switch0(config-if)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1&gt; enable<\/p>\n<p>switch1# configure terminal<\/p>\n<p>switch1(config)# interface fa0\/1<\/p>\n<p>switch1(config-if)# switchport mode trunk<\/p>\n<p>switch1(config-if)# exit<\/p>\n<p><strong>\u914d\u7f6eSwitch0:<\/strong>\u00a0\u5728switch0\u4e0a\u521b\u5efaVTP\u7ba1\u7406\u57df,\u8bbe\u7f6e\u540d\u79f0\u4e3amanage,\u5bc6\u7801\u4e3a123123\u914d\u7f6e\u547d\u4ee4\u5982\u4e0b.<\/p>\n<p>switch0&gt; enable<\/p>\n<p>switch0# configure terminal<\/p>\n<p>switch0(config)# vtp domain manage \/\/ \u521b\u5efa\u540d\u4e3amanage\u7684\u7ba1\u7406\u57df<\/p>\n<p>switch0(config)# vtp mode server \/\/ \u5c06\u672c\u4ea4\u6362\u673a\u8bbe\u7f6e\u4e3aserver\u6a21\u5f0f<\/p>\n<p>switch0(config)# vtp password 123123 \/\/ \u8bbe\u7f6eVTP\u540c\u6b65\u5bc6\u7801\u4e3a123123<\/p>\n<p>switch0(config)# exit<\/p>\n<p>#&#8212;-\u67e5\u770bVTP\u72b6\u6001&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0# show vtp status \/\/ \u67e5\u770bVTP\u540c\u6b65\u72b6\u6001<\/p>\n<p>VTP Version : 2 \/\/ VTP\u7684\u7248\u672c<\/p>\n<p>Configuration Revision : 0 \/\/ \u6b64\u5904\u4e3a\u975e0\u8bf4\u660e\u540c\u6b65\u6210\u529f<\/p>\n<p>Maximum VLANs supported locally : 255<\/p>\n<p>Number of existing VLANs : 5<\/p>\n<p>VTP Operating Mode : Server \/\/ \u6307\u5b9a\u662fserver\u6a21\u5f0f<\/p>\n<p>VTP Domain Name : manage \/\/ \u540c\u6b65\u540d\u79f0\u4e3amanage<\/p>\n<p>VTP Pruning Mode : Disabled<\/p>\n<p>VTP V2 Mode : Disabled<\/p>\n<p>VTP Traps Generation : Disabled<\/p>\n<p>MD5 digest : 0x65 0x6A 0x3C 0x35 0x8B 0xF5 0x0D 0xC0<\/p>\n<p>Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00<\/p>\n<p>Local updater ID is 0.0.0.0 (no valid interface found)<\/p>\n<p><strong>\u914d\u7f6eSwitch1:<\/strong>\u00a0\u5728switch1\u4e0a\u521b\u5efaVTP\u540c\u6b65\u57df,\u8bbe\u7f6e\u6a21\u5f0f\u4e3aclient,\u5bc6\u7801\u4e3a123123,\u914d\u7f6e\u547d\u4ee4\u5982\u4e0b.<\/p>\n<p>switch1&gt; enable<\/p>\n<p>switch1# configure terminal<\/p>\n<p>switch1(config)# vtp domain manage \/\/ \u8bbe\u7f6e\u540c\u6b65\u57df\u540d\u79f0<\/p>\n<p>switch1(config)# vtp mode client \/\/ \u8bbe\u7f6e\u6210\u5ba2\u6237\u7aef\u6a21\u5f0f<\/p>\n<p>switch1(config)# vtp password 123123 \/\/ \u6307\u5b9a\u540c\u6b65\u5bc6\u7801<\/p>\n<p>switch1(config)#exit<\/p>\n<p>#&#8212;-\u67e5\u770bVTP\u72b6\u6001&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1# show vtp status \/\/ \u67e5\u8be2\u72b6\u6001<\/p>\n<p>VTP Version : 2<\/p>\n<p>Configuration Revision : 0 \/\/ \u6b64\u5904\u4e3a\u975e0\u8bf4\u660e\u540c\u6b65\u6210\u529f<\/p>\n<p>Maximum VLANs supported locally : 255<\/p>\n<p>Number of existing VLANs : 5<\/p>\n<p>VTP Operating Mode : Client<\/p>\n<p>VTP Domain Name : manage<\/p>\n<p>VTP Pruning Mode : Disabled<\/p>\n<p>VTP V2 Mode : Disabled<\/p>\n<p>VTP Traps Generation : Disabled<\/p>\n<p>MD5 digest : 0x65 0x6A 0x3C 0x35 0x8B 0xF5 0x0D 0xC0<\/p>\n<p>Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00<\/p>\n<p><strong>\u521b\u5efaVLAN\u914d\u7f6e:<\/strong>\u00a0\u5728\u00b7Server\u7aef\u521b\u5efa\u4e00\u4e9bVLAN\u5217\u8868,\u5e76\u5728Client\u5ba2\u6237\u7aef\u6267\u884c\u540c\u6b65\u547d\u4ee4,\u5373\u53ef\u5b9e\u73b0\u540c\u6b65\u6570\u636e.<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0&gt; enable<\/p>\n<p>switch0# configure terminal<\/p>\n<p>switch0(config)# vlan 10<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>switch0(config)# vlan 20<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eswitch1&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch1&gt; enable<\/p>\n<p>switch1# copy run start \/\/ \u5f00\u59cb\u540c\u6b65\u6570\u636e<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.20.1 192.168.20.254<\/p>\n<p>PC2 192.168.10.2 192.168.10.254<\/p>\n<p>PC3 192.168.20.2 192.168.20.254<\/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>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><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-description-automatically-generated.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"540\" class=\"wp-image-2524\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-description-automatically-generated.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Chart Description automatically generated\"  sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/div><\/p>\n<p><strong>\u914d\u7f6e\u4e8c\u5c42\u4ea4\u6362(\u4e24\u53f0):<\/strong>\u00a0\u9996\u5148\u914d\u7f6e2\u4e2a\u4e8c\u5c42\u4ea4\u6362\u673a,\u5c06fa0\/1\u914d\u6210trunk,fa0\/2\u914d\u6210vlan10,fa0\/3\u914d\u6210vlan20.<\/p>\n<p>#&#8212;-\u521d\u59cb\u5316&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch0 \/\/ \u914d\u7f6e\u4ea4\u6362\u673a\u540d\u79f0(\u4e24\u6b21\u914d\u7f6e\u4e0d\u80fd\u76f8\u540c)<\/p>\n<p>switch(config)# interface range fa0\/1-3 \/\/ \u5f00\u542f1-3\u53f7\u7aef\u53e3<\/p>\n<p>switch(config-if-range)# speed auto \/\/ \u8bbe\u7f6e\u7aef\u53e3\u901f\u7387\u4e3a\u81ea\u52a8\u6a21\u5f0f<\/p>\n<p>switch(config-if-range)# no shutdown \/\/ \u5f00\u542f\u72b6\u6001<\/p>\n<p>switch(config-if-range)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6etrunk&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Switch(config)# interface fa0\/1 \/\/ \u5c06\u6b64\u901a\u9053\u914d\u7f6e\u6210trunk\u6a21\u5f0f<\/p>\n<p>Switch(config-if)# switchport mode trunk \/\/ \u914d\u7f6e\u6210trunk\u6a21\u5f0f<\/p>\n<p>Switch(config-if)# switchport trunk allowed vlan all<\/p>\n<p>Switch(config-if)# no shutdown \/\/ \u5f00\u542f\u7aef\u53e3<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6eVLAN&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>switch0(config)# vlan 10 \/\/ \u521b\u5efavlan10<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>switch0(config)# vlan 20 \/\/ \u521b\u5efavlan20<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>#&#8212;-\u52a0\u5165VLAN\u7ec4&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch(config)# interface range fa0\/2 \/\/ \u5c06fa0\/2\u7aef\u53e3\u52a0\u5165vlan10<\/p>\n<p>switch(config-if-range)# switchport mode access<\/p>\n<p>switch(config-if-range)# switchport access vlan 10<\/p>\n<p>switch(config-if-range)# exit<\/p>\n<p>#&#8212;-\u52a0\u5165VLAN\u7ec4&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch(config)# interface range fa0\/3 \/\/ \u5c06fa0\/3\u7aef\u53e3\u52a0\u5165vlan20<\/p>\n<p>switch(config-if-range)# switchport mode access<\/p>\n<p>switch(config-if-range)# switchport access vlan 20<\/p>\n<p>switch(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u4e09\u5c42\u4ea4\u6362\u673a:<\/strong>\u00a0\u914d\u7f6e\u4e09\u5c42\u4ea4\u6362\u673a,\u6dfb\u52a0vlan10,vlan20 \u7aef\u53e3,\u5e76\u5c06fa0\/1-2\u8bbe\u7f6e\u4e3atrunk,\u4f9b\u4e8c\u5c42\u4ea4\u6362\u6570\u636e.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>#&#8212;-\u914d\u7f6eVLAN&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# vlan 10<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>Switch(config)# vlan 20<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>#&#8212;-\u914d\u7f6e\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# interface range f0\/1-2 \/\/ \u9009\u62e91-2\u53f7\u7aef\u53e3<\/p>\n<p>Switch(config-if)# switchport mode trunk \/\/ \u5c06\u7aef\u53e3\u8bbe\u7f6e\u4e3atrunk\u6a21\u5f0f<\/p>\n<p>Switch(config-if)# no shutdown<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p><strong>\u914d\u7f6e\u4e09\u5c42\u4ea4\u6362\u7f51\u5173:<\/strong>\u00a0\u5728\u4e09\u5c42\u4ea4\u6362\u673a\u4e0a,\u5206\u522b\u4e3a\u6bcf\u4e2a\u865a\u62df\u5b50\u63a5\u53e3vlan10,vlan20\u914d\u7f6e\u4e00\u4e2a\u7f51\u5173\u5730\u5740.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>#&#8212;-\u914d\u7f6e\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch# interface vlan 10 \/\/ \u9009\u62e9Vlan10<\/p>\n<p>Switch# ip address 192.168.10.254 255.255.255.0 \/\/ \u7ed9Vlan10\u914d\u7f6e\u7f51\u5173<\/p>\n<p>Switch# no shutdown \/\/ \u542f\u52a8\u7aef\u53e3<\/p>\n<p>Switch# exit<\/p>\n<p>#&#8212;-\u914d\u7f6e\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch# interface vlan 20 \/\/ \u9009\u62e9Vlan20<\/p>\n<p>Switch# ip address 192.168.20.254 255.255.255.0 \/\/ \u7ed9Vlan20\u914d\u7f6e\u7f51\u5173<\/p>\n<p>Switch# no shutdown<\/p>\n<p>Switch# exit<\/p>\n<p>#&#8212;-\u5f00\u542f\u8def\u7531&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# ip routing \/\/ \u5f00\u542f\u8def\u7531<\/p>\n<p>Switch(config)# exit<\/p>\n<p>#&#8212;-\u67e5\u770b\u8def\u7531&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch# show ip route \/\/ \u663e\u793a\u8def\u7531\u7ed3\u679c<\/p>\n<p>Gateway of last resort is not set<\/p>\n<p>C 192.168.10.0\/24 is directly connected, Vlan10<\/p>\n<p>C 192.168.20.0\/24 is directly connected, Vlan20<\/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\u56db\u4e2aIP\u90fd\u80fdPING\u901a.<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.20.1 192.168.20.254<\/p>\n<p>PC2 192.168.10.2 192.168.10.254<\/p>\n<p>PC3 192.168.20.2 192.168.20.254<\/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>Reply from 192.168.20.1: 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><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-description-automatically-generated-1.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"484\" class=\"wp-image-2525\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/chart-description-automatically-generated-1.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Chart Description automatically generated\"  sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/div><\/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\u5c06fa0\/2-3\u7aef\u53e3\u52a0\u5165\u5230vlan10\u548cvlan20\u4e2d.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>#&#8212;-\u5f00\u542f\u4ea4\u6362\u673a\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# hostname switch0 \/\/ \u914d\u7f6e\u4ea4\u6362\u673a\u540d\u79f0<\/p>\n<p>switch0(config)# interface range fa0\/1-3 \/\/ \u5f00\u542f1-3\u53f7\u7aef\u53e3<\/p>\n<p>switch0(config-if-range)# speed auto \/\/ \u8bbe\u7f6e\u7aef\u53e3\u901f\u7387\u4e3a\u81ea\u52a8\u6a21\u5f0f<\/p>\n<p>switch0(config-if-range)# no shutdown \/\/ \u5f00\u542f\u72b6\u6001<\/p>\n<p>switch0(config-if-range)# exit<\/p>\n<p>#&#8212;-\u521b\u5efavlan10\u548cvlan20&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0(config)# vlan 10<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>switch0(config)#<\/p>\n<p>switch0(config)# vlan 20<\/p>\n<p>switch0(config-vlan)# exit<\/p>\n<p>#&#8212;-\u5c06fa0\/2\u7aef\u53e3\u52a0\u5165\u5230vlan10\u4e2d&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0(config)# interface fa0\/2<\/p>\n<p>switch0(config-if-range)# switchport mode access<\/p>\n<p>switch0(config-if-range)# switchport access vlan 10<\/p>\n<p>switch0(config-if-range)# exit<\/p>\n<p>#&#8212;-\u5c06fa0\/3\u7aef\u53e3\u52a0\u5165\u5230vlan20\u4e2d&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>switch0(config)# interface fa0\/3<\/p>\n<p>switch0(config-if-range)# switchport mode access<\/p>\n<p>switch0(config-if-range)# switchport access vlan 20<\/p>\n<p>switch0(config-if-range)# exit<\/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\u7684fa0\/1\u53e3\u4e3aTrunk.<\/p>\n<p>Switch0&gt; enable<\/p>\n<p>Switch0# configure terminal<\/p>\n<p>Switch0(config)# interface f0\/1 \/\/ \u9009\u62e91\u53f7\u7aef\u53e3<\/p>\n<p>Switch0(config-if)# switchport mode trunk \/\/ \u5c06\u7aef\u53e3\u8bbe\u7f6e\u4e3atrunk\u6a21\u5f0f<\/p>\n<p>Switch0(config-if)# no shutdown<\/p>\n<p>Switch0(config-if)# exit<\/p>\n<p><strong>\u914d\u7f6e\u8def\u7531\u5668:<\/strong>\u00a0\u5728\u8def\u7531\u5668\u7684Fa0\/0\u4ee5\u592a\u7f51\u63a5\u53e3\u4e0a\u521b\u5efa\u903b\u8f91\u63a5\u53e3,\u5e76\u4f7f\u7528IEEE802.1Q\u534f\u8bae\u5c01\u88c5.<\/p>\n<p>Router&gt; enable<\/p>\n<p>Router# configure terminal<\/p>\n<p>#&#8212;-\u5f00\u542f\u8def\u7531\u5668\u7684\u4ee5\u592a\u7f51\u7269\u7406\u63a5\u53e3fa0\/0&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Router(config)# interface fa0\/0<\/p>\n<p>Router(config-if)# no shutdown<\/p>\n<p>Router(config-if)# exit<\/p>\n<p>#&#8212;-\u5728\u4ee5\u592a\u7f51\u63a5\u53e3\u4e0a\u521b\u5efafa0\/0.10\u5b50\u63a5\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Router(config)# interface fa0\/0.10 \/\/ \u6307\u5b9a\u5b50\u63a5\u53e3\u540d\u79f0<\/p>\n<p>Router(config-subif)# encapsulation dot1q 10 \/\/ \u4f7f\u7528IEEE\u534f\u8bae\u5c01\u88c5<\/p>\n<p>Router(config-subif)# ip address 192.168.10.254 255.255.255.0 \/\/ \u8bbe\u7f6e\u5b50\u63a5\u53e3IP\u53c2\u6570<\/p>\n<p>Router(config-subif)# no shutdown<\/p>\n<p>Router(config-subif)# exit<\/p>\n<p>#&#8212;-\u5728\u4ee5\u592a\u7f51\u63a5\u53e3\u4e0a\u521b\u5efafa0\/0.20\u5b50\u63a5\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Router(config)# interface fa0\/0.20<\/p>\n<p>Router(config-subif)# encapsulation dot1q 20<\/p>\n<p>Router(config-subif)# ip address 192.168.20.254 255.255.255.0<\/p>\n<p>Router(config-subif)# no shutdown<\/p>\n<p>Router(config-subif)# exit<\/p>\n<p>#&#8212;-\u5f00\u542f\u8def\u7531\u529f\u80fd,\u5e76\u67e5\u770b\u8def\u7531\u72b6\u6001&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Router(config)# ip routing<\/p>\n<p>Router(config)# exit<\/p>\n<p>Router# show ip route<\/p>\n<p>Gateway of last resort is not set<\/p>\n<p>C 192.168.0.0\/24 is directly connected, FastEthernet0\/0.20<\/p>\n<p>C 192.168.10.0\/24 is directly connected, FastEthernet0\/0.10<\/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\u56db\u4e2aIP\u90fd\u80fdPING\u901a.<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.20.1 192.168.20.254<\/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>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n<p>&nbsp;<\/p>\n<h3>\u5b9e\u6218:\u6784\u5efa\u5c0f\u578b\u5c40\u57df\u7f51<\/h3>\n<p>\u63a5\u4e0b\u6765\u5c06\u901a\u8fc7\u6a21\u62df\u5668\u7ec4\u4ef6\u4e00\u4e2a\u4e2d\u5c0f\u578b\u7f51\u7edc\u62d3\u6251\u7ed3\u6784,\u603b\u5171\u5212\u5206\u4e3a4\u4e2a\u533a\u57df,\u5206\u522b\u662f\u529e\u516c\u533a\u57df(Vlan10),\u5bbf\u820d\u533a\u57df(Vlan20)\u8fd9\u4e24\u4e2a\u533a\u57df\u5206\u522b\u4f7f\u7528\u4e00\u53f0\u4ea4\u6362\u673a\u6765\u8fde\u63a5,\u5269\u4e0b\u7684\u7ba1\u7406\u533a\u57df(Vlan30),\u5ba2\u6237\u533a\u57df(Vlan40)\u653e\u5728\u4e00\u4e2a\u4ea4\u6362\u673a\u91cc,\u901a\u8fc7VLAN\u6280\u672f\u5c06\u5176\u9694\u79bb\u5f00\u6765,\u6700\u540e\u5f00\u542f\u4e09\u5c42\u4ea4\u6362\u7684\u8def\u7531\u8f6c\u53d1\u529f\u80fd,\u5e76\u5b9e\u73b0\u8de8\u533a\u57df\u901a\u4fe1,\u63a5\u4e0b\u6765\u770b\u4e00\u4e0b\u5b9e\u9a8c\u62d3\u6251\u56fe.<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-5.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1181\" height=\"527\" class=\"wp-image-2526\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/diagram-description-automatically-generated-5.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Diagram Description automatically generated\"  sizes=\"auto, (max-width: 1181px) 100vw, 1181px\" \/><\/div><\/p>\n<p><strong>\u914d\u7f6e\u6838\u5fc3\u4ea4\u6362\u673a:<\/strong>\u00a0\u9996\u5148\u914d\u7f6e\u4e09\u5c42\u6838\u5fc3\u4ea4\u6362\u673a switch,\u521b\u5efaVTP\u7ba1\u7406\u57df\u4ee5\u53ca\u521b\u5efaVLAN.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>#&#8212;-\u914d\u7f6eVTP\u7ba1\u7406\u7aef&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Switch(config)# vtp domain lyshark \/\/ \u521b\u5efaVTP\u57df\u5e76\u547d\u540d\u4e3alyshark<\/p>\n<p>Switch(config)# vtp mode server \/\/ \u8bbe\u7f6eVTP\u57df\u6a21\u5f0f\u4e3aserver<\/p>\n<p>Switch(config)# vtp password 123123 \/\/ \u8bbe\u7f6eVTP\u5bc6\u7801\u4e3a123123<\/p>\n<p>#&#8212;-\u63a5\u7740\u521b\u5efaVLAN&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# vlan 10<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>Switch(config)# vlan 20<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>Switch(config)# vlan 30<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>Switch(config)# vlan 40<\/p>\n<p>Switch(config-vlan)# exit<\/p>\n<p>#&#8212;-\u5f00\u542f\u4e09\u5c42\u4ea4\u6362\u673atrunk\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Switch(config)# interface range fa0\/1-3<\/p>\n<p>Switch(config-if)#<\/p>\n<p>Switch(config-if)# switchport trunk encapsulation dot1q<\/p>\n<p>Switch(config-if)# switchport mode trunk<\/p>\n<p><strong>\u914d\u7f6e\u529e\u516c\u533a:<\/strong>\u00a0\u63a5\u7740\u914d\u7f6e\u4e8c\u5c42\u4ea4\u6362\u673a switch0,\u914d\u7f6e\u6210VTP\u5ba2\u6237\u7aef,\u5e76\u5c06fa0\/1\u7aef\u53e3\u914d\u7f6e\u6210trunk\u6a21\u5f0f.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch0<\/p>\n<p>#&#8212;-\u914d\u7f6eVTP\u5ba2\u6237\u7aef&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch0(config)# vtp domain lyshark \/\/ \u914d\u7f6eVTP\u5ba2\u6237\u7aef,\u540d\u79f0<\/p>\n<p>switch0(config)# vtp mode client \/\/ \u914d\u7f6e\u6210client\u5ba2\u6237\u7aef\u6a21\u5f0f<\/p>\n<p>switch0(config)# vtp password 123123 \/\/ \u914d\u7f6e\u5bc6\u7801<\/p>\n<p>#&#8212;-\u5f00\u542f\u4e8c\u5c42\u4ea4\u6362\u673atrunk\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch0(config)# interface fa0\/1<\/p>\n<p>switch0(config-if)# switchport mode trunk<\/p>\n<p>switch0(config-if)# exit<\/p>\n<p>switch0(config)# exit<\/p>\n<p>#&#8212;-\u67e5\u770b\u6570\u636e\u540c\u6b65\u662f\u5426\u751f\u6548&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch0# show vlan brief<\/p>\n<p>10 VLAN0010 active<\/p>\n<p>20 VLAN0020 active<\/p>\n<p>30 VLAN0030 active<\/p>\n<p>40 VLAN0040 active<\/p>\n<p>1002 fddi-default active<\/p>\n<p>1003 token-ring-default active<\/p>\n<p>1004 fddinet-default active<\/p>\n<p>1005 trnet-default active<\/p>\n<p>#&#8212;-\u6700\u540e\u5c06\u5269\u4e0b\u7684\u7aef\u53e3\u5168\u90e8\u6dfb\u52a0\u5230VLAN10&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch0(config)# interface range fa0\/2-24<\/p>\n<p>switch0(config-if-range)# switchport mode access<\/p>\n<p>switch0(config-if-range)# switchport access vlan 10<\/p>\n<p>switch0(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u5bbf\u820d\u533a:<\/strong>\u00a0\u63a5\u7740\u914d\u7f6e\u4e8c\u5c42\u4ea4\u6362\u673a switch1,\u914d\u7f6e\u6210VTP\u5ba2\u6237\u7aef,\u5e76\u5c06fa0\/1\u7aef\u53e3\u914d\u7f6e\u6210trunk\u6a21\u5f0f.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch1<\/p>\n<p>#&#8212;-\u914d\u7f6eVTP\u5ba2\u6237\u7aef&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch1(config)# vtp domain lyshark \/\/ \u914d\u7f6eVTP\u5ba2\u6237\u7aef,\u540d\u79f0<\/p>\n<p>switch1(config)# vtp mode client \/\/ \u914d\u7f6e\u6210client\u5ba2\u6237\u7aef\u6a21\u5f0f<\/p>\n<p>switch1(config)# vtp password 123123 \/\/ \u914d\u7f6e\u5bc6\u7801<\/p>\n<p>#&#8212;-\u5f00\u542f\u4e8c\u5c42\u4ea4\u6362\u673atrunk\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch1(config)# interface fa0\/1<\/p>\n<p>switch1(config-if)# switchport mode trunk<\/p>\n<p>switch1(config-if)# exit<\/p>\n<p>switch1(config)# exit<\/p>\n<p>#&#8212;-\u67e5\u770b\u6570\u636e\u540c\u6b65\u662f\u5426\u751f\u6548&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch1# show vlan brief<\/p>\n<p>10 VLAN0010 active<\/p>\n<p>20 VLAN0020 active<\/p>\n<p>30 VLAN0030 active<\/p>\n<p>40 VLAN0040 active<\/p>\n<p>1002 fddi-default active<\/p>\n<p>1003 token-ring-default active<\/p>\n<p>1004 fddinet-default active<\/p>\n<p>1005 trnet-default active<\/p>\n<p>#&#8212;-\u6700\u540e\u5c06\u5269\u4e0b\u7684\u7aef\u53e3\u5168\u90e8\u6dfb\u52a0\u5230VLAN20&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch1(config)# interface range fa0\/2-24<\/p>\n<p>switch1(config-if-range)# switchport mode access<\/p>\n<p>switch1(config-if-range)# switchport access vlan 20<\/p>\n<p>switch1(config-if-range)# exit<\/p>\n<p><strong>\u914d\u7f6e\u7ba1\u7406\/\u5ba2\u6237\u533a:<\/strong>\u00a0\u63a5\u7740\u914d\u7f6e\u4e8c\u5c42\u4ea4\u6362\u673a switch2,\u914d\u7f6e\u6210VTP\u5ba2\u6237\u7aef,\u5e76\u5c06fa0\/1\u7aef\u53e3\u914d\u7f6e\u6210trunk\u6a21\u5f0f.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# hostname switch2<\/p>\n<p>#&#8212;-\u914d\u7f6eVTP\u5ba2\u6237\u7aef&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch2(config)# vtp domain lyshark \/\/ \u914d\u7f6eVTP\u5ba2\u6237\u7aef,\u540d\u79f0<\/p>\n<p>switch2(config)# vtp mode client \/\/ \u914d\u7f6e\u6210client\u5ba2\u6237\u7aef\u6a21\u5f0f<\/p>\n<p>switch2(config)# vtp password 123123 \/\/ \u914d\u7f6e\u5bc6\u7801<\/p>\n<p>#&#8212;-\u5f00\u542f\u4e8c\u5c42\u4ea4\u6362\u673atrunk\u7aef\u53e3&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch2(config)# interface fa0\/1<\/p>\n<p>switch2(config-if)# switchport mode trunk<\/p>\n<p>switch2(config-if)# exit<\/p>\n<p>switch2(config)# exit<\/p>\n<p>#&#8212;-\u67e5\u770b\u6570\u636e\u540c\u6b65\u662f\u5426\u751f\u6548&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>switch2# show vlan brief<\/p>\n<p>10 VLAN0010 active<\/p>\n<p>20 VLAN0020 active<\/p>\n<p>30 VLAN0030 active<\/p>\n<p>40 VLAN0040 active<\/p>\n<p>1002 fddi-default active<\/p>\n<p>1003 token-ring-default active<\/p>\n<p>1004 fddinet-default active<\/p>\n<p>1005 trnet-default active<\/p>\n<p>#&#8212;-\u5c06fa0\/2-3\u4e24\u53f0,\u6dfb\u52a0\u5230VLAN30&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>switch2(config)# interface range fa0\/2-3<\/p>\n<p>switch2(config-if-range)# switchport mode access<\/p>\n<p>switch2(config-if-range)# switchport access vlan 30<\/p>\n<p>switch2(config-if-range)# exit<\/p>\n<p>#&#8212;-\u5c06fa0\/4-5\u4e24\u53f0,\u6dfb\u52a0\u5230VLAN30&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>switch2(config)# interface range fa0\/4-5<\/p>\n<p>switch2(config-if-range)# switchport mode access<\/p>\n<p>switch2(config-if-range)# switchport access vlan 40<\/p>\n<p>switch2(config-if-range)# exit<\/p>\n<p><strong>\u5f00\u542f\u4e09\u5c42\u8def\u7531:<\/strong>\u00a0\u6700\u540e\u914d\u7f6e\u6838\u5fc3\u4ea4\u6362\u673aSwitch,\u5e76\u5f00\u542f\u8def\u7531\u529f\u80fd,\u5206\u522b\u4e3a\u6bcf\u4e2a\u7f51\u6bb5\u6307\u5b9a\u4e00\u4e2a\u7f51\u5173.<\/p>\n<p>Switch&gt; enable<\/p>\n<p>Switch# configure terminal<\/p>\n<p>Switch(config)# ip routing \/\/ \u5f00\u542f\u4e09\u5c42\u8def\u7531\u529f\u80fd<\/p>\n<p>#&#8212;-\u7ed9Vlan10\u6dfb\u52a0\u4e00\u4e2a\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# interface vlan 10<\/p>\n<p>Switch(config-if)# ip address 192.168.10.254 255.255.255.0<\/p>\n<p>Switch(config-if)# no shutdown<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p>#&#8212;-\u7ed9Vlan20\u6dfb\u52a0\u4e00\u4e2a\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# interface vlan 20<\/p>\n<p>Switch(config-if)# ip address 192.168.20.254 255.255.255.0<\/p>\n<p>Switch(config-if)# no shutdown<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p>#&#8212;-\u7ed9Vlan30\u6dfb\u52a0\u4e00\u4e2a\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# interface vlan 30<\/p>\n<p>Switch(config-if)# ip address 192.168.30.254 255.255.255.0<\/p>\n<p>Switch(config-if)# no shutdown<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p>#&#8212;-\u7ed9Vlan40\u6dfb\u52a0\u4e00\u4e2a\u7f51\u5173&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Switch(config)# interface vlan 40<\/p>\n<p>Switch(config-if)# ip address 192.168.40.254 255.255.255.0<\/p>\n<p>Switch(config-if)# no shutdown<\/p>\n<p>Switch(config-if)# exit<\/p>\n<p><strong>\u5ba2\u6237\u673a\u914d\u7f6e\u7f51\u6bb5:<\/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\u5219IP\u90fd\u80fdPING\u901a.<\/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] [\u7f51\u5173]<\/p>\n<p>PC0 192.168.10.1 192.168.10.254<\/p>\n<p>PC1 192.168.10.2 192.168.10.254<\/p>\n<p>PC2 192.168.20.1 192.168.20.254<\/p>\n<p>PC3 192.168.20.2 192.168.20.254<\/p>\n<p>PC4 192.168.30.1 192.168.30.254<\/p>\n<p>PC5 192.168.30.2 192.168.30.254<\/p>\n<p>PC6 192.168.40.1 192.168.40.254<\/p>\n<p>PC7 192.168.40.2 192.168.40.254<\/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>Reply from 192.168.20.1: bytes=32 time=1ms TTL=127<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ea4\u6362\u673a(Switch)\u662f\u4e00\u79cd\u7528\u4e8e\u7535\u4fe1\u53f7\u8f6c\u53d1\u7684\u7f51\u7edc\u8bbe\u5907,\u5b83\u53ef\u4ee5\u4e3a\u63a5\u5165\u4ea4\u6362\u673a\u7684\u4efb\u610f\u4e24\u4e2a\u7f51\u7edc\u8282\u70b9\u63d0\u4f9b\u72ec\u4eab\u7684\u7535\u4fe1\u53f7\u901a\u8def [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-2520","post","type-post","status-publish","format-standard","hentry","category-cisco"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2520","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=2520"}],"version-history":[{"count":3,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2520\/revisions"}],"predecessor-version":[{"id":2529,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2520\/revisions\/2529"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}