该示例中记录了Cat2960的MAC地址情况:
Cat2960#sho mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
All 0100.0ccc.cccc STATIC CPU
All 0100.0ccc.cccd STATIC CPU
All 0180.c200.0000 STATIC CPU
All 0180.c200.0001 STATIC CPU
All 0180.c200.0002 STATIC CPU
All 0180.c200.0003 STATIC CPU
All 0180.c200.0004 STATIC CPU
All 0180.c200.0005 STATIC CPU
All 0180.c200.0006 STATIC CPU
All 0180.c200.0007 STATIC CPU
All 0180.c200.0008 STATIC CPU
All 0180.c200.0009 STATIC CPU
All 0180.c200.000a STATIC CPU
All 0180.c200.000b STATIC CPU
All 0180.c200.000c STATIC CPU
All 0180.c200.000d STATIC CPU
All 0180.c200.000e STATIC CPU
All 0180.c200.000f STATIC CPU
All 0180.c200.0010 STATIC CPU
All ffff.ffff.ffff STATIC CPU
Total Mac Addresses for this criterion: 20
在有些设备上,可以看到例如SVI接口的MAC地址都是一样的,这取决于交换机的架构问题,可能是正常的。
接下来,查看一下2960上SVI的MAC地址,这里有4个VLAN
Cat2960#sho vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/2, Fa0/4, Fa0/5, Fa0/7
Fa0/8, Gi0/1
10 VLAN0010 active Fa0/3
100 VLAN0100 active
192 VLAN0192 active Fa0/1, Fa0/6
Cat2960#show int vlan 1 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a40 (bia dc7b.949f.9a40)
Cat2960#show int vlan 10 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a42 (bia dc7b.949f.9a42)
Cat2960#show int vlan 100 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a43 (bia dc7b.949f.9a43)
Cat2960#show int vlan 192 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a41 (bia dc7b.949f.9a41)
可以看到这4个SVI的MAC地址不同,只有最后一位不一样,但为什么SVI192的MAC最后一位是1?因为SVI 1最开始就有,第二个创建的是SVI 192,SVI 10和SVI 100是接下来再创建的。我们可以测试一下,删除SVI 192.然后再添加SVI 192.
Cat2960(config)#no int vlan 192
Cat2960(config)#int vlan 192
*Mar 1 00:38:33.812: %LINK-5-CHANGED: Interface Vlan192, changed state to administratively down
*Mar 1 00:38:36.438: %LINK-3-UPDOWN: Interface Vlan192, changed state to up
Cat2960(config-if)#do sho int vlan 192 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a41 (bia dc7b.949f.9a41)
发现没有改变,重启之后再查看:
Cat2960#wr mem
Building configuration...
[OK]
Cat2960#reload
Proceed with reload? [confirm]
*Mar 1 00:59:48.411: %SYS-5-RELOAD: Reload requested by console. Reload reason: Reload command
......
Cat2960#show int vlan 192 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a43 (bia dc7b.949f.9a43)
可以看到已经改变:
Cat2960#show int vlan 1 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a40 (bia dc7b.949f.9a40)
Cat2960#show int vlan 10 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a41 (bia dc7b.949f.9a41)
Cat2960#show int vlan 100 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a42 (bia dc7b.949f.9a42)
Cat2960#show int vlan 192 | in Hardware
Hardware is EtherSVI, address is dc7b.949f.9a43 (bia dc7b.949f.9a43)
所以,交换机根据先后配置的SVI,按序分配MAC地址,一般从最后一位开始+1
但是有的交换机的SVI MAC地址也是一样的,好像Cat4500就是把。
这里还有九个物理接口:
Cat2960#sh ip int brief
Interface IP-Address OK? Method Status Protocol
Vlan1 unassigned YES NVRAM up down
Vlan10 unassigned YES NVRAM up down
Vlan100 unassigned YES NVRAM up down
Vlan192 unassigned YES NVRAM up down
FastEthernet0/1 unassigned YES unset down down
FastEthernet0/2 unassigned YES unset down down
FastEthernet0/3 unassigned YES unset down down
FastEthernet0/4 unassigned YES unset down down
FastEthernet0/5 unassigned YES unset down down
FastEthernet0/6 unassigned YES unset down down
FastEthernet0/7 unassigned YES unset down down
FastEthernet0/8 unassigned YES unset down down
GigabitEthernet0/1 unassigned YES unset down down
依次看看物理接口的MAC地址:
Cat2960#sho int f0/1 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a01 (bia dc7b.949f.9a01)
Cat2960#sho int f0/2 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a02 (bia dc7b.949f.9a02)
Cat2960#sho int f0/3 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a03 (bia dc7b.949f.9a03)
Cat2960#sho int f0/4 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a04 (bia dc7b.949f.9a04)
Cat2960#sho int f0/5 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a05 (bia dc7b.949f.9a05)
Cat2960#sho int f0/6 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a06 (bia dc7b.949f.9a06)
Cat2960#sho int f0/7 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a07 (bia dc7b.949f.9a07)
Cat2960#sho int f0/8 | in Hardware
Hardware is Fast Ethernet, address is dc7b.949f.9a08 (bia dc7b.949f.9a08)
Cat2960#sho int G0/1 | in Hardware
Hardware is Gigabit Ethernet, address is dc7b.949f.9a09 (bia dc7b.949f.9a09)
相信接口上的也是,先加载哪个接口,哪个接口的MAC地址就更小。