分类: 系统运维
2012-07-06 16:57:02
实验一下mac-address-table static的作用
----------------------------------------------------------------------------
Switch#show run
Building configuration...
FastEthernet0/1
switchport access vlan 2
switchport mode access
!
interface FastEthernet0/2
switchport access vlan 2
switchport mode access
interface Vlan2
ip address 192.168.2.254 255.255.255.0
.....
end
-----------------------------------------------------------------------------
pc1:192.168.2.1/0000.0C72.1AD6
pc2:192.168.2.2/0001.630A.E8D9
-----------------------------------------------------------------------------
pc1接入interface FastEthernet0/2
pc2接入interface FastEthernet0/1
均可ping通
-----------------------------------------------------------------------------
Switch#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
2 0000.0c72.1ad6 DYNAMIC Fa0/2
2 0001.630a.e8d9 DYNAMIC Fa0/1
-----------------------------------------------------------------------------
增加配置
Switch(config)#mac-address-table static 0000.0c72.1ad6 vlan 2 interface FastEthernet0/1
Switch(config)#do show mac
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
2 0000.0c72.1ad6 STATIC Fa0/1
2 0001.630a.e8d9 DYNAMIC Fa0/1
---------------------------------------------------------------
此时
pc1:192.168.2.1/0000.0C72.1AD6接入interface FastEthernet0/2无法ping通192.168.2.254
pc2正常
--------------------------------------------------------------
进一步测试,增加配置
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
interface Vlan3
ip address 192.168.3.254 255.255.255.0
--------------------------------------------------------------
pc1:192.168.3.1/0000.0C72.1AD6接入interface FastEthernet0/3
可以ping通192.168.3.254
Switch(config-if)#do show mac
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
2 0000.0c72.1ad6 STATIC Fa0/1
2 0001.630a.e8d9 DYNAMIC Fa0/1
3 0000.0c72.1ad6 DYNAMIC Fa0/3
---------------------------------------------------------------
结论:mac-address-table static 0000.0c72.1ad6 vlan 2 interface FastEthernet0/1
静态绑定mac地址0000.0c72.1ad6
当mac地址为0000.0c72.1ad6 的终端接入vlan 2时,必须接入FastEthernet0/1口
·接入其他加入vlan 2的接口,无法通信
·其他mac接入FastEthernet0/1不受影响
·0000.0c72.1ad6 接入其他vlan不受影响
·mac-address-table static 绑定的端口不能启用switchport port-security