实验名称:交换机端口安全小实验
实验目的:熟练运用和配置交换机端口安全
实验设计:
1、 在左侧交换机上配置端口安全,控制右边交换机连接的pc数量
2、 当右边连接数超过限制时,终止连接或不转发多余pc机的流量
实验拓扑:
实验主要配置语句:
Switch>en
Switch#conf t
Switch(config)#int f0/5
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum 3
Switch(config-if)#switchport port-security mac-address sticky
Switch(config-if)#switchport port-security violation shutdown(或者设置为protect不转发流量)
Switch(config-if)#exit
Switch#show port-security address
Secure Mac Address Table
-------------------------------------------------------------------------------
Vlan Mac Address Type Ports Remaining Age
(mins)
---- ----------- ---- ----- -------------
1 0001.9624.0CBB SecureConfigured FastEthernet0/1 -
1 0005.5EA7.3447 SecureSticky FastEthernet0/5 -
1 0090.0C72.D8D5 SecureSticky FastEthernet0/5 -
1 0006.2A65.2705 DynamicConfigured FastEthernet0/5 -
------------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port) : 2
Max Addresses limit in System (excluding one mac per port) : 1024
(show mac-address-table):
Switch#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0005.5ea7.3447 STATIC Fa0/5
1 0006.2a65.2705 STATIC Fa0/5
1 0090.0c72.d8d5 STATIC Fa0/5
注:
Switch(config-if)#switchport port-security maximum 3实际上还包含两台交换机之间的连接点的mac地址,所以限制的是2台pc,当添加第三台时就会不通。当然事先需要从右边的pc分别ping左边的pc,这样sticky才会记录.