cisco生成树的三个特性

cisco生成树的三个特性:PortFast.UplinkFast.BackboneFast,用来加速生成树的收敛。

以下面这个拓扑图来讲解

  1.PortFast

它能让交换机的端口绕过监听和学习状态,立即进入生成权的转发状态。一般在access接口启用此功能。

现在在switch11交换机上把g0/1划入vlan1,把端口先down,再no shutdown,看下生成树的情况:

*May  5 00:08:35.872: set portid: VLAN0001 Gi0/1: new port id 8002
*May  5 00:08:35.873: STP SW: Gi0/1 new blocking req for 1 vlans
*May  5 00:08:35.874: STP: VLAN0001 Gi0/1 -> listening
SW11(config-if)#
SW11(config-if)#
*May  5 00:08:37.655: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up
*May  5 00:08:38.657: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
SW11(config-if)#
SW11(config-if)#
*May  5 00:08:50.874: STP SW: Gi0/1 new learning req for 1 vlans
*May  5 00:08:50.875: STP: VLAN0001 Gi0/1 -> learning
SW11(config-if)#
*May  5 00:09:05.877: STP SW: Gi0/1 new forwarding req for 1 vlans
*May  5 00:09:05.878: STP[1]: Generating TC trap for port GigabitEthernet0/1
*May  5 00:09:05.881: STP: VLAN0001 sent Topology Change Notice on Gi0/3
*May  5 00:09:05.882: STP: VLAN0001 Gi0/1 -> forwarding

*May  5 00:08:35.872: set portid: VLAN0001 Gi0/1: new port id 8002

没开启PortFast的情况,上面看的很清楚,15秒监听,15秒学习,总共花费30秒才到转发状态。

看下开启了PortFast的情况:

*May  5 00:27:06.018: set portid: VLAN0001 Gi0/1: new port id 8002
*May  5 00:27:06.019: STP SW: Gi0/1 new blocking req for 1 vlans
*May  5 00:27:06.019: STP: VLAN0001 Gi0/1 ->jump to forwarding from blocking
*May  5 00:27:06.020: STP SW: Gi0/1 new forwarding req for 1 vlans

直接跳过监听学习状态,直接到转发状态,节约30秒时间。

PortFast可以在端口下开启,也可以全局开启,在端口下开启只有这个端口启用了;在全局模式下启用,将所有非trunk端口激活portfast特性。

2、UplinkFast

此特性在接入连汇聚层的交换机上配置。加速新的根端口的选择,端口会立即换到转发,不需要经过监听和学习状态,节约30秒。当切换uplink链路时,接入交换机会以200数据包/秒的速度在新链路上发送伪帧给上游交换机,让上游交换机学习到新链路的信息(也就是刷新CAM表项)。不刷新的话,CAM表项还是原来的,数据传输会出错。因为拓扑结构发生了变化。

先看下不开启UplinkFast,需要的收敛时间

sw4中的g1/3是根端口,g0/1上另一条被阻塞的上行链路,现在把g1/3 down掉


SW4(config-if)#
*May  5 01:17:09.767: STP: VLAN0001 new root port Gi0/1, cost 7
*May  5 01:17:09.767: STP SW: Gi0/1 new listening req for 1 vlans
*May  5 01:17:09.767: STP: VLAN0001 Gi0/1 -> listening
*May  5 01:17:09.767: STP[1]: Generating TC trap for port GigabitEthernet1/3
SW4(config-if)#
*May  5 01:17:11.739: %LINK-5-CHANGED: Interface GigabitEthernet1/3, changed state to administratively down
SW4(config-if)#
*May  5 01:17:11.768: STP: VLAN0001 sent Topology Change Notice on Gi0/1
SW4(config-if)#
*May  5 01:17:12.739: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/3, changed state to down
SW4(config-if)#
*May  5 01:17:24.767: STP SW: Gi0/1 new learning req for 1 vlans
*May  5 01:17:24.768: STP: VLAN0001 Gi0/1 -> learning
SW4(config-if)#
*May  5 01:17:28.651: STP: VLAN0001 sent Topology Change Notice on Gi0/1
*May  5 01:17:28.651: STP: VLAN0001 Topology Change rcvd on Gi0/3
*May  5 01:17:28.652: STP: VLAN0001 Topology Change rcvd on Gi1/0
SW4(config-if)#
*May  5 01:17:39.769: STP SW: Gi0/1 new forwarding req for 1 vlans
*May  5 01:17:39.769: STP[1]: Generating TC trap for port GigabitEthernet0/1
*May  5 01:17:39.771: STP: VLAN0001 sent Topology Change Notice on Gi0/1
*May  5 01:17:39.771: STP: VLAN0001 Gi0/1 -> forwarding
SW4(config-if)#

