mac-address-table static的作用

实验一下mac-address-table static的作用

----------------------------------------------------------------------------

Switch#show run
Building configuration...

interface 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值