{"id":194,"date":"2019-04-01T10:13:27","date_gmt":"2019-04-01T02:13:27","guid":{"rendered":"http:\/\/b.yesiyu.top\/?p=194"},"modified":"2019-04-01T10:13:27","modified_gmt":"2019-04-01T02:13:27","slug":"%e9%94%90%e6%8d%b7%e4%ba%a4%e6%8d%a2%e6%9c%ba%e7%9a%84%e9%85%8d%e7%bd%ae%e5%91%bd%e4%bb%a4%e5%a4%a7%e5%85%a8","status":"publish","type":"post","link":"https:\/\/b.yesiyu.top\/?p=194","title":{"rendered":"\u9510\u6377\u4ea4\u6362\u673a\u7684\u914d\u7f6e\u547d\u4ee4\u5927\u5168"},"content":{"rendered":"\n<p><strong>\u4e00\u3001\u57fa\u7840\u914d\u7f6e\u547d\u4ee4<\/strong><\/p>\n\n\n\n<p><strong>1\u3001\u51c6\u5907\u547d\u4ee4<\/strong>&nbsp;<\/p>\n\n\n\n<p>&gt;Enable \u8fdb\u5165\u7279\u6743\u6a21\u5f0f<br>#Exit&nbsp;&nbsp; \u8fd4\u56de\u4e0a\u4e00\u7ea7\u64cd\u4f5c\u6a21\u5f0f<br>#End&nbsp;&nbsp; \u8fd4\u56de\u5230\u7279\u6743\u6a21\u5f0f<br>#write memory \u6216copy running-config startup-config&nbsp;&nbsp; \u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6<br>#del flash:config.text&nbsp;&nbsp; \u5220\u9664\u914d\u7f6e\u6587\u4ef6(\u4ea4\u6362\u673a\u53ca1700\u7cfb\u5217\u8def\u7531\u5668)<br>#erase startup-config&nbsp;&nbsp; \u5220\u9664\u914d\u7f6e\u6587\u4ef6(2500\u7cfb\u5217\u8def\u7531\u5668)<br>#del flash:vlan.dat \u5220\u9664Vlan\u914d\u7f6e\u4fe1\u606f\uff08\u4ea4\u6362\u673a\uff09<br>#Configure terminal \u8fdb\u5165\u5168\u5c40\u914d\u7f6e\u6a21\u5f0f<br>(config)# hostname switchA&nbsp;&nbsp; \u914d\u7f6e\u8bbe\u5907\u540d\u79f0\u4e3aswitchA<br>(config)#banner motd &amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u914d\u7f6e\u6bcf\u65e5\u63d0\u793a\u4fe1\u606f &amp;\u4e3a\u7ec8\u6b62\u7b26<br>(config)#enable secret level 1 0 star&nbsp;&nbsp; \u914d\u7f6e\u8fdc\u7a0b\u767b\u9646\u5bc6\u7801\u4e3astar<br>(config)#enable secret level 15 0 star \u914d\u7f6e\u7279\u6743\u5bc6\u7801\u4e3astar<br>Level 1\u4e3a\u666e\u901a\u7528\u6237\u7ea7\u522b\uff0c\u53ef\u9009\u4e3a1~15\uff0c15\u4e3a\u6700\u9ad8\u6743\u9650\u7ea7\u522b\uff1b0\u8868\u793a\u5bc6\u7801\u4e0d\u52a0\u5bc6<br>(config)#enable services web-server \u5f00\u542f\u4ea4\u6362\u673aWEB\u7ba1\u7406\u529f\u80fd<br>Services \u53ef\u9009\u4ee5\u4e0b\uff1aweb-server(WEB\u7ba1\u7406)\u3001telnet-server(\u8fdc\u7a0b\u767b\u9646)\u7b49<br><br><strong>2\u3001\u67e5\u770b\u4fe1\u606f<br><\/strong>#show running-config&nbsp; &nbsp; &nbsp; &nbsp;\/\/\u67e5\u770b\u5f53\u524d\u751f\u6548\u7684\u914d\u7f6e\u4fe1\u606f<br>#show interface fastethernet 0\/3&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770bF0\/3\u7aef\u53e3\u4fe1\u606f<br>#show interface serial 1\/2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770bS1\/2\u7aef\u53e3\u4fe1\u606f<br>#show interface&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u6240\u6709\u7aef\u53e3\u4fe1\u606f<br>#show ip interface brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u4ee5\u7b80\u6d01\u65b9\u5f0f\u6c47\u603b\u67e5\u770b\u6240\u6709\u7aef\u53e3\u4fe1\u606f<br>#show ip interface&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u6240\u6709\u7aef\u53e3\u4fe1\u606f<br>#show version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u7248\u672c\u4fe1\u606f<br>#show mac-address-table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u4ea4\u6362\u673a\u5f53\u524dMAC\u5730\u5740\u8868\u4fe1\u606f<br>#show running-config&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u5f53\u524d\u751f\u6548\u7684\u914d\u7f6e\u4fe1\u606f<br>#show vlan&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u6240\u6709VLAN\u4fe1\u606f<br>#show vlan id 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u67d0\u4e00VLAN (\u5982VLAN10)\u7684\u4fe1\u606f<br>#show interface fastethernet 0\/1&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u67d0\u4e00\u7aef\u53e3\u6a21\u5f0f(\u5982F 0\/1)<br>#show aggregateport 1 summary&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u805a\u5408\u7aef\u53e3AG1\u7684\u4fe1\u606f<br>#show spanning-tree&nbsp; &nbsp; &nbsp;&nbsp;\/\/\u67e5\u770b\u751f\u6210\u6811\u914d\u7f6e\u4fe1\u606f<br>#show spanning-tree interface fastethernet 0\/1&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u8be5\u7aef\u53e3\u7684\u751f\u6210\u6811\u72b6\u6001<br>#show port-security&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u4ea4\u6362\u673a\u7684\u7aef\u53e3\u5b89\u5168\u914d\u7f6e\u4fe1\u606f<br>#show port-security address&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u5730\u5740\u5b89\u5168\u7ed1\u5b9a\u914d\u7f6e\u4fe1\u606f<br>#show ip access-lists listname&nbsp;&nbsp;&nbsp;\/\/\u67e5\u770b\u540d\u4e3alistname\u7684\u5217\u8868\u7684\u914d\u7f6e\u4fe1\u606f<br>\u3000<br><br><strong>3\u3001\u7aef\u53e3\u7684\u57fa\u672c\u914d\u7f6e<\/strong><br>(config)#Interface fastethernet 0\/3&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u8fdb\u5165F0\/3\u7684\u7aef\u53e3\u914d\u7f6e\u6a21\u5f0f<br>(config)#interface range fa 0\/1-2,0\/5,0\/7-9&nbsp;&nbsp;&nbsp;\/\/\u8fdb\u5165F0\/1\u3001F0\/2\u3001F0\/5\u3001F0\/7\u3001F0\/8\u3001F0\/9\u7684\u7aef\u53e3\u914d\u7f6e\u6a21\u5f0f<br>(config-if)#speed 10&nbsp;&nbsp;&nbsp;\/\/\u914d\u7f6e\u7aef\u53e3\u901f\u7387\u4e3a10M,\u53ef\u900910,100,auto<br>(config-if)#duplex full&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u914d\u7f6e\u7aef\u53e3\u4e3a\u5168\u53cc\u5de5\u6a21\u5f0f,\u53ef\u9009full(\u5168\u53cc\u5de5),half(\u534a\u53cc\u5f0f),auto(\u81ea\u9002\u5e94)<br>(config-if)#no shutdown&nbsp; &nbsp;&nbsp;&nbsp;\/\/\u5f00\u542f\u8be5\u7aef\u53e3<br>(config-if)#switchport access vlan 10&nbsp;&nbsp;\/\/\u5c06\u8be5\u7aef\u53e3\u5212\u5165VLAN10\u4e2d,\u7528\u4e8eVLAN<br>(config-if)#switchport mode trunk&nbsp;&nbsp;&nbsp;\/\/\u5c06\u8be5\u7aef\u53e3\u8bbe\u4e3atrunk\u6a21\u5f0f,\u53ef\u9009\u6a21\u5f0f\u4e3aaccess , trunk<br>(config-if)#port-group 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5c06\u8be5\u7aef\u53e3\u5212\u5165\u805a\u5408\u7aef\u53e3AG1\u4e2d,\u7528\u4e8e\u805a\u5408\u7aef\u53e3<br><br><strong>4\u3001\u805a\u5408\u7aef\u53e3\u7684\u521b\u5efa<br><\/strong>(config)# interface aggregateport 1&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u521b\u5efa\u805a\u5408\u63a5\u53e3AG1<br>(config-if)# switchport mode trunk&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u914d\u7f6e\u5e76\u4fdd\u8bc1AG1\u4e3a trunk \u6a21\u5f0f<br>(config)#int f0\/23-24<br>(config-if-range)#port-group 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5c06\u7aef\u53e3\uff08\u7aef\u53e3\u7ec4\uff09\u5212\u5165\u805a\u5408\u7aef\u53e3AG1\u4e2d<br><br><\/p>\n\n\n\n<p><strong>5\u3001\u751f\u6210\u6811<br><\/strong><strong>\u914d\u7f6e\u591a\u751f\u6210\u6811\u534f\u8bae:<br><\/strong>switch(config)#spanning-tree&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u5f00\u542f\u751f\u6210\u6811\u534f\u8bae<br>switch(config)#spanning-tree mst configuration&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u5efa\u7acb\u591a\u751f\u6210\u6811\u534f\u8bae<br>switch(config-mst)#name ruijie&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u547d\u540d\u4e3aruijie<br>switch(config-mst)#revision 1&nbsp;&nbsp; \/\/\u8bbe\u5b9a\u6821\u8ba2\u672c\u4e3a1<br>switch(config-mst)#instance 0 vlan 10,20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u5efa\u7acb\u5b9e\u4f8b0<br>switch(config-mst)#instance 1 vlan 30,40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u5efa\u7acb\u5b9e\u4f8b1<br>switch(config)#spanning-tree mst 0 priority 4096&nbsp;&nbsp; \/\/\u8bbe\u7f6e\u4f18\u5148\u7ea7\u4e3a4096<br>switch(config)#spanning-tree mst 1 priority 8192&nbsp;&nbsp; \/\/\u8bbe\u7f6e\u4f18\u5148\u7ea7\u4e3a8192<br>switch(config)#interface vlan 10<br>switch(config-if)#vrrp 1 ip 192.168.10.1 \/\/\u6b64\u4e3avlan 10\u7684IP\u5730\u5740<br>switch(config)#interface vlan 20<br>switch(config-if)#vrrp 1 ip 192.168.20.1 \/\/\u6b64\u4e3avlan 20\u7684IP\u5730\u5740<br>switch(config)#interface vlan 30<br>switch(config-if)#vrrp 2 ip 192.168.30.1 \/\/\u6b64\u4e3avlan 30\u7684IP\u5730\u5740(\u53e6\u4e00\u4e09\u5c42\u4ea4\u6362\u673a)<br>switch(config)#interface vlan 40<br>switch(config-if)#vrrp 2 ip 192.168.40.1 \/\/\u6b64\u4e3avlan 40\u7684IP\u5730\u5740(\u53e6\u4e00\u4e09\u5c42\u4ea4\u6362\u673a)<\/p>\n\n\n\n<p><strong>6\u3001VLAN\u7684\u57fa\u672c\u914d\u7f6e<br><\/strong>(config)#vlan 10&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u521b\u5efaVLAN10<br>(config-vlan)#name vlanname&nbsp;\/\/&nbsp;\u547d\u540dVLAN\u4e3avlanname<br>(config-if)#switchport access vlan 10&nbsp;&nbsp;\/\/\u5c06\u8be5\u7aef\u53e3\u5212\u5165VLAN10\u4e2d<br>\u67d0\u7aef\u53e3\u7684\u63a5\u53e3\u914d\u7f6e\u6a21\u5f0f\u4e0b\u8fdb\u884c<br>(config)#interface vlan 10&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8fdb\u5165VLAN 10\u7684\u865a\u62df\u7aef\u53e3\u914d\u7f6e\u6a21\u5f0f<br>(config-if)# ip address 192.168.1.1 255.255.255.0&nbsp;&nbsp;\/\/\u4e3aVLAN10\u7684\u865a\u62df\u7aef\u53e3\u914d\u7f6eIP\u53ca\u63a9\u7801\uff0c\u4e8c\u5c42\u4ea4\u6362\u673a\u53ea\u80fd\u914d\u7f6e\u4e00\u4e2aIP\uff0c\u6b64IP\u662f\u4f5c\u4e3a\u7ba1\u7406IP\u4f7f\u7528\uff0c\u4f8b\u5982\uff0c\u4f7f\u7528Telnet\u7684\u65b9\u5f0f\u767b\u5f55\u7684IP\u5730\u5740<br>(config-if)# no shutdown&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u542f\u7528\u8be5\u7aef\u53e3<br><br><strong>7\u3001\u7aef\u53e3\u5b89\u5168<br><\/strong>(config)# interface fastethernet 0\/1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8fdb\u5165\u4e00\u4e2a\u7aef\u53e3<br>(config-if)# switchport port-security&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542f\u8be5\u7aef\u53e3\u7684\u5b89\u5168\u529f\u80fd<\/p>\n\n\n\n<p><br><strong>a\u3001\u914d\u7f6e\u6700\u5927\u8fde\u63a5\u6570\u9650\u5236<br><\/strong>(config-if)# switchport port-secruity maxmum 1&nbsp;\/\/\u914d\u7f6e\u7aef\u53e3\u7684\u6700\u5927\u8fde\u63a5\u6570\u4e3a1\uff0c\u6700\u5927\u8fde\u63a5\u6570\u4e3a128<br>(config-if)# switchport port-secruity violation shutdown&nbsp;<br>&nbsp;\/\/\u914d\u7f6e\u5b89\u5168\u8fdd\u4f8b\u7684\u5904\u7406\u65b9\u5f0f\u4e3ashutdown\uff0c\u53ef\u9009\u4e3aprotect (\u5f53\u5b89\u5168\u5730\u5740\u6570\u6ee1\u540e\uff0c\u5c06\u672a\u77e5\u540d\u5730\u5740\u4e22\u5f03)\u3001restrict(\u5f53\u8fdd\u4f8b\u65f6\uff0c\u53d1\u9001\u4e00\u4e2aTrap\u901a\u77e5)\u3001shutdown(\u5f53\u8fdd\u4f8b\u65f6\u5c06\u7aef\u53e3\u5173\u95ed\uff0c\u5e76\u53d1\u9001Trap\u901a\u77e5\uff0c\u53ef\u5728\u5168\u5c40\u6a21\u5f0f\u4e0b\u7528errdisable recovery\u6765\u6062\u590d)<\/p>\n\n\n\n<p><br><strong>b\u3001IP\u548cMAC\u5730\u5740\u7ed1\u5b9a<br><\/strong>(config-if)#switchport port-security mac-address xxxx.xxxx.xxxx ip-address 172.16.1.1&nbsp;<br>&nbsp;\/\/\u63a5\u53e3\u914d\u7f6e\u6a21\u5f0f\u4e0b\u914d\u7f6eMAC\u5730\u5740xxxx.xxxx.xxxx\u548cIP172.16.1.1\u8fdb\u884c\u7ed1\u5b9a(MAC\u5730\u5740\u6ce8\u610f\u7528\u5c0f\u5199)<br><br><strong>8\u3001\u4e09\u5c42\u8def\u7531\u529f\u80fd(\u9488\u5bf9\u4e09\u5c42\u4ea4\u6362\u673a)<br><\/strong>(config)# ip routing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542f\u4e09\u5c42\u4ea4\u6362\u673a\u7684\u8def\u7531\u529f\u80fd<br>(config)# interface fastethernet 0\/1&nbsp;&nbsp; &nbsp;<br>(config-if)# no switchport&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542f\u7aef\u53e3\u7684\u4e09\u5c42\u8def\u7531\u529f\u80fd(\u8fd9\u6837\u5c31\u53ef\u4ee5\u4e3a\u67d0\u4e00\u7aef\u53e3\u914d\u7f6eIP)<br>(config-if)# ip address 192.168.1.1 255.255.255.0&nbsp;<br>(config-if)# no shutdown&nbsp;<br>\u3000\u3000<\/p>\n\n\n\n<p><strong>9\u3001\u4e09\u5c42\u4ea4\u6362\u673a\u8def\u7531\u534f\u8bae<br><\/strong>(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1&nbsp;&nbsp;&nbsp;\/\/\u914d\u7f6e\u9759\u6001\u8def\u7531<\/p>\n\n\n\n<p><strong>\u6ce8:<\/strong>172.16.1.0 255.255.255.0&nbsp;&nbsp;\u4e3a\u76ee\u6807\u7f51\u7edc\u7684\u7f51\u7edc\u53f7\u53ca\u5b50\u7f51\u63a9\u7801<br>172.16.2.1 \u4e3a\u4e0b\u4e00\u8df3\u7684\u5730\u5740\uff0c\u4e5f\u53ef\u7528\u63a5\u53e3\u8868\u793a,\u5982ip route 172.16.1.0 255.255.255.0 serial 1\/2(172.16.2.0\u6240\u63a5\u7684\u7aef\u53e3)<\/p>\n\n\n\n<p>(config)# router rip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542fRIP\u534f\u8bae\u8fdb\u7a0b<br>(config-router)# network 172.16.1.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u7533\u660e\u672c\u8bbe\u5907\u7684\u76f4\u8fde\u7f51\u6bb5\u4fe1\u606f<br>(config-router)# version 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542fRIP V2\uff0c\u53ef\u9009\u4e3aversion 1(RIPV1)\u3001version 2(RIPV2)&nbsp;<br>(config-router)# no auto-summary&nbsp;&nbsp;&nbsp;\/\/\u5173\u95ed\u8def\u7531\u4fe1\u606f\u7684\u81ea\u52a8\u6c47\u603b\u529f\u80fd(\u53ea\u6709\u5728RIPV2\u652f\u6301)<br><br>(config)# router ospf&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542fOSPF\u8def\u7531\u534f\u8bae\u8fdb\u7a0b\uff08\u9488\u5bf91762\uff0c\u65e0\u9700\u4f7f\u7528\u8fdb\u7a0bID\uff09<br>(config)# router ospf 1&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f00\u542fOSPF\u8def\u7531\u534f\u8bae\u8fdb\u7a0b\uff08\u9488\u5bf92501\uff0c\u9700\u8981\u52a0OSPF\u8fdb\u7a0bID\uff09<br>(config-router)# network 192.168.1.0 0.0.0.255 area 0&nbsp; &nbsp;<br>&nbsp;\/\/\u7533\u660e\u76f4\u8fde\u7f51\u6bb5\u4fe1\u606f\uff0c\u5e76\u5206\u914d\u533a\u57df\u53f7(area0\u4e3a\u9aa8\u5e72\u533a\u57df)<br><br><strong>10\u3001IP ACL\uff1a<br><\/strong>\u4ea4\u6362\u673a\u91c7\u7528\u547d\u540d\u7684\u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff1b\u5206\u6807\u51c6(stand)\u548c\u6269\u5c55(extended)\u4e24\u79cd<br><strong>a\u3001\u6807\u51c6ACL<br><\/strong>(config)#ip access-list stand listname&nbsp;\/\/\u5b9a\u4e49\u547d\u540d\u6807\u51c6\u5217\u8868\uff0c\u547d\u540d\u4e3alistname\uff0cstand\u4e3a\u6807\u51c6\u5217\u8868<br>(config-std-nacl)#deny 192.168.30.0 0.0.0.255&nbsp;\/\/\u62d2\u7edd\u6765\u81ea192.168.30.0\u7f51\u6bb5\u7684IP\u6d41\u91cf\u901a\u8fc7<br><strong><br><\/strong><\/p>\n\n\n\n<p><strong>\u6ce8\uff1a<\/strong>deny\uff1a\u62d2\u7edd\u901a\u8fc7\uff1b\u53ef\u9009\uff1adeny(\u62d2\u7edd\u901a\u8fc7)\u3001permit(\u5141\u8bb8\u901a\u8fc7)<br>192.168.30.0 0.0.0.255\uff1a\u6e90\u5730\u5740\u53ca\u6e90\u5730\u5740\u901a\u914d\u7b26\uff1b\u53ef\u4f7f\u7528any\u8868\u793a\u4efb\u4f55IP<br>(config-std-nacl)#permit any<br>(config-std-nacl)#end&nbsp; &nbsp;\/\/\u8fd4\u56de<br><\/p>\n\n\n\n<p><strong>b\u3001\u6269\u5c55ACL<br><\/strong>(config)#ip access-list extended listname&nbsp;<br>\/\/\u5b9a\u4e49\u547d\u540d\u6269\u5c55\u5217\u8868\uff0c\u547d\u540d\u4e3alistname,extended\u4e3a\u6269\u5c55<br>(config-ext-nacl)#deny tcp 192.168.30.0 0.0.0.255 192.168.10.0 0.0.0.255 eq www&nbsp;&nbsp;\/\/\u62d2\u7edd\u6e90\u5730\u5740\u4e3a192.168.30.0\u7f51\u6bb5\u7684IP\u8bbf\u95ee\u76ee\u7684\u5730\u5740\u4e3a192.168.10.0\u7f51\u6bb5\u7684WWW\u670d\u52a1<br>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u6ce8\uff1a<\/strong>deny\uff1a\u62d2\u7edd\u901a\u8fc7\uff0c\u53ef\u9009\uff1adeny(\u62d2\u7edd\u901a\u8fc7)\u3001permit(\u5141\u8bb8\u901a\u8fc7)<br>\u3000\u3000tcp: \u534f\u8bae\u540d\u79f0\uff0c\u534f\u8bae\u53ef\u4ee5\u662fudp, ip\uff0ceigrp, gre, icmp, igmp, igrp\u7b49\u7b49\u3002<br>\u3000\u3000192.168.10.0 0.0.0.255\uff1a\u6e90\u5730\u5740\u53ca\u6e90\u5730\u5740\u901a\u914d\u7b26<br>\u3000\u3000192.168.30.0 0.0.0.255\uff1a\u76ee\u7684\u5730\u5740\u53ca\u76ee\u7684\u5730\u5740\u901a\u914d\u7b26<br>\u3000\u3000eq\uff1a\u64cd\u4f5c\u7b26\uff08lt-\u5c0f\u4e8e\uff0ceq-\u7b49\u4e8e\uff0cgt-\u5927\u4e8e\uff0cneg-\u4e0d\u7b49\u4e8e\uff0crange-\u5305\u542b\uff09&nbsp;<br>\u3000\u3000www\uff1a\u7aef\u53e3\u53f7\uff0c\u53ef\u4f7f\u7528\u540d\u79f0\u6216\u5177\u4f53\u7f16\u53f7<br>\u3000\u3000\u53ef\u4ee5\u4f7f\u7528\u7684\u534f\u8bae\u540d\u79f0\uff08\u6216\u7f16\u53f7\uff09\u548c\u7aef\u53e3\u540d\u79f0\uff08\u6216\u7f16\u53f7\uff09\u8bf7\u6253\uff1f\u67e5\u8be2\u3002<\/p>\n\n\n\n<p><br>(config-ext-nacl)#permit ip any any&nbsp;&nbsp;&nbsp;\/\/\u5141\u8bb8\u5176\u5b83\u901a\u8fc7<br>(config-ext-nacl)#end&nbsp; &nbsp; &nbsp;&nbsp;\/\/\u8fd4\u56de<br>(config)#interface vlan 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8fdb\u5165\u7aef\u53e3\u914d\u7f6e\u6a21\u5f0f<br>(config-if)# ip access-group listname in&nbsp;&nbsp;&nbsp;\/\/\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u5728\u7aef\u53e3\u4e0bin\u65b9\u5411\u5e94\u7528\uff1b\u53ef\u9009\uff1ain(\u5165\u6808)\u3001out(\u51fa\u6808)<br>(config-if)#end&nbsp; &nbsp; &nbsp;\/\/\u8fd4\u56de<\/p>\n\n\n\n<p><br><strong>\u6ce8\uff1a<\/strong>\u914d\u7f6eACL\u65f6\uff0c\u82e5\u53ea\u60f3\u5bf9\u5176\u4e2d\u90e8\u5206IP\u8fdb\u884c\u9650\u5236\u8bbf\u95ee\u65f6\uff0c\u5fc5\u987b\u914d\u7f6e\u5141\u8bb8\u5176\u6d41\u91cf\u901a\u8fc7\uff0c\u5426\u5219\u8bbe\u5907\u53ea\u4f1a\u5bf9\u9650\u5236IP\u8fdb\u884c\u5904\u7406\uff0c\u4e0d\u4f1a\u5bf9\u975e\u9650\u5236IP\u8fdb\u884c\u5141\u8bb8\u901a\u8fc7\u5904\u7406\u3002<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u529f\u80fd\u914d\u7f6e\u547d\u4ee4\u793a\u4f8b<\/strong><strong>\u4ea4\u6362\u673a\u5bc6\u7801<br><\/strong>(config)#enable secret level 1 0 100<br>(config)#enable secret level 15 0 100<br><strong>\u8fdc\u7a0b\u767b\u5165\u5bc6\u7801<br><\/strong>(config)#line vty 0 4<br>(config-line)#password 100<br>(config-line)#end<br><strong>\u4ea4\u6362\u673a\u7ba1\u7406IP<br><\/strong>(config)#interface vlan 1<br>(config-if)#ip address 192.168.1.10 255.255.255.0<br>(config-if)#no shutdown<br><strong>\u4fee\u6539\u4ea4\u6362\u673a\u8001\u5316\u65f6\u95f4<br><\/strong>(config)#mac-address-table aging-time 20<br>(config)#end<br><strong>\u6dfb\u5220vlan<br><\/strong>(config)#vlan 888<br>(config-vlan)#name a888<br>(config)#no vlan 888<br><strong>\u6dfb\u52a0access\u53e3<br><\/strong>(config)#interface gigabitEthernet 0\/10<br>(config-if)#switchport mode access<br>(config-if)#switchport access vlan 10<br><strong>\u5207\u6362assess trunk<br><\/strong>(config-if)#switchport mode access<br>(config-if)#switchport mode trunk<br><strong>\u6307\u5b9a\u7279\u5b9a\u4e00\u4e2anative vlan<br><\/strong>(config-if)#switchport trunk native vlan 10<br><strong>\u914d\u7f6e\u7f51\u5173\uff1a<br><\/strong>switch(config)#ip default-gateway 192.168.1.254&nbsp;<\/p>\n\n\n\n<p><strong>\u663e\u793a\u63a5\u53e3\u8be6\u7ec6\u4fe1\u606f\u7684\u547d\u4ee4<br><\/strong>show interfaces gigabitEthernet 4\/1 counters<br><strong>\u63a5\u53e3\u914d\u7f6e<br><\/strong>Switch(config)#interface gigabitethernet 0\/1&nbsp;<br><strong>\u628a\u63a5\u53e3\u5de5\u4f5c\u6a21\u5f0f\u6539\u4e3a\u5149\u53e3\u3002<br><\/strong>Switch(config-if)#medium-type fiber<br><strong>\u628a\u63a5\u53e3\u5de5\u4f5c\u6a21\u5f0f\u6539\u4e3a\u7535\u53e3\u3002<br><\/strong>Switch(config-if)#medium-type copper<\/p>\n\n\n\n<p><strong>VLAN\u914d\u7f6e<\/strong><br>\u5efa\u7acbVLAN 100<br>Switch (config)#vlan 100<br>\u8be5VLAN\u540d\u79f0\u4e3aruijie<br>Switch (config)#name ruijie<br>\u5c06\u4ea4\u6362\u673a\u63a5\u53e3\u5212\u5165VLAN \u4e2d\uff1a<br>range\u8868\u793a\u9009\u53d6\u4e86\u7cfb\u5217\u7aef\u53e31-48\uff0c\u8fd9\u4e2a\u5bf9\u591a\u4e2a\u7aef\u53e3\u8fdb\u884c\u76f8\u540c\u914d\u7f6e\u65f6\u975e\u5e38\u6709\u7528\u3002<br>Switch (config)#interface range f 0\/1-48&nbsp;<br>\u5c06\u63a5\u53e3\u5212\u5230VLAN 100\u4e2d\u3002<br>Switch (config-if-range)#switchport access vlan 100&nbsp; &nbsp;<br>\u5c06\u63a5\u53e3\u5212\u56de\u5230\u9ed8\u8ba4VLAN 1\u4e2d\uff0c\u5373\u7aef\u53e3\u521d\u59cb\u914d\u7f6e\u3002<br>Switch (config-if-range)#no switchport access vlan&nbsp;<br>Switch(config)#interface fastEthernet 0\/1<br>\u8be5\u7aef\u53e3\u5de5\u4f5c\u5728access\u6a21\u5f0f\u4e0b<br>Switch(config-if)#switchport mode access&nbsp; &nbsp;<br>\u8be5\u7aef\u53e3\u5de5\u4f5c\u5728trunk\u6a21\u5f0f\u4e0b<br>Switch(config-if)#switchport mode trunk&nbsp;&nbsp; &nbsp;<br>Switch(config)#interface fastEthernet 0\/2<\/p>\n\n\n\n<p><strong>\u8def\u7531\u914d\u7f6e\uff1a\u6dfb\u52a0\u4e00\u6761\u8def\u7531\u3002<br><\/strong>switch (config)#ip route \u76ee\u7684\u5730\u5740 \u63a9\u7801 \u4e0b\u4e00\u8df3&nbsp;&nbsp; &nbsp;<br>switch (config)#ip route 210.10.10.0 255.255.255.0 218.8.8.8\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u57fa\u7840\u914d\u7f6e\u547d\u4ee4 1\u3001\u51c6\u5907\u547d\u4ee4&nbsp; &gt;Enable \u8fdb\u5165\u7279\u6743\u6a21\u5f0f#Exit&nbsp;&#038;nbsp &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/b.yesiyu.top\/?p=194\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u9510\u6377\u4ea4\u6362\u673a\u7684\u914d\u7f6e\u547d\u4ee4\u5927\u5168\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":1,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/b.yesiyu.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}