在一些实际的Cisco设备生成树管理中,往往需要把原来的PVST+模式迁移到性能更佳的Rapi-PVST+模式,甚至MSTP模式中。在与读者朋友的交流过程中也有读者经常问我是否有这样的经典案例。为此,本篇就从我将于本月底上市的最新图书《Cisco/H3C交换机配置与管理完全手册》(第二版)中摘选一个这样的经典案例供大家参考。本节介绍的是一个经典的PVST+到Rapid-PVST+的迁移完整配置案例,非常具有代表性,基本上都可以直接用于实际的网络维护中。
本示例中交换机的IOS系统是采用12.2(25)系列,CatOS 系列采用的是8.5(8)系列。
下面先来回顾一下与Rapid-PVST+生成树模式相关的主要基础知识。IEEE 802.1D STP具有收敛性能差的不足,Cisco支持三种生成树模式:PVST+、Rapid-PVST+ 和MSTP。PVST+是基于IEEE802.1D STP而改进开发的,支持BackboneFast、UplinkFast和PortFast增强特性。Rapid-PVST+是基于IEEE 802.1w RSTP而改进开发的,比STP具有更快的收敛速度。IEEE 802.1w RSTP支持Cisco开发的PVST+中的STP增强特性,如BackboneFast和UplinkFast。但Cisco自己开发的Rapid-PVST+有以下惟一特性:
l 使用兼容IEEE 802.1D STP BPDU版本0的BPDU版本2。
l 所有交换机产生BPDU,并每隔2秒在所有端口发送BPDU,而IEEE 802.1D STP仅在根交换机上发送配置BPDU。
l 四种Port Roles(端口角色)—Root port(根端口)、designated port(指定端口)、alternate port(替代端口)和backup port(备份端口)。
l 三种Port States(端口状态)—Discarding(丢弃)、Learning(学习)和Forwarding(转发)。
l 三种Port Types(端口类型)—Edge Port (边缘端口)、Point-to-Point Port(点对点端口)和Shared port(共享端口)。
Rapid-PVST+使用RSTP来提供更快的收敛。当RSTP端口从接收到来自邻接交换机早期的802.1D BPDU时,它将转换成IEEE 802.1D STP模式,这样就失去了RSTP所具有的快速收敛性能。
本示例的拓扑结构如图12-3所示。
图12-3 从PVST+模式迁移到Rapid-PVST+模式的拓扑示例
在这个拓扑结构中,包括以下交换机:两台分布层交换机Distribution1和Distribution2,两台接入层交换机Access1(使用IOS系统)和Access2(使用CatOS系统),两台汇聚层交换机Services1和Services2。其中的VLANs 10、30、100承载数据通信,而VLANs 20、40、200承载语通信。另外,需要在两台分布层交换机之间,以及两台汇聚层交换机之间的互联双链路中,一条承载数据VLAN中的通信,另一条承载语VLAN中的通信,以实现负载负载均衡。
整个生成树模式迁移配置包括两部分:一部分是查看网络中交换机上的PVST+配置,理解各交换机上的原有配置,另一部分是把PVST+模式迁移到Rapid-PVST+模式,同样要实现原来PVST+模式下的各项负载均衡目的。下面用两个小节分别予以介绍。
12.6.1 两台分布层交换机的原始PVST+生成树配置以下是此示例中原来配置PVST+生成树模式的交换机,以承载数据和语音通信的配置。
在Distribution1交换机上通过spanning-tree vlan 10,30,100 root primary全局配置模式命令配置作为VLANs 10、30、100的根交换机,同时把此台交换机在这些VLAN中的交换机优先级值设为8192;通过spanning-tree vlan 20,40,200 root secondary全局配置模式命令配置作为VLANs 20、40、200的从根交换机,同时把此台交换机在这些VLAN中的交换机优先级值设为16384。
在Distribution2交换机上通过spanning-tree vlan 20,40,200 root primary全局配置模式命令配置作为VLANs 20、40、200的根交换机,把此台交换机在这些VLAN中的交换机优先级值设为8192(注意,优先级数值越小,优先级别越高);通过spanning-tree vlan 10,30,100 root secondary全局配置模式命令配置作为VLANs 10、30、100的从根交换机,把此台交换机在这些VLAN中的交换机优先级值设为16384。
在所有交换机上配置spanning-tree backbonefast接口配置模式命令,使得它们支持backbonefast特性,在间接链路失效时进行快速生成树收敛;在所有接入层交换机上配置spanning-tree uplinkfast接口配置模式命令,使它们支持生成树特性,实现在直接连接失效时的快速生成树生成树收敛。
Distribution1交换机上的原始PVST+配置(可通过show running-config特权模式命令查看):
Distribution1#show running-config
Building configuration...
spanning-tree mode pvst
spanning-tree extend system-id
spanning-tree backbonefast
!---以下两条配置是通过为该交换机针对不同VLAN设置不同的优先级来实现该交换机担当VLAN 10、30、100的根交换机,担当VLAN 20、40、200的从根交换机
spanning-tree vlan 10,30,100 priority 8192 root primary
spanning-tree vlan 20,40,200 priority 16384 root secondary
!
vlan 10,20,30,40,100,200
!
interface FastEthernet1/0/1
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
!
interface FastEthernet1/0/3
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 30,40
!
interface FastEthernet1/0/5
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 100,200
!
interface FastEthernet1/0/23
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20,30,40,100,200
!
interface FastEthernet1/0/24
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20,30,40,100,200
!
!
end
Distribution2交换机上的原始PVST+配置(可通过show running-config特权模式命令查看):
Distribution2#show running-config
Building configuration...
!
spanning-tree mode pvst
spanning-tree extend system-id
spanning-tree backbonefast
!---以下两条配置是通过为该交换机针对不同VLAN设置不同的优先级来实现该交换机担当VLAN 20、40、200的根交换机,担当VLAN 10、30、100的从根交换机
spanning-tree vlan 10,30,100 priority 16384 root secondary
spanning-tree vlan 20,40,200 priority 8192 root primary
!
vlan 10,20,30,40,100,200
!
interface FastEthernet1/0/2
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
!
interface FastEthernet1/0/4
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 30,40
!
interface FastEthernet1/0/6
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 100,200
!
interface FastEthernet1/0/23
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20,30,40,100,200
!
interface FastEthernet1/0/24
switchport trunk encapsulation dot1q
switchport mode trunk
spanning-tree vlan 20,40,200 port-priority 64
switchport trunk allowed vlan 10,20,30,40,100,200
end
Distribution2被配置作为VLAN 20、40、200这三个VLAN的根交换机,它通过fa1/0/23 和fa1/0/24两个端口与Distribution1进行连接。这两个端口都是作为VLAN 20、40、200这三个VLAN的指定端口,因为Distribution2是作为这些VLAN的根交换机。而且这两个端口都是采用默认的优先级值(128),所以这两个端口到达Distribution1上的fa1/0/23和fa1/0/24端口的开销值(因为它们具有相同的接口类型)也是一样的。Distribution1交换机会选择这两个端口中最低端口号的端口——fa1/0/23置于转发状态。但是按照要求,语音VLAN 20、40、200是要允许通过两交换机上的fa1/0/24端口进行传输,所以你可以通过以下方法之一来实现:
l 降低Distribution1上的fa1/0/24端口的开销值,提高其优先级别;
l 降低Distribution2上的fa1/0/24端口的端口优先级值,提高其优先级别。
在本示例中是通过降低Distribution2上的fa1/0/24端口的端口优先级值为64(就是“spanning-tree vlan 20,40,200 port-priority 64”这句配置),以此来提高该端口的优先级别,实现VLAN 20、40、200中的通信在fa1/0/24端口上通过。所在在Distribution2交换机的fa1/0/24端口上就有spanning-tree vlan 20,40,200 port-priority 64这样一条配置。
【经验之谈】看到这里,细心的朋友可能会提出这样一个疑问,那就是从拓扑结构中可以看出,是希望在两交换机的fa1/0/23端口链路上优先传输VLAN 10、30、100数据VLAN中的通信(在fa1/0/24端口链路上优先传输VLAN 20、40、200证音VLAN中的通信),可为什么在以上的Distribution1交换机配置中没有像Distribution2交换机上那样为fa1/0/23端口配置更高的优先级呢?那是因为Distribution1已是作为VLAN 10、30、100的根交换机,对于VLAN 10、30、100来说,它上面的端口(包括fa1/0/23端口和fa1/0/24端口等)都是指定端口,都是呈转发状态的。再加上fa1/0/23端口与fa1/0/24端口相比,开销值一样,但端口ID更小,所以VLAN 10、30、100中的通信自动会优先选择fa1/0/23端口进行传输的,所以无需另外配置高的优先级别。其实也正如此,在Distribution2交换机上才需要要提高fa1/0/24端口在VLAN 20、40、100语音VLAN通信,至于原因这在前面都有说明。
12.6.2 两台汇聚层交换机上的原始PVST+生成树配置Services1交换机的原始PVST+配置(可通过show running-config特权模式命令查看):
Services1#show running-config
Building configuration...
spanning-tree mode pvst
spanning-tree portfast bpduguard default
spanning-tree extend system-id
spanning-tree backbonefast
!
vlan 100,200
!
interface FastEthernet0/5
switchport trunk encapsulation dot1q
switchport mode trunk
spanning-tree vlan 100 cost 18 !---降低FastEthernet0/5在VLAN 200中的路径开销(相当于提高了它在VLAN 200中的优先级别)
switchport trunk allowed vlan 100,200
!
interface FastEthernet0/47
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 100,200
!
interface FastEthernet0/48
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 100,200
!
!
end
Services2交换机的原始PVST+配置(可通过show running-config特权模式命令查看):
Services2#show running-config
Building configuration...
spanning-tree mode pvst
spanning-tree portfast bpduguard default
spanning-tree extend system-id
spanning-tree backbonefast
!
vlan 100,200
!
interface FastEthernet0/6
switchport trunk encapsulation dot1q
switchport mode trunk
spanning-tree vlan 200 cost 18 !---降低FastEthernet0/6在VLAN 200中的路径开销(相当于提高了它在VLAN 200中的优先级别)
switchport trunk allowed vlan 100,200
!
interface FastEthernet0/47
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 100,200
!
interface FastEthernet0/48
switchport trunk encapsulation dot1q
switchport mode trunk
spanning-tree vlan 200 port-priority 64 !---提高FastEthernet0/48在VLAN 200中的优先级别
switchport trunk allowed vlan 100,200
!
!
end
从以上可以看出,已在Services1交换机上的fa0/5和Services2交换机上的fa0/6端口配置了生成树端口开销,在Services2交换机上fa0/48端口上配置优先级值。同时,通过在这两台交换机上的中继端口上配置VLAN中继修剪配置,使得Services1和Services2交换机中的VLAN 100和VLAN 200通信分别在这两台交换机间的中继链路上通过。如果没有为两个端口应用这些生成树配置,则Services1和Services2交换机不会在它们之间的中继链路上有通信通过,而是会选择通过Distribution1和 Distribution2分布层交换机通过。
从如图12-3中可以看出,Services2有两条相等开销的路径到达VLAN 100的根交换机——Distribution1。一条是通过Services1,而另一条是通过Distribution2。这显然不行,得阻塞其中一条,生成树协议会按以下顺序选择最佳的路径:
(1)路径开销
(2)转发交换机的网桥ID,也就是交换机优先级
(3)最低的端口优先级
(4)最低的端口号
在本示例中,通过配置,虽然Services2到达VLAN 100的根(Distribution1)的两条路径具有相同的开销,但是在VLAN 100中,Distribution2(16384)比Services1(默认的32768)具有更低的优先级值(也就是优先级别更高),所以Services2会选择Distribution2来到达Distribution1。但这里又要注意了,在Services1交换机上fa0/5的端口开销值更低(是通过示例中手动配置实现的),又使得Services2选择Services1。这样一来,最终Services2会选择Services1到达Distribution1,而覆盖了前面所说的Distribution2比Services1更具优先级的设置,因为根据前面介绍,STP在选择最佳路径时首先考虑的是端口开销大小,网桥优先级是在它后面考虑的项目。而且是按照默认的优先级从fa0/47端口转发的(因为fa0/47端口的端口ID小于fa0/4端口)VLAN 100中的通信,这也符合我们的实际要求,所以无需对这个中继端口做任何配置。
同样,对于Services1会选择Services2来到达VLAN 200的根交换机——Distribution2。在Services2上降低fa0/6端口在VLAN 200中的开销值后(相当于提高了其优先级别,也是在示例中手动配置的),Services1会选择fa0/47端口来转发VLAN 200中的通信(因为fa0/47端口的端口ID小于fa0/4端口),然后再从Services2上fa0/6端口转发。但是,现在要求通过fa0/48端口来转发VLAN 200中的通信,则同样有两种方法来实现:
l 降低Services1交换机上fa0/48的端口开销值,提高其优先级别;
l 降低Services2交换机上fa0/48的端口优先级值,提高其优先级别。
本示例中采用的是“spanning-tree vlan 200 port-priority 64”命令来降低Services2交换机上fa0/48的端口优先级值(从默认的128降低为64,相当于提高了优先级别)方法来实现在fa0/48端口上转发VLAN 200通信的。
12.6.3 两台接入层交换机上的原始PVST+生成树配置这两台接入层交换机上的配置比较简单,就是启用了一些PVST+特性,然后配置各中继链路允许对应的VLAN通信通过。Access1交换机的原始PVST+配置(可通过show running-config特权模式命令查看):
Access1#show running-config
Building configuration...
!
spanning-tree mode pvst
spanning-tree portfast bpduguard default
spanning-tree extend system-id
spanning-tree uplinkfast
spanning-tree backbonefast
!
vlan 10,20
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
!
interface FastEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk allowed vlan 10,20
!
end
Access2交换机的原始PVST+配置(注意,这是台CatOS操作系统的交换机,可通过show config all特权模式命令查看):
Access2> (enable)show config all
#mac address reduction
set spantree macreduction enable
!
#stp mode
set spantree mode pvst+
!
#uplinkfast groups
set spantree uplinkfast enable rate 15 all-protocols off
!
#backbonefast
set spantree backbonefast enable
!
#vlan parameters
set spantree priority 49152 1
set spantree priority 49152 30
set spantree priority 49152 40
!
#vlan(defaults)
set spantree enable 1,30,40
set spantree fwddelay 15 1,30,40
set spantree hello 2 1,30,40
set spantree maxage 20 1,30,40
!
#vtp
set vlan 1,30,40
!
#module 3 : 48-port 10/100BaseTX Ethernet
set trunk 3/3 on dot1q 30,40
set trunk 3/4 on dot1q 30,40
!
end
12.6.4 两台接入层交换机的UplinkFast和BackboneFast原始配置虽然在上节我们已看到了,在两台接入层交换机上已配置了PVST+生成树模式的一些特性,但并没有具体了解这两台交换机上的一些特性应用情况。在迁移之前,最好先查看一下原来的UplinkFast和BackboneFast配置应用情况,可以通过对比迁移前后的这些特性的状态来加深理解Rapid-PVST+生成树模式中对这些特性的支持。
以下就是通过几个show spanning-tree命令查看PVST+特性在两台交换机上的配置应用情况。从中可以看出,这两种特性在该交换机上都是启用的,参见输出信息中的粗体字部分。
Access1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 0015.63f6.b700
Cost 3019
Port 107 (FastEthernet3/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 49162 (priority 49152 sys-id-ext 10)
Address 000f.f794.3d00
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Uplinkfast enabled
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa3/0/1 Root FWD 3019 128.107 P2p
Fa3/0/2 Altn BLK 3019 128.108 P2p
Access1#show spanning-tree summary
Switch is in pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is enabled
BackboneFast is enabled
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0010 1 0 0 1 2
VLAN0020 1 0 0 1 2
---------------------- -------- --------- -------- ---------- ----------
2 vlans 2 0 0 2 4
从以上show spanning-tree summary命令的输出可以看出,在Access1交换机上是同时启用了UplinkFast和BackboneFast增强特性的。但是,它们对于Rapid-PVST+模式是无效的,所以在迁移时要删除这两项配置。当然,如果你不删除,也不会影响Rapid-PVST+模式的任何操作。如果你使用no spanning-tree uplinkfast命令禁止UplinkFast特性,则该交换机上的交换机优先级和端口开销设置将恢复到默认值。
【说明】下面要正式介绍从PVST+模式迁移到Rapid-PVST+模式的配置方法。建议迁移的顺序是从接入层,一步步往上层交换机上进行配置。在本示例中,是按以下顺序进行迁移的:
(1)Access1
(2)Access2
(3)Services1 and Services2
(4)Distribution1 and Distribution2
以下四小节将分别予以介绍。
12.6.5接入层Access1交换机上的迁移配置Rapid-PVST+生成树模式使用与IEEE 802.1D STP一样的BPDU,并且向后兼容IEEE 802.1D STP生成树模式。但是要使整个网络在同一时间迁移为Rapid-PVST+模式比较困难,就是因为它的向后兼容性,只好分段进行,否则可能会引起网络中的通信流丢失。UplinkFast和BackboneFast是PVST+的增强特性,在启用Rapid-PVST+模式后是禁止的,因为这些特性已在Rapid-PVST+模式中内置。所以在迁移时,你可以删除原来所配置的对应命令。像PortFast、BPDUguard、BPDUfilter、Root guard和Loopguard增强特性在Rapid-PVST+模式中也是可用的,并且它们的用途与在PVST+模式中一样。如果你已在PVST+模式中启用了这些特性,这些特性在迁移到Rapid-PVST+模式后仍将保持激活。
在Access1交换机上要做的就是把PVST+生成树模式迁移到Rapid-PVST+模式,同时删除原来PVST+模式下的Uplinkfast和Backbonefast特性配置。但是在Rapid-PVST+模式下,同样是具有这两方面特性的。
Access1(config)#spanning-tree mode rapid-pvst !---从PVST+模式迁移到Rapi-PVST+模式
Access1(config)#no spanning-tree uplinkfast !---禁止原来PVST+模式中的Uplinkfast特性
Access1(config)#no spanning-tree backbonefast !---禁止原来PVST+模式中的Backbonefast特性
使用show spanning-tree vlan 10特权模式命令查看Access1交换机上VLAN 10的生成树配置。从输出信息中可以看出,它的Fa3/0/1和Fa3/0/2接口所连接的对端交换机仍是使用PVST+生成树模式,参见输出信息中粗体字部分。
Access1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 24586
Address 0015.63f6.b700
Cost 19
Port 107 (FastEthernet3/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.f794.3d00
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa3/0/1 Root FWD 19 128.107 P2p Peer(STP)
Fa3/0/2 Altn BLK 19 128.108 P2p Peer(STP)
如果没有配置no spanning-tree uplinkfast和no spanning-tree backbonefast命令,整个网络中交换机都迁移完毕,查看Access1交换机上的生成树配置就如下所示了。其中显示这两项特性仍然启用,但对于Rapid-PVST+模式无效。并且不会显示“P2p Peer(STP)”,只会显示“P2P”,参见输出信息中的粗体字部分。
Access1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 24586
Address 0015.63f6.b700
Cost 3019
Port 107 (FastEthernet3/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 49162 (priority 49152 sys-id-ext 10)
Address 000f.f794.3d00
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
UplinkFast enabled but inactive in rapid-pvst mode
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa3/0/1 Root FWD 3019 128.107 P2p
Fa3/0/2 Altn BLK 3019 128.108 P2p
Access1#show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is enabled but inactive in rapid-pvst mode
BackboneFast is enabled but inactive in rapid-pvst mode
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0010 1 0 0 1 2
VLAN0020 1 0 0 1 2
---------------------- -------- --------- -------- ---------- ----------
2 vlans 2 0 0 2 4
如果在网络中所有交换机上都迁移完毕,并且禁止了UplinkFast特性,再查Access1上的生成树配置,就是如下输出了,不会显示“P2p Peer(STP)” ,只会显示“P2P”,参见输出信息中的粗体字部分。
Access1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 24586
Address 0015.63f6.b700
Cost 19
Port 107 (FastEthernet3/0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 000f.f794.3d00
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa3/0/1 Root FWD 19 128.107 P2p
Fa3/0/2 Altn BLK 19 128.108 P2p
12.6.6 接入层Access2交换机上的迁移配置注意,Access2交换机是运行CatOS操作系统的。在这台交换机上必须先禁止原来PVST+模式下的Backbonefast特性,然后再把生成树模式从PVST+迁移到Rapid-PVST+模式。最后清除交换机上原来PVST+模式的Uplinkfast特性。
Access2> (enable) set spantree backbonefast disable !---禁止PVST+模式下的Backbonefast特性
Backbonefast disabled for all VLANs.
Access2> (enable) set spantree mode rapid-pvst+ !---把生成树模式从PVTS+迁移到Rapid-PVST+模式
PVST+ database cleaned up.
Spantree mode set to RAPID-PVST+.
Access2> (enable) clear spantree uplinkfast !---清除原来PVST+模式下的Uplinkfast特性配置,使交换机上端口所有端口开销、交换机优先级设置恢复到默认设置
This command will cause all portcosts, portvlancosts, and the
bridge priority on all vlans to be set to default.
Do you want to continue (y/n) [n]? y
VLANs 1-4094 bridge priority set to 32768.
The port cost of all bridge ports set to default value.
The portvlancost of all bridge ports set to default value.
uplinkfast all-protocols field set to off.
uplinkfast disabled for bridge.
迁移后,查看Access2交换机上的生成树配置。
Access1#show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is disabled
BackboneFast is enabled but inactive in rapid-pvst mode
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0010 1 0 0 1 2
VLAN0020 1 0 0 1 2
---------------------- -------- --------- -------- ---------- ----------
2 vlans 2 0 0 2 4
【注意】在启用了BackboneFast特性时,CarOS系统不允许你改变到Rapid-PVST+生成树模式,你必须在迁移前禁止BackboneFast特性。而UplinkFast特性在生成树模式迁移前后的改变与IOS系统中生成树模式迁移前后的UplinkFast特性改变一样。
12.6.7 Services1和Services2两汇聚层交换机的迁移配置在汇聚层的Services1和Services2两交换机上,因为都是运行IOS操作系统的,只需要把生成树模式迁移到Rapid-PVST+模式,然后禁止Rapid_PVST+不支持的Backbonefast特性即可,因为在汇聚层交换机上一般不配置Uplinkfast特性(Uplinkfast特性是在直接终端口的端口上应用的)。具体如下:
Services1(config)#spanning-tree mode rapid-pvst
Services1(config)#no spanning-tree backbonefast
Services2(config)#spanning-tree mode rapid-pvst
Services2(config)#no spanning-tree backbonefast
12.6.8 Distribution1和Distribution2两分布层交换机上的迁移配置在分布层交换机上的迁移配置与汇聚层交换机的迁移配置一样,也是把生成树模式迁移到Rapid-PVST+模式,然后禁止Rapid_PVST+不支持的Backbonefast特性即可。具体如下(在迁移过程中交换机上的三层VLAN接口将先关闭,然后打开,以实现收敛):
Distribution1(config)#spanning-tree mode rapid-pvst
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan200, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to
down
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
down
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
up
Distribution1(config)#no spanning-tree backbonefast
Distribution2(config)#spanning-tree mode rapid-pvst
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to
own
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to
p
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state t
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan200, changed state t
up
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
down
2d02h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to
up
Distribution2(config)#no spanning-tree backbonefast
12.6.9 混合模式下的调试输出在大型的网络中,整个迁移过程可能要耗时几天。在这个迁移过程中,你的网络运行在混合生成树模式中。这样,你就不能使整个网络都接受Rapid-PVST+广告。想要了解在混合模式下的生成树行为,可以使用debug spanning-tree特权模式命令来查看。下面是几个执行该调试命令的输出示例。从中可以看出当前交换机正运行的生成树模式。
当Access1与Distribution1之间的链路失效时,在Access1上执行debug spanning-tree命令的输出示例。
00:55:13: RSTP(10): updt roles, root port Fa0/1 going down
00:55:13: RSTP(10): Fa0/2 is now root port
00:55:13: RSTP(10): Fa0/2 received a tc ack
00:55:15: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to adminis
tratively down
00:55:16: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, cha
nged state to down
当Access1与Distribution1之间的链路失效时,在Distribution1上执行debug spanning-tree命令的输出示例。
00:55:20: STP: VLAN0010 Topology Change rcvd on Fa1/0/23
00:55:20: STP: VLAN0020 sent Topology Change Notice on Fa1/0/24
00:55:21: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/1,
changed state to down
00:55:22: %LINK-3-UPDOWN: Interface FastEthernet1/0/1, changed state to down
12.6.10 迁移后的配置校验可以使用一系列show命令来验证你上面的配置是否正确。建议每次改变配置后都进行这些验证,以便及时发现问题。下面先来验证Distribution1已作为了VLANs 10、3、100这三个VLAN的根交换机。然后验证网络中各条转发路径是否满足你的要求(主要检查各VLAN中的各端口转发状态,参见输出信息中的粗体字部分)。
Distribution1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 24586
Address 0015.63f6.b700
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address 0015.63f6.b700
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa1/0/1 Desg FWD 19 128.1 P2p
Fa1/0/3 Desg FWD 19 128.3 P2p
Fa1/0/5 Desg FWD 19 128.5 P2p
Fa1/0/23 Desg FWD 19 128.23 P2p
Fa1/0/24 Desg FWD 19 128.24 P2p
Access1#show spanning-tree summary
Switch is in rapid-pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is disabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is disabled
BackboneFast is disabled
Configured Pathcost method used is short
Name Blocking Listening Learning Forwarding STP Active
---------------------- -------- --------- -------- ---------- ----------
VLAN0010 1 0 0 1 2
VLAN0020 1 0 0 1 2
---------------------- -------- --------- -------- ---------- ----------
2 vlans 2 0 0 2 4
Access2> (enable) show spantree 30
VLAN 30
Spanning tree mode RAPID-PVST+
Spanning tree type ieee
Spanning tree enabled
Designated Root 00-15-63-f6-b7-00
Designated Root Priority 24606
Designated Root Cost 19
Designated Root Port 3/3
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Bridge ID MAC ADDR 00-d0-00-50-30-1d
Bridge ID Priority 32768
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Port State Role Cost Prio Type
------------------------ ------------- ---- --------- ---- --------------------
3/3 forwarding ROOT 19 32 P2P
3/4 blocking ALTR 19 32 P2P
Access2> (enable) show spantree 40
VLAN 40
Spanning tree mode RAPID-PVST+
Spanning tree type ieee
Spanning tree enabled
Designated Root 00-15-c6-c1-30-00
Designated Root Priority 24616
Designated Root Cost 19
Designated Root Port 3/4
Root Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Bridge ID MAC ADDR 00-d0-00-50-30-27
Bridge ID Priority 32768
Bridge Max Age 20 sec Hello Time 2 sec Forward Delay 15 sec
Port State Role Cost Prio Type
------------------------ ------------- ---- --------- ---- --------------------
3/3 blocking ALTR 19 32 P2P
3/4 forwarding ROOT 19 32 P2P
Services1#show spanning-tree vlan 100
VLAN0100
Spanning tree enabled protocol rstp
Root ID Priority 24676
Address 0015.63f6.b700
Cost 18
Port 7 (FastEthernet0/5)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32868 (priority 32768 sys-id-ext 100)
Address 0003.fd63.bb80
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/5 Root FWD 18 128.7 P2p
Fa0/46 Desg FWD 19 128.50 P2p
Fa0/47 Desg FWD 19 128.51 P2p
Services1#show spanning-tree vlan 200
VLAN0200
Spanning tree enabled protocol rstp
Root ID Priority 24776
Address 0015.c6c1.3000
Cost 37
Port 51 (FastEthernet0/47)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32968 (priority 32768 sys-id-ext 200)
Address 0003.fd63.bb80
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/5 Altn BLK 19 128.7 P2p
Fa0/46 Altn BLK 19 128.50 P2p
Fa0/47 Root FWD 19 128.51 P2p
Services2#show spanning-tree vlan 100
VLAN0100
Spanning tree enabled protocol rstp
Root ID Priority 24676
Address 0015.63f6.b700
Cost 37
Port 42 (GigabitEthernet0/42)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32868 (priority 32768 sys-id-ext 100)
Address 00d0.2bfc.7d80
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/6 Altn BLK 19 128.6 P2p
Fa0/42 Root FWD 19 128.42 P2p
Fa0/43 Altn BLK 19 128.43 P2p
Services2#show spanning-tree vlan 200
VLAN0200
Spanning tree enabled protocol rstp
Root ID Priority 24776
Address 0015.c6c1.3000
Cost 18
Port 6 (GigabitEthernet0/6)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32968 (priority 32768 sys-id-ext 200)
Address 00d0.2bfc.7d80
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/6 Root FWD 18 128.6 P2p
Fa0/42 Desg FWD 19 128.42 P2p
Fa0/43 Desg FWD 19 64.43 P2p