g0/1经过监听学习到达转发状态,用时30秒

再看下开启UplinkFast时的情况

*May  5 01:22:49.189: STP: VLAN0001 new root port Gi0/1, cost 3007
*May  5 01:22:49.190: %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN0001 GigabitEthernet0/1 moved to Forwarding (UplinkFast).
*May  5 01:22:49.190: STP SW: Gi0/1 new forwarding req for 1 vlans

g0/1直接到转发状态,节约30秒。

3、BackboneFast

根桥和备份根桥之间的连接出现问题,BackboneFast特性可以让下面的交换机端口节约20秒(max age)收敛时间,但仍需要30秒(监听和学习)时间来收敛。

如上图所示,sw2为主根桥,sw3为备份根桥,sw4的g1/3为RP,G0/1为NDP端口。

SW4#show spanning-tree vlan 1

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    1
             Address     5000.0002.0000
             Cost        3004
             Port        8 (GigabitEthernet1/3)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    49153  (priority 49152 sys-id-ext 1)
             Address     5000.0004.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec
  Uplinkfast enabled

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 3004      128.1    P2p
Gi0/1               Altn BLK 3004      128.2    P2p
Gi0/2               Desg FWD 3004      128.3    P2p
Gi0/3               Desg FWD 3004      128.4    P2p
Gi1/0               Desg FWD 3004      128.5    P2p
Gi1/1               Desg FWD 3004      128.6    P2p
Gi1/2               Desg FWD 3004      128.7    P2p
Gi1/3               Root FWD 3004      128.8    P2p

当主根桥sw2和备份根桥sw3之间的链路发生问题时(sw3的g1/1和g1/2口也就是以太网信道port 23口down时),sw3收不到bpdu,会认为到根桥的链接有问题,就认为自己是根桥从g0/1口发送bpdu给sw4。sw4从g0/1端口收到了bpdu(是一个次级bpdu),如果不开启backbonefast,则g0/1端口要等待最大时间20(max age)秒超时才进入监听状态,开启backbonefast后,g0/1直接进入监听状态,节约这20秒时间,然后进入学习状态,最后到转发(经过30秒)。

不开启backbonefast的情况下,看sw4的情况:

*May  8 00:44:54.195: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:44:56.178: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:44:58.198: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:00.170: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:02.203: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:04.172: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:06.171: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:08.161: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:10.152: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
SW4#
*May  8 00:45:12.147: STP: VLAN0001 heard root  4097-5000.0003.0000 on Gi0/1
*May  8 00:45:12.195: STP SW: Gi0/1 new listening req for 1 vlans
*May  8 00:45:12.196: STP: VLAN0001 Gi0/1 -> listening
SW4#
*May  8 00:45:13.277: STP: VLAN0001 Topology Change rcvd on Gi0/1
*May  8 00:45:13.280: STP: VLAN0001 sent Topology Change Notice on Gi1/3
SW4#
*May  8 00:45:27.198: STP SW: Gi0/1 new learning req for 1 vlans
*May  8 00:45:27.199: STP: VLAN0001 Gi0/1 -> learning
SW4#
*May  8 00:45:42.200: STP SW: Gi0/1 new forwarding req for 1 vlans
*May  8 00:45:42.201: STP[1]: Generating TC trap for port GigabitEthernet0/1
*May  8 00:45:42.204: STP: VLAN0001 sent Topology Change Notice on Gi1/3
*May  8 00:45:42.205: STP: VLAN0001 Gi0/1 -> forwarding

开启backbonefast时,查看sw4的情况:

SW4(config)#
*May 8 00:58:47.939: STP: VLAN0001 heard root 4097-5000.0003.0000 on Gi0/1
*May 8 00:58:47.944: STP SW: Gi0/1 new listening req for 1 vlans
*May 8 00:58:47.944: STP: VLAN0001 Gi0/1 -> listening
*May 8 00:58:48.446: STP: VLAN0001 Topology Change rcvd on Gi0/1
*May 8 00:58:48.448: STP: VLAN0001 sent Topology Change Notice on Gi1/3
SW4(config)#
*May 8 00:59:02.945: STP SW: Gi0/1 new learning req for 1 vlans
*May 8 00:59:02.945: STP: VLAN0001 Gi0/1 -> learning
SW4(config)#
*May 8 00:59:17.947: STP SW: Gi0/1 new forwarding req for 1 vlans
*May 8 00:59:17.947: STP[1]: Generating TC trap for port GigabitEthernet0/1
*May 8 00:59:17.950: STP: VLAN0001 sent Topology Change Notice on Gi1/3
*May 8 00:59:17.950: STP: VLAN0001 Gi0/1 -> forwarding

此条目发表在cisco分类目录,贴了, 标签。将固定链接加入收藏夹。