{"id":774,"date":"2025-10-25T07:56:03","date_gmt":"2025-10-24T23:56:03","guid":{"rendered":"https:\/\/www.htmacg.cn\/?p=774"},"modified":"2025-10-25T07:56:03","modified_gmt":"2025-10-24T23:56:03","slug":"%e6%80%9d%e7%a7%91%e6%a8%a1%e6%8b%9f%e5%99%a8%ef%bc%88cisco-packet-tracer%ef%bc%89%e4%ba%a4%e6%8d%a2%e6%9c%ba%e7%ab%af%e5%8f%a3%e5%ae%89%e5%85%a8%e9%98%b2%e6%8a%a4%e9%85%8d%e7%bd%ae%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/htmacg.cn\/?p=774","title":{"rendered":"\u601d\u79d1\u6a21\u62df\u5668\uff08Cisco Packet Tracer\uff09\u4ea4\u6362\u673a\u7aef\u53e3\u5b89\u5168\u9632\u62a4\u914d\u7f6e\u6307\u5357"},"content":{"rendered":"<p>\u672c\u6587\u57fa\u4e8e 2960-24TT \u4ea4\u6362\u673a\u4e0e\u4e24\u53f0 PC \u673a\u7684\u5b9e\u9a8c\u73af\u5883\uff0c\u4ece\u5b9e\u9a8c\u51c6\u5907\u3001\u62d3\u6251\u642d\u5efa\u5230\u5165\u95e8\u7ea7\u914d\u7f6e\u3001\u8fdb\u9636\u914d\u7f6e\uff08\u9759\u6001\u7ed1\u5b9a\u4e0e\u7c98\u6027\u5b66\u4e60\uff09\uff0c\u7cfb\u7edf\u8bb2\u89e3\u4ea4\u6362\u673a\u7aef\u53e3\u5b89\u5168\u7684\u5b9e\u73b0\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u5173\u952e\u9a8c\u8bc1\u547d\u4ee4\uff0c\u786e\u4fdd\u914d\u7f6e\u53ef\u67e5\u3001\u53ef\u9a8c\u3002<\/p>\n<h2><strong><b>\u4e00\u3001\u5b9e\u9a8c\u57fa\u7840\u51c6\u5907<\/b><\/strong><\/h2>\n<p>\u4e00\u53f02960-24TT\u4ea4\u6362\u673a + 2\u53f0 PC\u673a<\/p>\n<h3><strong><b>2. \u7f51\u7edc\u62d3\u6251\u642d\u5efa<\/b><\/strong><\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/img.htmacg.cn\/uploads\/2025\/10\/25\/68fc10f6b3790.png\" alt=\"\u56fe\u72471_compressed.png\" \/><\/p>\n<p>\u624b\u52a8\u4e3a\u4e24\u53f0 PC \u8bbe\u7f6e\u9759\u6001 IP\uff08\u786e\u4fdd\u5728\u540c\u4e00\u7f51\u6bb5\uff0c\u65e0\u9700\u7f51\u5173\uff0c\u56e0\u4ec5\u9700\u4ea4\u6362\u673a\u4e8c\u5c42\u901a\u4fe1\uff09\uff1a<\/p>\n<ul>\n<li>\u5de6 PC\uff08\u4e2a\u4eba\u7535\u8111 0\uff09\uff1aIP \u5730\u5740\uff1a192.168.1.1\uff0c\u5b50\u7f51\u63a9\u7801 255.255.255.0\uff1b<\/li>\n<li>\u53f3 PC\uff08\u4e2a\u4eba\u7535\u8111 1\uff09\uff1aIP \u5730\u5740\uff1a192.168.1.2\uff0c\u5b50\u7f51\u63a9\u7801 255.255.255.0\u3002<\/li>\n<\/ul>\n<h2><strong><b>\u4e8c\u3001\u5165\u95e8\u7ea7\u7aef\u53e3\u5b89\u5168\u914d\u7f6e\uff08\u57fa\u7840\u9650\u5236\uff09<\/b><\/strong><\/h2>\n<p>\u5165\u95e8\u7ea7\u914d\u7f6e\u7684\u6838\u5fc3\u76ee\u6807\uff1a\u9650\u5236\u4ea4\u6362\u673aFa0\/1\u7aef\u53e3\u6700\u591a\u63a5\u5165 2 \u53f0\u8bbe\u5907\uff0c\u82e5\u8d85\u8fc7\u9650\u5236\u5219\u4e22\u5f03\u8fdd\u89c4\u6570\u636e\u5305\u5e76\u53d1\u9001\u544a\u8b66\uff08\u4e0d\u5173\u95ed\u7aef\u53e3\uff09\uff0c\u9002\u7528\u4e8e\u9700\u4e34\u65f6\u63a5\u5165\u5c11\u91cf\u8bbe\u5907\u7684\u573a\u666f\u3002<\/p>\n<h3><strong><b>\u914d\u7f6e\u6b65\u9aa4<\/b><\/strong><\/h3>\n<pre>Switch(config)# interface fastethernet 0\/1 # \u7b80\u5199\uff1aint fa 0\/1\n\nSwitch(config-if)# switchport mode access # \u5173\u952e\uff1a\u786e\u4fdd\u63a5\u53e3\u4e3a\u4e8c\u5c42Access\u6a21\u5f0f\n\nSwitch(config-if)# switchport port-security # \u542f\u7528\u7aef\u53e3\u5b89\u5168\u6838\u5fc3\u529f\u80fd\n\nSwitch(config-if)# switchport port-security maximum 2 # \u6700\u591a\u5141\u8bb82\u4e2a\u8bbe\u5907\u63a5\u5165\n\nSwitch(config-if)# switchport port-security violation restrict # \u8fdd\u89c4\u7b56\u7565\n\nSwitch(config-if)# exit \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u9000\u51fa\u63a5\u53e3\u914d\u7f6e\u6a21\u5f0f\n\nSwitch(config)# exit \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u9000\u51fa\u5168\u5c40\u914d\u7f6e\u6a21\u5f0f\n\nSwitch# write memory \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u4fdd\u5b58\u914d\u7f6e\uff08\u7b80\u5199\uff1awr\uff09<\/pre>\n<h2><strong><b>\u4e09\u3001\u8fdb\u9636\u914d\u7f6e\uff08\u7cbe\u51c6\u63a7\u5236\u63a5\u5165\u8bbe\u5907\uff09<\/b><\/strong><\/h2>\n<p>\u5165\u95e8\u7ea7\u914d\u7f6e\u4ec5\u9650\u5236\u8bbe\u5907\u6570\u91cf\uff0c\u8fdb\u9636\u914d\u7f6e\u901a\u8fc7<strong><b>\u9759\u6001 MAC \u7ed1\u5b9a<\/b><\/strong>\u6216<strong><b>\u7c98\u6027\u5b66\u4e60<\/b><\/strong>\uff0c\u7cbe\u51c6\u6307\u5b9a \u201c\u5141\u8bb8\u63a5\u5165\u7684\u8bbe\u5907\u201d\uff0c\u9002\u7528\u4e8e\u56fa\u5b9a\u8bbe\u5907\uff08\u5982\u670d\u52a1\u5668\u3001\u529e\u516c PC\uff09\u7684\u573a\u666f\uff0c\u5b89\u5168\u6027\u66f4\u9ad8\u3002<\/p>\n<h3><strong><b>\u8fdb\u9636\u914d\u7f6e 1\uff1a\u9759\u6001 MAC \u7ed1\u5b9a\uff08\u6307\u5b9a\u5141\u8bb8\u7684\u8bbe\u5907\uff09<\/b><\/strong><\/h3>\n<p>\u9759\u6001\u7ed1\u5b9a\u9700\u624b\u52a8\u5c06 \u201c\u5141\u8bb8\u63a5\u5165\u7684\u8bbe\u5907 MAC \u5730\u5740\u201d \u4e0e\u7aef\u53e3\u5173\u8054\uff0c\u4ec5\u7ed1\u5b9a\u7684\u8bbe\u5907\u53ef\u63a5\u5165\uff0c\u5176\u4ed6\u8bbe\u5907\u4f1a\u89e6\u53d1\u8fdd\u89c4\u3002<\/p>\n<h4><strong><b>\u914d\u7f6e\u524d\u63d0<\/b><\/strong><\/h4>\n<p>\u5148\u8ba9\u4e24\u53f0 PC \u4e0e\u4ea4\u6362\u673a\u901a\u4fe1\uff08\u5982 ping \u6d4b\u8bd5\uff09\uff0c\u4f7f\u4ea4\u6362\u673a\u81ea\u52a8\u5b66\u4e60\u5230 PC \u7684 MAC \u5730\u5740\uff0c\u907f\u514d\u624b\u52a8\u8f93\u5165 MAC \u65f6\u51fa\u9519\u3002<\/p>\n<pre>show mac-address-table  #\u00a0 \u67e5\u770b\u4ea4\u6362\u673a\u5df2\u5b66\u4e60\u7684 MAC \u5730\u5740<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/img.htmacg.cn\/uploads\/2025\/10\/25\/68fc116f33a80.png\" alt=\"\u56fe\u72472.png\" \/><\/p>\n<pre>Switch# configure terminal\n\nSwitch(config)# interface fastethernet 0\/1\n\n# \u7ed1\u5b9a\u5de6PC\u7684MAC\u5730\u5740\uff08\u66ff\u6362\u4e3a\u5b9e\u9645\u67e5\u8be2\u5230\u7684MAC\uff09\n\nSwitch(config-if)# switchport port-security mac-address 000c.cf75.a58d<\/pre>\n<h4><strong><b>\u6548\u679c\u8bf4\u660e<\/b><\/strong><\/h4>\n<p>\u4ec5 MAC \u5730\u5740\u4e3a000c.cf75.a58d\u7684\u5de6 PC \u53ef\u6b63\u5e38\u63a5\u5165Fa0\/1\u7aef\u53e3\uff0c\u82e5\u66f4\u6362\u5176\u4ed6\u8bbe\u5907\uff08MAC \u4e0d\u5339\u914d\uff09\uff0c\u4f1a\u89e6\u53d1restrict\u8fdd\u89c4\u7b56\u7565\uff08\u4e22\u5f03\u6570\u636e + \u544a\u8b66\uff09\u3002<\/p>\n<h3><strong><b>\u8fdb\u9636\u914d\u7f6e 2\uff1a\u7c98\u6027\u5b66\u4e60\uff08\u81ea\u52a8\u7ed1\u5b9a\u5e76\u4fdd\u5b58 MAC\uff09<\/b><\/strong><\/h3>\n<p>\u7c98\u6027\u5b66\u4e60\u4f1a\u81ea\u52a8\u5b66\u4e60\u63a5\u5165\u7aef\u53e3\u7684\u8bbe\u5907 MAC \u5730\u5740\uff0c\u5e76\u5c06\u5176 \u201c\u56fa\u5316\u201d \u5230\u4ea4\u6362\u673a\u914d\u7f6e\u4e2d\uff08\u91cd\u542f\u540e\u4e0d\u4e22\u5931\uff09\uff0c\u65e0\u9700\u624b\u52a8\u8f93\u5165 MAC\uff0c\u517c\u987e \u201c\u7cbe\u51c6\u63a7\u5236\u201d \u4e0e \u201c\u914d\u7f6e\u4fbf\u6377\u6027\u201d\u3002<\/p>\n<h4><strong><b>\u914d\u7f6e\u6b65\u9aa4<\/b><\/strong><\/h4>\n<pre>Switch(config)# interface fastethernet 0\/1\n\nSwitch(config-if)# switchport port-security mac-address sticky # \u542f\u7528\u7c98\u6027\u5b66\u4e60\u529f\u80fd<\/pre>\n<p><strong><b>\u9a8c\u8bc1\u7c98\u6027\u5b66\u4e60\u7ed3\u679c<\/b><\/strong><\/p>\n<pre>Switch# show port-security\u00a0interface fastethernet 0\/1 # \u67e5\u770b\u63a5\u53e3\u914d\u7f6e<\/pre>\n<h3>Switch<strong><b># show port-security<\/b><\/strong><strong><b>\u00a0\u00a0\/\/<\/b><\/strong><strong><b>\u67e5\u770b\u6240\u6709\u7aef\u53e3\u7684\u7aef\u53e3\u5b89\u5168\u6458\u8981<\/b><\/strong><\/h3>\n<h2><strong><b>\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u6ce8\u610f\u4e8b\u9879<\/b><\/strong><\/h2>\n<p><strong><b>1.<\/b><\/strong><strong><b>\u63a5\u53e3\u65e0\u6cd5\u542f\u7528\u7aef\u53e3\u5b89\u5168\uff1f<\/b><\/strong>\u68c0\u67e5\u63a5\u53e3\u662f\u5426\u4e3aAccess\u6a21\u5f0f\uff1a\u7aef\u53e3\u5b89\u5168\u4ec5\u652f\u6301\u4e8c\u5c42 Access \u6a21\u5f0f\uff0c\u82e5\u63a5\u53e3\u4e3aTrunk\u6216Dynamic Desirable\uff08\u52a8\u6001\u534f\u5546\u6a21\u5f0f\uff09\uff0c\u9700\u5148\u6267\u884cswitchport mode access\u4fee\u6539\u3002<\/p>\n<p><strong><b>2.<\/b><\/strong><strong><b>\u9759\u6001\u7ed1\u5b9a MAC \u540e\u8bbe\u5907\u4ecd\u65e0\u6cd5\u63a5\u5165\uff1f<\/b><\/strong>\u786e\u8ba4 MAC \u5730\u5740\u8f93\u5165\u6b63\u786e\uff08\u533a\u5206\u5927\u5c0f\u5199\uff0c\u6a21\u62df\u5668\u4e2d MAC \u683c\u5f0f\u4e3aXXXX.XXXX.XXXX\uff0c\u4e0d\u53ef\u9057\u6f0f\u5c0f\u6570\u70b9\uff09\uff1b\u540c\u65f6\u68c0\u67e5 PC \u662f\u5426\u8fde\u63a5\u5230\u6b63\u786e\u7684\u7aef\u53e3\uff08\u5982\u7ed1\u5b9aFa0\/1\u7684 MAC\uff0cPC \u9700\u63a5Fa0\/1\uff09\u3002<\/p>\n<p><strong><b>3.<\/b><\/strong><strong><b>\u7c98\u6027\u5b66\u4e60\u7684 MAC \u91cd\u542f\u540e\u4e22\u5931\uff1f<\/b><\/strong>\u672a\u4fdd\u5b58\u914d\u7f6e\uff01\u7c98\u6027\u5b66\u4e60\u4f1a\u81ea\u52a8\u5c06 MAC \u6dfb\u52a0\u5230 \u201c\u8fd0\u884c\u914d\u7f6e\u201d\uff08running-config\uff09\uff0c\u9700\u6267\u884cwrite memory\u4fdd\u5b58\u5230 \u201c\u542f\u52a8\u914d\u7f6e\u201d\uff08startup-config\uff09\uff0c\u5426\u5219\u91cd\u542f\u540e\u914d\u7f6e\u4e22\u5931\u3002<\/p>\n<p><strong><b>4.<\/b><\/strong><strong><b>\u8fdd\u89c4\u540e\u7aef\u53e3\u53d8\u4e3a\u6a59\u8272\uff08err-disabled \u72b6\u6001\uff09\uff1f<\/b><\/strong>\u82e5\u8fdd\u89c4\u6a21\u5f0f\u914d\u7f6e\u4e3ashutdown\uff08\u9ed8\u8ba4\u6a21\u5f0f\uff09\uff0c\u8fdd\u89c4\u540e\u7aef\u53e3\u4f1a\u5173\u95ed\uff08err-disabled\uff09\uff0c\u9700\u624b\u52a8\u6062\u590d\uff1a\u8fdb\u5165\u63a5\u53e3\u914d\u7f6e\u6a21\u5f0f\uff0c\u6267\u884cshutdown\u2192no shutdown\uff08\u5148\u5173\u540e\u5f00\uff09\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u57fa\u4e8e 2960-24TT \u4ea4\u6362\u673a\u4e0e\u4e24\u53f0 PC \u673a\u7684\u5b9e\u9a8c\u73af\u5883\uff0c\u4ece\u5b9e\u9a8c\u51c6\u5907\u3001\u62d3\u6251\u642d\u5efa\u5230\u5165\u95e8\u7ea7\u914d\u7f6e\u3001\u8fdb\u9636\u914d\u7f6e\uff08\u9759\u6001\u7ed1\u5b9a\u4e0e\u7c98\u6027\u5b66\u4e60\uff09\uff0c\u7cfb\u7edf\u8bb2\u89e3\u4ea4\u6362\u673a\u7aef\u53e3\u5b89\u5168\u7684\u5b9e\u73b0\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u5173\u952e\u9a8c\u8bc1\u547d\u4ee4\uff0c\u786e\u4fdd\u914d\u7f6e\u53ef\u67e5\u3001\u53ef\u9a8c\u3002 \u4e00\u3001\u5b9e\u9a8c\u57fa\u7840\u51c6\u5907 \u4e00\u53f02960-24TT\u4ea4\u6362\u673a + 2\u53f0 PC\u673a 2. \u7f51\u7edc\u62d3\u6251\u642d\u5efa \u624b\u52a8\u4e3a&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-774","post","type-post","status-publish","format-standard","hentry","category-operational_maintenance_simulation"],"_links":{"self":[{"href":"https:\/\/htmacg.cn\/index.php?rest_route=\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/htmacg.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/htmacg.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/htmacg.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/htmacg.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=774"}],"version-history":[{"count":0,"href":"https:\/\/htmacg.cn\/index.php?rest_route=\/wp\/v2\/posts\/774\/revisions"}],"wp:attachment":[{"href":"https:\/\/htmacg.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/htmacg.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/htmacg.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}