《stp生成树(stp spanning tree)》由会员分享,可在线阅读,更多相关《stp生成树(stp spanning tree)(13页珍藏版)》请在金锄头文库上搜索。
1、stp生成树(STP spanning tree)一、STP(生成树协议)PVST、PVST+、RSTP、MSTPIEEE 802.1D STPIEEE 802.1Q VLANIEEE 802.1p QoSIEEE 802.1x dot1xIEEE 802.1w RSTPIEEE 802.1s MSTP1。作用:防止二层交换环路1)为什么交换网络会形成环路?(原因:为了提高网络的可靠性,增加冗余设备,从而导致交换网络环路)2)如何防止二层交换环路?生成树协议2。生成树协议(生成树协议)1)STP如何选举一)选举根桥每个交换机(网桥)都拥有一个bridgeid(= bridgepriority
2、+桥MAC地址)0 65535,缺省32768b)在每个非根桥上选举根端口我到达根桥的路径费用最小)米100100m 191410g 2二)发送方网桥ID最小三)发送portid最小(portid =端口优先级+端口号)0 255,缺省123四)自身的portid最小(portid =端口优先级+端口号)C)为每个网段(二层网段)选择一个指定端口(指定端口)我到达根桥的路径费用最小)米100100m 191410g 2二)发送方网桥ID最小三)发送portid最小(portid =端口优先级+端口号)0 255,缺省123四)自身的portid最小(portid =端口优先级+端口号)2)报文
3、BPDU(桥协议数据单元)桥协议数据单元在STP中,BPDU报文由根桥产生,其他交换机中转该BPDU报文3)假设网络中的交换机设备刚启动,每个交换机都认为自己是根桥,发送BPDU报文经过一段时间的交互,最终选择根桥/同时可以确定每个交换机上的不同端口的角色(根端口和指定端口),被选择为RP或DP的端口必须经过2个前锋Delay时间后,才能进入向前状态。问题1:刚启动的时候,所有交换机的端口处于块状态。被选择成RP或DP的端口先进入听,再经过学习状态,最后进入向前状态其他端口(没有被选举为RP或DP)继续停留在块状态。问题2:为什么RP / DP需要经过2个转发延迟才进入向前状态?为了防止STP
4、收敛过程中的临时环路,当然引入转发延迟后,在STP收敛过程中,将导致网络的临时中断。3:问题转发延迟为什么等于15秒2秒发送一次BPDU报文每隔,通常网络的直径为74)STP端口的角色:RP / DP /其他的统称为NDP,反相/ DP最终进入转发状态,NDP(非指定端口)为阻断状态STP端口的状态:阻塞(稳定状态):不会学习MAC地址,不能转发数据帧Listening (transition state): will not learn MAC address, can not forward data frameLearning (transition state): learn MAC
5、address, cannot forward data frameForwarding (stable state): learning MAC address, forwarding data frameIn what case does STP become convergent? All ports are Forwardig or Blocking States5) the type of BPDU message in STPA) Configuration BPDU (configuration BPDU): only by Root Bridge, other switches
6、 to this BPDUB) TCN BPDU (topology change notification BPDU): switches generated by the issuing topology changes6) the mechanism of topological changeIn an exchange network, if a switch changes its topology, it will generate TCN BPDU and send it along the direction of root bridge,(from the RP port,
7、you must get the confirmation TCA of the upstream switch, if you dont receive the TCA, send TCN BPDU again)Until the TCN BPDU message reaches root bridge.After root bridge receives the TCN BPDU, the configuration BPDU is sent over a subsequent period (Max-AGE+Forward_Delay)In the TC flag bit =1, all
8、 switches receive this Configuration BPDU with TC bit, and will be present in the MAC address table of this switchThe aging time of the item is set to Forward_delay 15 seconds7) PVSTP (Per VLAN)A) advantagesComputing a STP instance in each VLAN can realize the traffic sharing of different VLAN and i
9、mprove the utilization ratio of link.B) BridgeIDDifferent VLAN needs to calculate a STP instance, how to set up BridgeID?Implementation mode:I. there is a MAC address pool on a switch. In different VLAN computing STP, select an MAC address from it,Thus ensuring the unique BridgeID of different STP i
10、nstances.Ii. uses extended system ID.The original 16bit priority is divided into 2 parts, the former 4bit is still used as priority, and later 12bit maps the VLAN ID into it.VLAN 1 BridgeID (assuming the priority of the switch is default 32768)32769.MACVLAN 2 BridgeID (assuming the priority of the s
11、witch is default 32768)32770.MACSince the post 12bit is used as the mapping of VLAN ID, the switch priority of configuring PVST must be 4096Switch priority: 0/4096/8192C) PVST+ configurationSwitch (config) #spanning-tree VLAN VLAN_ID priority prioritySpanning-tree portfast (interface command) trunkS
12、panning-tree portfast default (global command)Interface range fa0/1, f0/5-10Define interface-range ALD fa0/1, fa0/5-10Interface range macro ALDIEEE 802.1d STPIEEE 802.1Q VLANIEEE 802.1w RSTPIEEE 802.1s MSTPTwo, RSTP (Rapid Spanning Tree Protocol)PVRST+1. election principle: exactly the same as STPTh
13、e difference between 2.RSTP and STP1) port rolesSTP:RP/DP/NDPRSTP:RP/DP/NDP (AP:Alternate Port, BP:Backup Port)Where AP (replace port) is used to replace Root PortBP (backup port), using backup Designated PortAP: if a port is due to receive BPDU message of other switches and enter blocking, then the
14、 port is AP;BP: if a port is entered into blocking by receiving the BPDU message of this switch, then the port is BP;2) port stateSTP: Blocking/Listening/Learning/ForwardingRSTP:Discarding/Learning/Forwaring3) the method of improving convergence speed of RSTPA) introduces Hello mechanism (similar to
15、 neighbor mechanism)If the Hello message is not received continuously for 3 times, it is considered that the neighbor fault will be aging from the BPDU message obtained by the neighborB) a switch C (one port is RP, the rest port is AP, in a blocking state), if the switch C RP fault, then AP becomes RP, the port can be directly forwarded(40