资源预览内容
第1页 / 共94页
第2页 / 共94页
第3页 / 共94页
第4页 / 共94页
第5页 / 共94页
第6页 / 共94页
第7页 / 共94页
第8页 / 共94页
第9页 / 共94页
第10页 / 共94页
亲,该文档总共94页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
H3C-STP-RSTP-MSTPH3C-STP-RSTP-MSTP协议原理及配置协议原理及配置nSTP/RSTP/MSTP的作用的作用n 在二层网络上形成树状网络拓扑结构,避免环路在二层网络上形成树状网络拓扑结构,避免环路n二层网络环路的危害二层网络环路的危害n 1.广播风暴(没有三层网络的广播风暴(没有三层网络的TTL机制)机制)n 2.MAC地址学习错误地址学习错误n二层网络的健壮性二层网络的健壮性n STP可以增强网络健壮性,避免单点故障,单链路可以增强网络健壮性,避免单点故障,单链路故障故障引入引入n了解了解STP/RSTP/MSTP协议的基本概协议的基本概念和工作原理念和工作原理n掌握掌握STP/RSTP/MSTP在在H3C网络设网络设备上的配置备上的配置课程目标课程目标学习完本课程,您应该能够:学习完本课程,您应该能够:n第一章第一章 STP(802.1D)协议原理协议原理n第二章第二章 RSTP(802.1W)协议原理协议原理n第三章第三章 MSTP(802.1S)协议原理协议原理n第四章第四章 STP的相关配置的相关配置目录目录www.h3c.com5STP协议原理协议原理nSTPSTP协议简介协议简介nBPDUBPDU报文结构报文结构n如何确定根桥如何确定根桥n如何计算如何计算STP Path CostSTP Path Costn如何确定端口角色如何确定端口角色n端口的状态迁移及定时器端口的状态迁移及定时器nMACMAC地址学习的生存周期地址学习的生存周期nSTPSTP的不足的不足www.h3c.com6STP协议简介协议简介lSTP都做了些什么?都做了些什么?STP在二层交换网络中选择一个根桥作为全部二层交换网络的逻辑中心(Root Bridge)。STP为全网中每一个参与STP运算的交换机计算到达根桥的最短距离(Path Cost)。检测二层交换网络中存在的冗余链路,并把他们置于阻断/备份状态。检测拓扑结构的变化并根据情况计算新的生成树。www.h3c.com7STP协议简介协议简介lSTP协议的结果是什么?协议的结果是什么?阻断了冗余链路,形成了以根桥为树根的树状拓扑结构。RP ROOT PORTSwitch A BID Switch A BID =0001 =0001 Switch C BID Switch C BID =1045 =1045 Switch B BID Switch B BID =0050=0050Switch D BID Switch D BID =0030=0030DP DESIGNATED PORTDPRPDPRPDPDPAP ALTERNATE PORTAPwww.h3c.com8RP ROOT PORTSwitch A Switch A BID =0001 BID =0001 Switch C Switch C BID =1045 BID =1045 Switch B Switch B BID =0050BID =0050DP DESIGNATED PORTDPRPDPRPDPDPAPAPSTP协议简介协议简介l常用概念常用概念.根桥(Root Bridge)桥ID最小的网桥。其中桥ID是由网桥的优先级和网桥的MAC组成。根端口(Root Port)这个端口到达根桥的路径是该端口所在网桥到达根桥的最佳路径。全网中只有根桥是没有根端口的。指定端口(Designated Port)每一个网段选择到根桥最近的网桥作为指定网桥,该网桥到这一网段的端口为指定端口。可选端口(Alternated Port)既不是指定端口,也不是根端口的端口。Switch D Switch D BID =0030BID =0030www.h3c.com9BPDU报文结构报文结构lSTP通过通过BPDU(Bridge Protocol Data Unit)报文来学习网络拓扑结构。报文来学习网络拓扑结构。lBPDU报文的目标报文的目标MAC地址为:地址为:01-80-C2-00-00-00.lBPDU报文在直连的两个网桥或多个网桥内报文在直连的两个网桥或多个网桥内交换,不能被转发。没有运行交换,不能被转发。没有运行STP协议的网协议的网桥将把桥将把BPDU报文当作普通业务报文转发。报文当作普通业务报文转发。BPDUBPDUSwitch CSwitch CSwitch BSwitch BBPDUBPDUwww.h3c.com10BPDU报文结构报文结构lDMA:目的目的MAC地址地址目的地址是一个固定的桥的组播地址(0x0180c2000000)lSMA:源源MAC地址地址即发送该配置消息的桥MAC地址lL/T:帧长帧长lLLC Header:固定的链路头固定的链路头lPayload:BPDU数据数据DMADMALLC HeaderLLC HeaderSMASMAL/TL/TPayloadPayload值值值值 域域域域占用字节占用字节占用字节占用字节协议协议协议协议IDID2 2协议版本协议版本协议版本协议版本BPDUBPDU类型类型类型类型标志位标志位标志位标志位根桥根桥根桥根桥IDID根路径开销根路径开销根路径开销根路径开销指定桥指定桥指定桥指定桥IDID指定端口指定端口指定端口指定端口IDIDMessage AgeMessage Age1 11 11 18 84 48 82 22 2Max AgeMax AgeHello TimeHello TimeForward DelayForward Delay2 22 22 2www.h3c.com11如何确定根桥如何确定根桥l根桥根桥BID(网桥(网桥ID)最小的网桥定为根桥。)最小的网桥定为根桥。lBID网桥的优先级网桥的优先级+网桥网桥MAC。l网桥的优先级为可配置,缺省值为网桥的优先级为可配置,缺省值为32768。l在缺省情况下,根桥将由在缺省情况下,根桥将由MAC地址最小的网地址最小的网桥担任。桥担任。www.h3c.com12如何确定根桥如何确定根桥Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Im the Root Switch Im the Root Switch Switch D BID =0030Switch D BID =0030Im the Root Switch Im the Root Switch Im the Root Switch Im the Root Switch www.h3c.com13如何确定根桥如何确定根桥Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Root SwitchRoot Switch=0001=0001 Switch D BID =0030Switch D BID =0030Im the Root Switch Im the Root Switch Root= 0001Root= 0001Root= 0001Root= 0001Root= 0030Root= 0030Root = 0001Root = 0001Root= 0030Root= 0030Root= 0001Root= 0001 Root= 0001 Root= 0001Root = 0001Root = 0001Root SwitchRoot Switch=0001=0001 Root = 1045Root = 1045Root = 0050Root = 0050www.h3c.com14如何确定根桥如何确定根桥Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Root Switch =0001 Root Switch =0001 Switch D BID =0030Switch D BID =0030Root Switch=0001Root Switch=0001 Root Switch = 0001 Root Switch = 0001 www.h3c.com15如何确定根桥如何确定根桥BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Root Switch =0001 Root Switch =0001 Switch D BID =0030Switch D BID =0030Im the Root Switch Im the Root Switch BPDU: Root Switch= 0001BPDU: Root Switch= 0001BPDU:BPDU: Root Switch= 0001 Root Switch= 0001BPDU: Root Switch= 0030BPDU: Root Switch= 0030BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0030BPDU: Root Switch = 0030BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001BPDU: Root Switch = 0001Root Switch = 0001 Root Switch = 0001 www.h3c.com16如何确定根桥如何确定根桥Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Root Switch =0001 Root Switch =0001 Switch D BID =0030Switch D BID =0030Root Switch = 0001Root Switch = 0001Root Switch = 0001 Root Switch = 0001 www.h3c.com17如何计算如何计算STP Path CostlPath Cost的两种定义标准的两种定义标准SpeedLink type802.1D cost802.1t cost10MbpsHalf Duplex1002,000,000Full Duplex951,999,999Aggregated link901,000,000100MbpsHalf Duplex19200,000Full Duplex18199,999Aggregated Link15100,0001000MbpsFull Duplex420,000Aggregated Link310,000www.h3c.com18如何决定如何决定BPDU配置消息的优劣配置消息的优劣l比较比较RID(Root Bridge ID),确定网络同步。,确定网络同步。lRID相同,比较相同,比较Path Cost(到根桥距离),(到根桥距离),越小越优。越小越优。lRID/Path Cost相同,比较指定桥的相同,比较指定桥的BID (Designated Bridge ID),越小越优。,越小越优。lRID/Path Cost/DBID相同,比较指定端口的相同,比较指定端口的ID (Designated Port ID),越小越优。,越小越优。哪边更优?BPDUBPDUwww.h3c.com19BPDU交换过程交换过程Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Switch D BID =0030Switch D BID =00302 Gig Aggregated2 Gig AggregatedPath cost = Path cost = 3 31 Gig1 GigPath Cost = Path Cost = 4 41 Gig1 GigPath Cost = Path Cost = 4 4100M100MPath Cost = Path Cost = 18 18 100M Path 100M Path cost = cost = 1818www.h3c.com20BPDU交换过程交换过程BPDU: Root Switch = 1045BPDU: Root Switch = 1045Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0050BPDU: Root Switch = 0050Cost to Root = 0Cost to Root = 0Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root Switch Im the Root Switch Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 1045BPDU: Root Switch= 1045Cost to root =0Cost to root =0BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0030BPDU: Root Switch= 0030Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0050BPDU: Root Switch = 0050Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0030BPDU: Root Switch = 0030Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 1045BPDU: Root Switch = 1045Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0050BPDU: Root Switch = 0050Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Im the Root Switch Im the Root Switch Im the Root Switch Im the Root Switch Im the Root Switch Im the Root Switch www.h3c.com21BPDU交换过程交换过程BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 18Cost to Root = 18Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root SwitchIm the Root SwitchLowest Cost to Root = 0Lowest Cost to Root = 0Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to root = 3Cost to root = 3BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0030BPDU: Root Switch= 0030Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 18Cost to Root = 18BPDU: Root Switch = 0030BPDU: Root Switch = 0030Cost to Root = 0Cost to Root = 0BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 18Cost to Root = 18BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 3 Lowest Cost to Root = 3 Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 18 Lowest Cost to Root = 18Im the Root SwitchIm the Root Switch Lowest Cost to Root = 0 Lowest Cost to Root = 0 Cost to Root =3Cost to Root =3Cost to Root =18Cost to Root =18www.h3c.com22BPDU交换过程交换过程BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root SwitchIm the Root SwitchLowest Cost to Root = 0Lowest Cost to Root = 0Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to root = 3Cost to root = 3BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to Root = 21Cost to Root = 21BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 21Cost to Root = 21BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 3 Lowest Cost to Root = 3 Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 7 Lowest Cost to Root = 7Root Switch = 0001 Root Switch = 0001 Lowest Cost to Root = 11Lowest Cost to Root = 11Cost to Root =7Cost to Root =7Cost to Root =22Cost to Root =22Cost to Root =21Cost to Root =21Cost to Root =22Cost to Root =22Cost to Root =3Cost to Root =3Cost to Root =18Cost to Root =18www.h3c.com23BPDU交换过程交换过程BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root SwitchIm the Root SwitchLowest Cost to Root = 0Lowest Cost to Root = 0Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to root = 3Cost to root = 3BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 3 Lowest Cost to Root = 3 Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 7 Lowest Cost to Root = 7Root Switch = 0001 Root Switch = 0001 Lowest Cost to Root = 11Lowest Cost to Root = 11Cost to Root =7Cost to Root =7Cost to Root =11Cost to Root =11Cost to Root =21Cost to Root =21Cost to Root =22Cost to Root =22Cost to Root =3Cost to Root =3Cost to Root =18Cost to Root =18www.h3c.com24BPDU交换过程交换过程BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 18Cost to Root = 18Switch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root SwitchIm the Root SwitchLowest Cost to Root = 0Lowest Cost to Root = 0Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to root = 3Cost to root = 3BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 3 Lowest Cost to Root = 3 Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 7 Lowest Cost to Root = 7Root Switch = 0001 Root Switch = 0001 Lowest Cost to Root = 11Lowest Cost to Root = 11Cost to Root =7Cost to Root =7Cost to Root =11Cost to Root =11Cost to Root =21Cost to Root =21Cost to Root =22Cost to Root =22Cost to Root =3Cost to Root =3Cost to Root =18Cost to Root =18Cost to Root =29Cost to Root =29Cost to Root =15Cost to Root =15www.h3c.com25确定网桥端口角色确定网桥端口角色lBPDU报文中总是携带网桥到根桥的最优值。报文中总是携带网桥到根桥的最优值。l通过通过BPDU配置消息来决定端口的角色:配置消息来决定端口的角色:根端口:网桥各个端口中到根桥最近的端口。指定端口:网桥的端口发送的BPDU配置消息较接收的BPDU配置消息更优,则端口为指定端口。可选端口:网桥的端口发送的BPDU配置消息较接收的BPDU配置消息更差,则端口为可选端口。www.h3c.com26确定网桥端口角色确定网桥端口角色Switch B BID Switch B BID =0050=0050BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Cost to Root =15Cost to Root =15BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 7Lowest Cost to Root = 7Best cost to root is 7Best cost to root is 7Cost of this link to root is 18 (0+18)Cost of this link to root is 18 (0+18)Result BLOCK LINKResult BLOCK LINKALTERNATE PORTALTERNATE PORTALTERNATE PORTALTERNATE PORT这个端口发送的这个端口发送的这个端口发送的这个端口发送的BPDUBPDUBPDUBPDU比接比接比接比接收到的收到的收到的收到的BPDUBPDUBPDUBPDU更差,被选为更差,被选为更差,被选为更差,被选为可选端口。可选端口。可选端口。可选端口。 70 70 70 70ROOT PORTROOT PORTROOT PORTROOT PORT这个端口到根桥的距离为这个端口到根桥的距离为这个端口到根桥的距离为这个端口到根桥的距离为7 7 7 7,最近,被选为根端口。,最近,被选为根端口。,最近,被选为根端口。,最近,被选为根端口。DESIGNATED PORTDESIGNATED PORTDESIGNATED PORTDESIGNATED PORT这个端口发送的这个端口发送的这个端口发送的这个端口发送的BPDUBPDUBPDUBPDU比接比接比接比接收道德收道德收道德收道德BPDUBPDUBPDUBPDU更优,被选为更优,被选为更优,被选为更优,被选为指定端口。指定端口。指定端口。指定端口。711711711711BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7Cost to Root =18Cost to Root =18RPDPAPCost to Root =7Cost to Root =7www.h3c.com27确定阻断端口确定阻断端口BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3RP ROOT PORTSwitch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Im the Root SwitchIm the Root SwitchLowest Cost to Root = 0Lowest Cost to Root = 0Switch D BID =0030Switch D BID =0030BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to root = 3Cost to root = 3BPDU:BPDU: Root Switch= 0001 Root Switch= 0001Cost to Root = 0Cost to Root = 0BPDU: Root Switch= 0001BPDU: Root Switch= 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 11Cost to Root = 11BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 3Cost to Root = 3BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root =0Cost to Root =0Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 3 Lowest Cost to Root = 3 Root Switch is 0001Root Switch is 0001 Lowest Cost to Root = 7 Lowest Cost to Root = 7Root Switch = 0001 Root Switch = 0001 Lowest Cost to Root = 11Lowest Cost to Root = 11Cost to Root =7Cost to Root =7Cost to Root =11Cost to Root =11Cost to Root =21Cost to Root =21Cost to Root =11Cost to Root =11Cost to Root =3Cost to Root =3Cost to Root =18Cost to Root =18BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 7Cost to Root = 7DP DESIGNATED PORTDPRPDPRPDPDPCost to Root =29Cost to Root =29Cost to Root =15Cost to Root =15www.h3c.com28确定阻断端口确定阻断端口RP ROOT PORTSwitch A BID =0001 Switch A BID =0001 Switch C BID =1045 Switch C BID =1045 Switch B BID =0050Switch B BID =0050Switch D BID =0030Switch D BID =0030DP DESIGNATED PORTDPRPDPRPDPDPAPAPwww.h3c.com29Who Wins?Switch A BID =0001 Switch A BID =0001 Switch C BID =0050 Switch C BID =0050 Switch B BID =1045Switch B BID =1045PC = 4PC = 4PC = 8PC = 8PC = 4PC = 4DPDPRPBPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 8Cost to Root = 8BPDU: Root Switch = 0001BPDU: Root Switch = 0001Cost to Root = 4Cost to Root = 4Both Roots Costs are =8Both Roots Costs are =8BID-A BID B BID-A BID B l问题1:哪个端口将被阻断?l问题2:如果所有的PathCost都相同,哪个端口将被阻断?www.h3c.com30MAC地址信息的生存期地址信息的生存期l拓扑结构改变会使站点在生成树中的相对位置发拓扑结构改变会使站点在生成树中的相对位置发生移动,那么网桥原来学习到的生移动,那么网桥原来学习到的MAC地址信息就地址信息就可能变得不正确,所以学习的可能变得不正确,所以学习的MAC地址信息也要地址信息也要有生存期,如果该时间内没有证明地址的正确,有生存期,如果该时间内没有证明地址的正确,则抛弃这条地址信息。则抛弃这条地址信息。l在在STP中有两个生存期:中有两个生存期:拓扑稳定的时候用较长的生存期.拓扑改变的时候用较短的生存期.l网络拓扑发生改变的时候,并不是所有的网桥都网络拓扑发生改变的时候,并不是所有的网桥都能够发现这一变化,所以需要把拓扑改变的信息能够发现这一变化,所以需要把拓扑改变的信息通知到整个网络。通知到整个网络。www.h3c.com31站点的相对位置发生变化站点的相对位置发生变化物理段物理段物理段物理段 A A物理段物理段物理段物理段 B B物理段物理段物理段物理段 C C物理段物理段物理段物理段 E E物理段物理段物理段物理段 D DROOTROOTB1B1B2B2B3B3B4B4www.h3c.com32拓扑改变消息中标志位的使用拓扑改变消息中标志位的使用DMADMALLC HeaderLLC HeaderSMASMAL/TL/TPayloadPayload值值值值 域域域域占用字节占用字节占用字节占用字节协议协议协议协议IDID2 2协议版本协议版本协议版本协议版本BPDUBPDU类型类型类型类型标志位标志位标志位标志位根桥根桥根桥根桥IDID根路径开销根路径开销根路径开销根路径开销指定桥指定桥指定桥指定桥IDID指定端口指定端口指定端口指定端口IDIDMessage AgeMessage Age1 11 11 18 84 48 82 22 2Max AgeMax AgeHello TimeHello TimeForward DelayForward Delay2 22 22 201234567Topology ChangeTopology Change AcknowledgmentFLAGFLAG标志位中标志位中1 1至至6 6位保留。位保留。www.h3c.com33拓扑改变消息的传播拓扑改变消息的传播ROOTROOT拓扑改变通知消息拓扑改变通知消息拓扑改变通知消息拓扑改变通知消息拓扑改变应答消息拓扑改变应答消息拓扑改变应答消息拓扑改变应答消息拓扑改变消息拓扑改变消息拓扑改变消息拓扑改变消息1 13 32 25 54 45 56 66 61.拓扑改变的触发条件有两个:拓扑改变的触发条件有两个:a)当当Forwarding端口转变为端口转变为其他状态时;其他状态时;b)某端口变为某端口变为Forwarding状状态,且交换机具备态,且交换机具备DP(交换(交换机为非独立交换机)。机为非独立交换机)。2.检测到拓扑变化的交换机以检测到拓扑变化的交换机以HelloTime为周期持续在根端为周期持续在根端口上向外发送口上向外发送TCN报文,到报文,到接收到接收到TCA为止。为止。2.收到收到TCN后,后,Root Bridge 发送的发送的BPDU报文中的报文中的TC位位将被置位,维持时间为将被置位,维持时间为ForwardDelay+MaxAge。www.h3c.com34STP端口状态端口状态端口能力端口能力端口能力端口能力不收发任何报文不收发任何报文不收发任何报文不收发任何报文DisabledDisabledDisabledDisabledBlockingBlockingBlockingBlockingListeningListeningListeningListeningLearningLearningLearningLearning端口状态端口状态端口状态端口状态ForwardingForwardingForwardingForwarding不接收或转发数据不接收或转发数据不接收或转发数据不接收或转发数据, , , ,接收但不发送接收但不发送接收但不发送接收但不发送BPDUBPDUBPDUBPDU,不进行地址学习,不进行地址学习,不进行地址学习,不进行地址学习不接收或转发数据不接收或转发数据不接收或转发数据不接收或转发数据, , , ,接收并发送接收并发送接收并发送接收并发送BPDUBPDUBPDUBPDU,不进行地址学习不进行地址学习不进行地址学习不进行地址学习不接收或转发数据不接收或转发数据不接收或转发数据不接收或转发数据, , , ,接收并发送接收并发送接收并发送接收并发送BPDUBPDUBPDUBPDU,开始地址学习开始地址学习开始地址学习开始地址学习接收并转发数据接收并转发数据接收并转发数据接收并转发数据, , , ,接收并发送接收并发送接收并发送接收并发送BPDUBPDUBPDUBPDU,进行地址学习进行地址学习进行地址学习进行地址学习www.h3c.com35STP端口状态迁移端口状态迁移DisabledDisabledListeningListeningBlockingBlockingForwardingForwardingLearningLearning1 1)端口)端口)端口)端口enabledenabled2 2)端口)端口)端口)端口disableddisabled3 3)端口被选为根端口或指定端口)端口被选为根端口或指定端口)端口被选为根端口或指定端口)端口被选为根端口或指定端口4 4)端口被选为备用端口(阻塞)端口被选为备用端口(阻塞)端口被选为备用端口(阻塞)端口被选为备用端口(阻塞)5 5)Forward DelayForward Delay延时延时延时延时(1 1)(2 2)(1 1,2 2)(1 1,2 2)(1 1,2 2)(1 1)(2 2)(4 4)(4 4)(5 5)(4 4)(5 5)(3 3)www.h3c.com36STP定时器定时器lSTP定时器定时器.Hello Timer: 根桥生成BPDU配置消息的周期,缺省时间为2秒钟。Forward Delay: 配置消息传播到全网的最大时延。缺省为15秒钟。Message Age:从根桥生成BPDU配置消息开始,到当前时间为止配置消息的存活时间。Max Message Age:BPDU配置消息存活的最大时间。www.h3c.com37STP的不足的不足l缺省情况下一个端口从缺省情况下一个端口从Blocking状态过渡到状态过渡到Forwarding状态至少需要状态至少需要30秒钟(两倍的秒钟(两倍的Forword Delay)。对于一个拓扑不稳定网)。对于一个拓扑不稳定网络,会导致网络的长时间中断。络,会导致网络的长时间中断。Power UpPower UpBlockingBlockingListeningListeningLearningLearningForwardingForwardingDisabledDisabledForward Delay TimerForward Delay Timern第一章第一章 STP(802.1D)协议原理协议原理n第二章第二章 RSTP(802.1W)协议原理协议原理n第三章第三章 MSTP(802.1S)协议原理协议原理n第四章第四章 STP的相关配置的相关配置目录目录www.h3c.com39RSTP协议原理协议原理n新的端口角色和状态新的端口角色和状态n新的新的BPDUBPDU报文结构报文结构nRSTPRSTP的重大改进的重大改进n新的拓扑变化通告机制新的拓扑变化通告机制n与与802.1D802.1D的兼容的兼容nRSTPRSTP的不足的不足www.h3c.com40RSTP的端口状态的端口状态www.h3c.com41RSTP的端口角色的端口角色lRoot Port根端口。根端口。lDesignated Port指定端口。指定端口。lAlternate Port可选端口。可选端口。lBackup Port备份端口。备份端口。SwitchSwitchRoot SwitchDPDPDPRPRPAPBPwww.h3c.com42RSTP的的BPDU格式格式DMADMALLC HeaderLLC HeaderSMASMAL/TL/TPayloadPayload值值值值 域域域域占用字节占用字节占用字节占用字节协议协议协议协议IDID2 2协议版本协议版本协议版本协议版本BPDUBPDU类型类型类型类型标志位标志位标志位标志位根桥根桥根桥根桥IDID根路径开销根路径开销根路径开销根路径开销指定桥指定桥指定桥指定桥IDID指定端口指定端口指定端口指定端口IDIDMessage AgeMessage Age1 11 11 18 84 48 82 22 2Max AgeMax AgeHello TimeHello TimeForward DelayForward Delay2 22 22 201234567Topology ChangeTopology Change AckAgreementForwardingLearningProposal00 Unknow01 Alternate/Backup10 Designated Port11 Root Port协议版本由协议版本由0x000x00变为变为0x020x02www.h3c.com43RSTP的重大改进一的重大改进一l改进一:如果旧的根端口已经进入阻塞状态,而改进一:如果旧的根端口已经进入阻塞状态,而且新根端口连接的对端交换机的指定端口处于且新根端口连接的对端交换机的指定端口处于Forwarding状态,在新拓扑结构中的根端口可以状态,在新拓扑结构中的根端口可以立刻进入转发状态。立刻进入转发状态。LAN BLAN BTO ROOTTO ROOTLAN BLAN BLAN ALAN ALAN ALAN AF FF F指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口根端口根端口根端口根端口阻塞端口阻塞端口阻塞端口阻塞端口F FLAN ALAN ALAN ALAN AF FF F指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口根端口根端口根端口根端口阻塞端口阻塞端口阻塞端口阻塞端口F FTO ROOTTO ROOTwww.h3c.com44l网络边缘的端口,即直接与终端相连,而网络边缘的端口,即直接与终端相连,而不是和其它网桥相连的端口可以直接进入不是和其它网桥相连的端口可以直接进入转发状态,不需要任何延时。转发状态,不需要任何延时。RSTP的重大改进二的重大改进二根端口根端口根端口根端口边缘端口边缘端口边缘端口边缘端口LAN ALAN AForwardingForwardingTO ROOTTO ROOT阻塞端口阻塞端口阻塞端口阻塞端口www.h3c.com45RSTP的重大改进三的重大改进三l改进三:增加了网桥之间的协商机制改进三:增加了网桥之间的协商机制Proposal/Agreement。指定端。指定端口可以通过与相连的网桥进行一次握手,快速进入转发状态。其中口可以通过与相连的网桥进行一次握手,快速进入转发状态。其中Proposal报文为正常的报文为正常的BPDU报文,且报文,且Proposal Bit位置位。位置位。Agreement报文为报文为Proposal报文的拷贝,且以报文的拷贝,且以Agreement Bit代替代替Proposal Bit位置位。位置位。1. Proposal2. Sync(unchanged)2. Sync(Discarded)2. Sync(unchanged)3. AgreementP0Root SwitchP1P4P3P2P0: Designated PortP1: New Root PortP2: Alternated PortP3: Designated PortP4: Edge PortRoot SwitchSwitch ASwitch BSwitch CSwitch Dwww.h3c.com46l协商必须在点对点链路上进行。(全双工链路)协商必须在点对点链路上进行。(全双工链路).l两种端口状态不受协商机制影响:两种端口状态不受协商机制影响:可选端口(Alternated Port).边缘端口(Edge Port).协商机制的要求协商机制的要求LAN ALAN A指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口指定端口非点到点链路非点到点链路非点到点链路非点到点链路协商的扩散协商的扩散协商的扩散协商的扩散1. Proposal2. Agreementwww.h3c.com47RSTP的改进效果的改进效果l第一种改进的效果:发现拓扑改变到恢复连通性第一种改进的效果:发现拓扑改变到恢复连通性的时间可达数毫秒,并且无需传递配置消息。的时间可达数毫秒,并且无需传递配置消息。l第二种改进的效果:边缘端口的状态变化不影响第二种改进的效果:边缘端口的状态变化不影响网络连通性,也不会造成回路,所以进入转发状网络连通性,也不会造成回路,所以进入转发状态无需延时。态无需延时。l第三种改进的效果:网络连通性可以在交换两个第三种改进的效果:网络连通性可以在交换两个配置消息的时间内恢复,即握手的延时;最坏的配置消息的时间内恢复,即握手的延时;最坏的情况下,握手从网络的一边开始,扩散到网络的情况下,握手从网络的一边开始,扩散到网络的另一边缘的网桥,网络连通性才能恢复。比如当另一边缘的网桥,网络连通性才能恢复。比如当网络直径为网络直径为7的时候,要经过的时候,要经过6次握手。次握手。www.h3c.com48RSTP拓扑改变消息的传播拓扑改变消息的传播TCNRoot SwitchRoot SwitchTCTCl回顾一下回顾一下STP的的TCN传播传播-STP拓扑改变分为两拓扑改变分为两部分:部分:利用TCN BPDU将拓扑变化上报的根桥。根桥通过将FLAG中的TC比特置位(持续时间Max Age),通知所有其它交换机。www.h3c.com49RSTP拓扑改变消息的传播拓扑改变消息的传播TCRoot Switchl拓扑改变检测:拓扑改变检测:只有非边缘端口转变为Forwarding状态时,产生拓扑改变。l监测到拓扑改变后的动作:监测到拓扑改变后的动作:在两倍Hello时间内向所有指定端口和.根端口发送TC置位BPDU报文。清除从以上端口学习的MAC地址。l拓扑改变传播:拓扑改变传播:不再使用TCN报文。报文传送更直接迅速。www.h3c.com50与与802.1D相兼容相兼容802.1W802.1W802.1Dl802.1W与与802.1D相兼容:相兼容:RSTP的端口在三秒钟定时器后接收到STP的报文,则端口协议将切换到STP协议。切换到STP协议的RSTP端口将丧失快速收敛特性。出现STP与RSTP混用的情况,建议将STP设备放在网络边缘。www.h3c.com51RSTP协议的不足协议的不足VLAN 10,20VLAN 10,20l802.1W与与802.1D相比有相比有了巨大的进步,他解决了了巨大的进步,他解决了交换网络的快速收敛问题。交换网络的快速收敛问题。l但但RSTP和和STP还存在一还存在一个共同的不足,就是两种个共同的不足,就是两种协议都是单生成树协议,协议都是单生成树协议,不能形成基于不能形成基于VLAN的多的多生成树协议,在如右图所生成树协议,在如右图所示的环境下不能实现链路示的环境下不能实现链路的分担。的分担。n第一章第一章 STP(802.1D)协议原理协议原理n第二章第二章 RSTP(802.1W)协议原理协议原理n第三章第三章 MSTP(802.1S)协议原理协议原理n第四章第四章 STP的相关配置的相关配置目录目录www.h3c.com53MSTP协议原理协议原理nSTP/RSTP/MSTPSTP/RSTP/MSTP的比较的比较nMSTPMSTP的的BPDUBPDU报文结构报文结构nMSTPMSTP的基本概念的基本概念n端口状态和端口角色端口状态和端口角色nMSTPMSTP的工作原理的工作原理nSTPSTP相关附属功能相关附属功能www.h3c.com54STP/RSTP/MSTP的比较的比较l生成树目前包含三种协议:生成树目前包含三种协议:单生成树协议(STP)协议版本号为 0快速生成树协议(RSTP)协议版本号为 2多生成树协议(MSTP)协议版本号为 3www.h3c.com55STP/RSTP/MSTP的比较的比较lSTP的特性的特性形成一棵无环路的树:解决广播风暴并实现冗余备份lRSTP的特性的特性形成一棵无环路的树:解决广播风暴并实现冗余备份快速收敛lMSTP的特性的特性形成一棵无环路的树:解决广播风暴并实现冗余备份快速收敛形成多棵生成树实现负载均衡www.h3c.com56STP/RSTP/MSTP的比较的比较l一个交换机可能被包含在多个多生成树中一个交换机可能被包含在多个多生成树中l各多生成树实例相互独立转发数据各多生成树实例相互独立转发数据VLAN 2VLAN 2VLAN 3VLAN 3VLAN 2数据流VLAN 3数据流www.h3c.com57MSTP的基本概念的基本概念Region 1Region 3Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTISTMSTICIST ROOTIST MasterRegion ROOTRegion 2www.h3c.com58MSTP的基本概念的基本概念lCST:公共生成树(:公共生成树(Common spanning tree).lIST.内部生成树(内部生成树(Internal spanning tree).内部生成树是多生成树的一个特殊实例(内部生成树是多生成树的一个特殊实例( instance ID= 0 ).这个实这个实例做为例做为CIST的一部分不管配置与否永远存在的一部分不管配置与否永远存在.lCIST.公共内部生成树(公共内部生成树(Common and internal spanning tree).公共内部生成树是由所有公共内部生成树是由所有IST,STP交换机和交换机和RSTP交换机组成的一交换机组成的一棵贯穿整个网络的树。棵贯穿整个网络的树。lMSTI:多生成树实例(:多生成树实例(Multiple spanning tree instance)每一个每一个MSTI都有唯一的实例都有唯一的实例ID标识(标识(ID取值范围为取值范围为116).www.h3c.com59MSTP的基本概念的基本概念lMST区域(区域(MST region).域名(Region name).修正级别(Revision level) (目前保留).实例和VLAN的映射.所有拥有相同域配置(region-configuration)的MSTP交换机必须连续.l总根(总根(CIST Root).由网络中所有交换机竞选出的优先级最高的交换机成为总根.l域根(域根(Region Root).在一个域内拥有相同域配置的MSTP交换机为某一多生成树实例竞选出的优先级最高的交换机成为该生成树实例的域根。l主交换机(主交换机(Master Bridge).主交换机也就是IST Master,它是域内距离总根最近的交换机.www.h3c.com60MSTP端口角色端口角色-CISTRegion 3Region 2Region 1Region 4CIST ROOTM/R PortDPDPMaster/Root PortAlternate PortBackup portDesignated PortDPM/R Pwww.h3c.com61MSTP端口角色端口角色-CISTl根端口根端口/主端口(主端口(Root Port/Master Port)交换机上到总根具有最短路径的端口成为根端口(交换机上到总根具有最短路径的端口成为根端口(Root Port),),如果该交换机是主交换机,则相应的根端口为该域的主端口。如果该交换机是主交换机,则相应的根端口为该域的主端口。根端口负责向总根转发数据流量根端口负责向总根转发数据流量l指定端口(指定端口(Designated Port)局域网上到总根具有最短路径的端口成为指定端口局域网上到总根具有最短路径的端口成为指定端口指定端口负责为所在的局域网转发数量流量指定端口负责为所在的局域网转发数量流量l可选端口(可选端口(Alternate Port)局域网上处于备份地位的端口成为可选端口局域网上处于备份地位的端口成为可选端口可选端口不转发数据流量可选端口不转发数据流量l备份端口(备份端口(Backup Port)交换机上连接到自己且端口状态为丢弃的端口成为备份端口交换机上连接到自己且端口状态为丢弃的端口成为备份端口www.h3c.com62MSTP端口角色端口角色/状态与行为状态与行为lRoot/Master port根端口具有三种端口状态:Discarding:接受BPDU,不转发业务数据包Learning:接受和发送BPDU,但不转发业务数据包Forwarding:转发所有数据包lDesignated port指定端口具有三种端口状态: Discarding:接受BPDU,不转发业务数据包Learning:接受和发送BPDU,但不转发业务数据包Forwarding:转发所有数据包lAlternated port只有一种端口状态:discarding接受BPDU,不转发业务数据包lBackup port只有一种端口状态:discarding接受BPDU,不转发业务数据包www.h3c.com63MSTP工作原理工作原理-BPDU格式格式MSTI配置消息格式配置消息格式MST配置消息格式配置消息格式BPDU配置消息格式:www.h3c.com64MSTP工作原理工作原理-BPDU比较原则比较原则lMSTP配置消息优劣比较原则配置消息优劣比较原则:CIST RootBridgeIDExternal Root Path Cost: ERPCIST Master IDInternal Root Path Cost: IRPCDesignatedBridgeIDDesignatedPortIDwww.h3c.com65MSTP工作原理工作原理-端口角色确定端口角色确定l选择总根选择总根具有最小桥具有最小桥ID的交换机成为总根的交换机成为总根l选择选择IST Master(针对(针对MST域)域)域内具有最小外部根路径值的交换机成为主交换机域内具有最小外部根路径值的交换机成为主交换机l选择根端口选择根端口接受最优配置消息的端口成为根端口接受最优配置消息的端口成为根端口l选择指定端口选择指定端口LAN上具有最优端口优先级向量的端口成为指定端口上具有最优端口优先级向量的端口成为指定端口l选择端口选择端口端口优先级劣于接受到的配置消息的端口成为选择端口端口优先级劣于接受到的配置消息的端口成为选择端口l备份端口备份端口端口优先级劣于接受到的配置消息且连接到本交换机的端口端口优先级劣于接受到的配置消息且连接到本交换机的端口www.h3c.com66MSTP端口角色端口角色-CISTRegion 3Region 2Region 1Region 4CIST ROOTM/R PortDPDPMaster/Root PortAlternate PortBackup portDesignated PortDPM/R PCSTISTwww.h3c.com67MSTP工作原理工作原理-MSTIlMSTI生成树的形成:生成树的形成:l选择域根选择域根域内相应实例内具有最小域内相应实例内具有最小BridgeID的交换机成为域根的交换机成为域根 l选择根端口,指定端口,选择端口和备份端口选择根端口,指定端口,选择端口和备份端口上述端口的选择和上述端口的选择和CIST类似类似l注意:注意:MSTI的优先级向量不包括的优先级向量不包括CIST RootBridge和和ERPC如如 RegionRoot: IRPC: DB: DP: BP最优优先级向量的比较和最优优先级向量的比较和CIST的类似的类似www.h3c.com68MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R Portwww.h3c.com69MSTP工作原理工作原理-MSTI实例实例Root PortDesignated PortVLAN 2 map to instance 2VLAN 3 map to instance 3Others map to instance 0MasterRegion RootRegion RootMasterRegion RootMSTI 2MasterRegion RootMSTI 3www.h3c.com70MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R Portwww.h3c.com71MSTP工作原理工作原理-MSTI实例实例VLAN 2 map to instance 2VLAN 4 map to instance 4Others map to instance 0CIST RootRegion RootRegion RootMSTI 2Region RootMSTI 4Region Rootwww.h3c.com72MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R Portwww.h3c.com73MSTP工作原理工作原理-MSTI实例实例Root PortDesignated PortVLAN 3 map to instance 3VLAN 5 map to instance 5Others map to instance 0MasterRegion RootRegion RootMasterRegion RootMSTI 3MasterRegion RootMSTI 5www.h3c.com74MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R Portwww.h3c.com75MSTP工作原理工作原理-MSTI实例实例VLAN 4 map to instance 4VLAN 5 map to instance 5Others map to instance 0CIST RootRegion RootRegion RootMSTI 4Region RootMSTI 5Region RootMasterwww.h3c.com76MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R PortRegion RootRegion RootRegion RootRegion RootRegion RootRegion RootRegion Rootwww.h3c.com77MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R PortRegion RootRegion RootRegion RootRegion RootRegion RootRegion RootRegion RootVLAN2PC1VLAN2PC2www.h3c.com78MSTP的工作原理的工作原理-MSTIRegion 3Region 1Region 4CSTRevision level: 0VLAN mapping:VLAN 3 to Instance 3VLAN 5 to Instance 5VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 4 to Instance 4VLAN others to ISTRevision level: 0VLAN mapping:VLAN 2 to Instance 2VLAN 3 to Instance 3VLAN others to ISTRevision level: 0VLAN mapping:VLAN 4 to Instance 4VLAN 5 to Instance 5VLAN others to ISTCIST ROOTRegion 2M/R PortDPM/R PortDPAPM/R PortRegion RootRegion RootRegion RootRegion RootRegion RootRegion RootRegion RootVLAN3PC1VLAN3PC2n第一章第一章 STP(802.1D)协议原理协议原理n第二章第二章 RSTP(802.1W)协议原理协议原理n第三章第三章 MSTP(802.1S)协议原理协议原理n第四章第四章 STP的相关配置的相关配置目录目录www.h3c.com80STP相关配置相关配置-开启开启STPl生成树在交换机缺省是关闭的,如果组网中可能存在生成树在交换机缺省是关闭的,如果组网中可能存在路径回环,则要通过命令开启生成树功能:路径回环,则要通过命令开启生成树功能:H3C stp enablel如果确定某个端口连接的部分不存在回路,则可以通如果确定某个端口连接的部分不存在回路,则可以通过命令关闭该端口的生成树功能:过命令关闭该端口的生成树功能:H3C-Ethernet0/1 stp disablel也可以根据需要关闭交换机的生成树功能也可以根据需要关闭交换机的生成树功能,或者开启或者开启某个端口的生成树功能。某个端口的生成树功能。www.h3c.com81STP相关配置相关配置-MSTPl大多数交换机的缺省大多数交换机的缺省STP模式为模式为RSTP,可以通过命,可以通过命令改变:令改变:H3C stp mode stp,rstp,mstpl配置生成树实例:配置生成树实例:H3C stp region-configuration -进入域配置。进入域配置。 SwitchA-mst-regionregion-name test -配置域名。配置域名。 SwitchA-mst-regioninstance 1 vlan 10 to 20 -配置配置STP多实例与多实例与VLAN映射关系。映射关系。 SwitchA-mst-regionactive region-configuration -激激活域配置活域配置www.h3c.com82STP/MSTP相关配置相关配置-可配参数可配参数l生成树可配置参数包括生成树可配置参数包括:网桥的优先级(网桥的优先级(BridgePriority)端口的优先级(端口的优先级(PortPriority)端口对应链路的路径开销(端口对应链路的路径开销(PortPathCost)三个重要的定时器参数(三个重要的定时器参数(HelloTime/Max Age/ForwardDelay)整个交换网络的直径(整个交换网络的直径(BridgeDiameter)www.h3c.com83STP/MSTP相关配置相关配置参数名称参数名称参数名称参数名称缺省值缺省值缺省值缺省值值域值域值域值域配置视图配置视图配置视图配置视图BridgePriorityBridgePriority3276832768系统视图系统视图系统视图系统视图PortPriorityPortPriority1281280 010241024(步长:(步长:(步长:(步长:1616)PortPathCostPortPathCost20,00020,000Max AgeMax Age20s20s6 64040Hello TimeHello Time2s2s1 11010Forward DelayForward Delay15s15s4 43030Bridge DiameterBridge Diameter7 70 06144061440(步长:(步长:(步长:(步长:40964096)端口视图端口视图端口视图端口视图端口视图端口视图端口视图端口视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图系统视图1 1200,000200,000www.h3c.com84STP配置配置-选取合适的根桥选取合适的根桥l网桥网桥ID由两部分组成由两部分组成:BridgePriority+BridgeMacAddressl如果网络中的所有交换机都在缺省配置下,根据配置如果网络中的所有交换机都在缺省配置下,根据配置消息比较原则,消息比较原则,MAC地址最小的交换机被选为根桥,地址最小的交换机被选为根桥,但是该交换机未必是理想的根桥,可以通过命令配置但是该交换机未必是理想的根桥,可以通过命令配置Bridge Priority将合适的交换机推举为根桥将合适的交换机推举为根桥H3C stp priority bridge-priority www.h3c.com85STP配置配置-配置端口开销配置端口开销l从本网桥到根桥的路径上所有经过端口的端口开销之从本网桥到根桥的路径上所有经过端口的端口开销之和为和为根路径开销根路径开销,可以通过命令来改变端口开销的,可以通过命令来改变端口开销的值值lH3C-Ethernet0/1 stp cost cost 链路速率链路速率链路速率链路速率推荐值推荐值推荐值推荐值推荐取值范围推荐取值范围推荐取值范围推荐取值范围值域值域值域值域=110kb/s=110kb/s1Mb/s1Mb/s10Mb/s10Mb/s100Mb/s100Mb/s1Gb/s1Gb/s10Gb/s10Gb/s100Gb/s100Gb/s1Tb/s1Tb/s10Tb/s10Tb/s200,000,000200,000,00020,000,00020,000,0002,000,0002,000,000200,000200,00020,00020,0002,0002,00020020020202 220,000,00020,000,000200,000,000200,000,0002,000,0002,000,000200,000,000200,000,000200,000200,00020,000,00020,000,00020,00020,0002,000,0002,000,0002,0002,000200,000200,00020020020,00020,0002020200020002 22002001 120201 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,0001 1200,000,000200,000,000www.h3c.com86STP相关配置相关配置-端口优先级端口优先级l根据配置消息比较原则,有时候会比较端口根据配置消息比较原则,有时候会比较端口IDl端口端口ID由两部分组成由两部分组成: PortPriority+PortIndex,其中,其中端口优先级部分是可配置的命令格式为端口优先级部分是可配置的命令格式为H3C-Ethernet0/1 stp port priority port-priorityLANLAN平行链路平行链路平行链路平行链路多个端口连接到一个网段多个端口连接到一个网段多个端口连接到一个网段多个端口连接到一个网段www.h3c.com87STP相关配置相关配置-Hello timelhello time的配置需要注意:的配置需要注意:较长的较长的hello time可以降低生成树计算的消耗;较短的可以降低生成树计算的消耗;较短的hello time可以在丢包率较高的时候,增强生成树的健壮性。可以在丢包率较高的时候,增强生成树的健壮性。但是,过长的但是,过长的hellotime会导致链路故障的错误判断;过短会导致链路故障的错误判断;过短的的hellotime或导致频繁发送配置消息,增大或导致频繁发送配置消息,增大CPU和网络负和网络负担。担。l命令格式为:命令格式为:H3C stp timer hello centisecondswww.h3c.com88STP相关配置相关配置-Max Agelmax age的配置需要注意:的配置需要注意:过长的过长的Max Age会导致链路故障不能被及时发现;会导致链路故障不能被及时发现;过短的过短的Max Age可能会在网络拥塞的时候使交换机误认为链可能会在网络拥塞的时候使交换机误认为链路故障,造成频繁的生成树重新计算。路故障,造成频繁的生成树重新计算。l命令格式为:命令格式为:H3C stp timer max-age centisecondswww.h3c.com89STP相关配置相关配置-Forward Delaylforward delay的配置需要注意:的配置需要注意:过长的过长的Forward Delay会导致生成树的收敛太慢;会导致生成树的收敛太慢;过短的过短的Forward Delay可能会在拓扑改变的时候,引入暂时可能会在拓扑改变的时候,引入暂时的路径回环。的路径回环。l命令格式为:命令格式为:H3C stp timer forward-delay centisecondswww.h3c.com90STP相关配置相关配置-网络直径网络直径l网络直径的定义为:网络直径的定义为:任意两台终端设备之间通过的交换机数目的最大值任意两台终端设备之间通过的交换机数目的最大值l改变网络直径会间接影响到改变网络直径会间接影响到Max Age和和Forward Delay这两个参数的值,而且这种影响比直接手工配这两个参数的值,而且这种影响比直接手工配置两个参数较为客观。置两个参数较为客观。l所以当网络中加入交换机可以通过改变网络直径参数所以当网络中加入交换机可以通过改变网络直径参数来达到适应网络状况的目的。来达到适应网络状况的目的。l命令格式为:命令格式为:H3C stp bridge-diameter bridgenumwww.h3c.com91STP监控与维护监控与维护l显示生成树协议统计和状态信息的命令:显示生成树协议统计和状态信息的命令:display stp interface interface_list l清除生成树协议统计和状态信息的命令:清除生成树协议统计和状态信息的命令:reset stp interface interface_list www.h3c.com92总结总结lSTP协议协议形成一棵无环路的树:解决广播风暴并实现冗余备份形成一棵无环路的树:解决广播风暴并实现冗余备份lRSTP协议协议形成一棵无环路的树:解决广播风暴并实现冗余备份形成一棵无环路的树:解决广播风暴并实现冗余备份快速收敛快速收敛lMSTP协议协议形成一棵无环路的树:解决广播风暴并实现冗余备份形成一棵无环路的树:解决广播风暴并实现冗余备份快速收敛快速收敛形成多棵生成树实现负载均衡形成多棵生成树实现负载均衡l相关配置相关配置杭州华三通信技术有限公司www.h3c.com结束结束
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号