生成树协议 Spanning Tree Protocol 深圳职业技术学院计算机系网络专业 © 2006, Shenzhen Polytechnic. All rights reserved. 1 教学目标( Objectives ) • 1. IP地址概念( Concept of IP Address ) • 2. IP地址分类 (Class of IP Address) • 3. 保留和私有地址( Reserved and Private IP Address) • 4. 网络掩码和子网划分(Network Mask and Subnetting ) 5. 可变长度子网掩码( VLSM ) • 6. 汇总和CIDR( Summarization and CIDR) © 2006, Shewzhen Polytechnic. All rights reserved. 2 Objectives • Redundant topologies • Spanning Tree Protocol © 2006, Shewzhen Polytechnic. All rights reserved. 3 冗余(Redundancy) 冗余网络拓扑确保网络持续工作,避免单点故障 Redundant networking topologies are designed to ensure that networks continue to function in the presence of single points of failure. © 2006, Shewzhen Polytechnic. All rights reserved. 4 冗余拓扑(Redundant Topologies) © 2006, Shewzhen Polytechnic. All rights reserved. 5 冗余拓扑(Redundant Topologies) • 1.冗余拓扑的目标是为了避免网络出现单点故障 • A goal of redundant topologies is to eliminate network outages caused by a single point of failure. • 2.所有的网络需要冗余来提高可靠性 • All networks need redundancy for enhanced reliability. © 2006, Shewzhen Polytechnic. All rights reserved. 6 简单的冗余交换拓扑 (Simple Redundant Switched Topology) © 2006, Shewzhen Polytechnic. All rights reserved. 7 简单的冗余交换拓扑 (Simple Redundant Switched Topology) • 1.冗余拓扑消除了单点故障 • Redundant topologies eliminate single points of failure. • 2. 交换机对不知道地址的帧进行泛洪 • Switches will flood frames for unknown destinations. • 3.交换机对广播和组播也进行泛洪。 • Broadcasts and multicasts are also flooded. • 4.冗余交换拓扑或许会带来广播风暴、多帧拷贝以及MAC地址表不 稳定的问题 • A redundant switched topology may cause broadcast storms, multiple frame copies, and MAC address table instability problems. © 2006, Shewzhen Polytechnic. All rights reserved. 8 广播风暴(Broadcast Storm) © 2006, Shewzhen Polytechnic. All rights reserved. 9 多帧传输(Multiple Frame Transmissions) 在冗余交换网络中,对终端设备来讲,收到多帧相同数据是可能的。 In a redundant switched network it is possible for an end device to receive multiple frames. © 2006, Shewzhen Polytechnic. All rights reserved. 10 MAC地址表不稳定(MAC Database Instability) 交换机从错误的接口学到MAC地址。 A switch can learn that a MAC address is on a port when it is not. © 2006, Shewzhen Polytechnic. All rights reserved. 11 创建逻辑无环路拓扑 (Creating a logical loop free topology) • 1.冗余增加了可靠性,但是同时将物理环路带进网络。 Reliability is increased by redundancy. redundancy connections introduce physical loops into the network. • 2. 解决办法就是创建逻辑无环路拓扑,同时保留物理环存在 • The solution is to allow physical loops, but create a loop free logical topology. • 3.无环路拓扑称为树,并且是可扩展的树。 • The loop free logical topology created is called a tree. It is a spanning tree because all devices in the network are reachable or spanned. • 4.创建无环路拓扑的算法称为生成树算法。 • The algorithm used to create this loop free logical topology is the spanning-tree algorithm. © 2006, Shewzhen Polytechnic. All rights reserved. 12 STP术语(STP Terms) • 1. 桥ID (Bridge ID) • 2. 开销(Cost) • 3. 桥协议数据单元(BPDU) © 2006, Shewzhen Polytechnic. All rights reserved. 13 桥ID (Bridge ID) 1.BID用来识别每一个交换机/网桥。 2.BID用来确定网络的中心,在STP中称为根桥。 3.优先级默认为32768 The BID consists of a bridge priority that defaults to 32768 © 2006, Shewzhen Polytechnic. All rights reserved. 14 开销(Cost) • 最短路径是cost累加,而cost是基于链路的速率的。 • Shortest path is based on cumulative link costs. Link costs are based on the speed of the link. © 2006, Shewzhen Polytechnic. All rights reserved. 15 桥协议数据单元(BPDU) • 1.交换机发送的创建逻辑无环路的数据包称为BPDU • The message that a switch sends, allowing the formation of a loop free logical topology, is called a Bridge Protocol Data Unit (BPDU). • 2.BPDU在阻塞的接口上也可以接收,这确保如果链路 或设备出现问题,新的生成树会被计算 • BPDUs continue to be received on blocked ports. This ensures that if an active path or device fails, a new spanning tree can be calculated. • 3.默认,BPDU 2秒发送一次 • By default BPDUs are sent every two seconds. © 2006, Shewzhen Polytechnic. All rights reserved. 16 Spanning-Tree Protocol © 2006, Shewzhen Polytechnic. All rights reserved. 17 生成树操作(Spanning-Tree Operation) © 2006, Shewzhen Polytechnic. All rights reserved. 18 Spanning-Tree Operation(cont.) • 1.选举根桥,BID最小即是 • Select a single switch that will act as the root of the spanning tree • 2.计算自己到根桥距离 • Calculate the shortest path from itself to the root switch • 3.选择根端口,距离根桥最近的接口 • Choose one of its ports as its root port, for each nonroot switch. This is the interface that gives the best path to the root switch. • 4.选指定端口和非指定端口,非指定端口被阻塞。 • Select ports that are part of the spanning tree, the designated ports. Non-designated ports are blocked. © 2006, Shewzhen Polytechnic. All rights reserved. 19 生成树操作规则(Spanning-Tree Operation Rules) • 1.每个网络只有一个根桥 • One root bridge per network. • 2.每个非根桥只有一个根端口 • One root port per nonroot bridge. • 3.每个段只有一个指定端口 • One designated port per segment. • 4.非指定端口不被使用 • Nondesignated ports are unused. © 2006, Shewzhen Polytechnic. All rights reserved. 20 STP实例(STP Example) © 2006, Shewzhen Polytechnic. All rights reserved. 21 生成树端口状态(Spanning-Tree Port States) © 2006, Shewzhen Polytechnic. All rights reserved. 22 生成树端口状态(Spanning-Tree Port States) • 1.在阻塞状态,端口仅能接收BPDU,需要20秒改变这种 状态 • In the blocking state, ports can only receive BPDUs. It may take up to 20 seconds to change from this state. • 2.在侦听状态,交换机确定是否有到根桥的其它路径。 该状态持续15秒。在该状态,用户的数据不能转发,也 不能学习MAC地址。 • In listening state, switches determine if there are any other paths to the root bridge. the forward delay and lasts for 15 seconds. In the listening state, user data is not being forwarded and MAC addresses are not being learned. © 2006, Shewzhen Polytechnic. All rights reserved. 23 生成树端口状态(Spanning-Tree Port States) • 3.在学习状态,用户的数据不能转发,但是可以学习 MAC地址,该状态持续15秒。 • In learning state user data is not forwarded, but MAC addresses are learned from any traffic that is seen. The learning state lasts for 15 seconds and is also called the forward delay. • 4.在转发状态,用户数据被转发,MAC地址继续学习, BPDU仍然工作。 • In forwarding state user data is forwarded and MAC addresses continue to be learned. BPDUs are still processed. © 2006, Shewzhen Polytechnic. All rights reserved. 24 Case Study • Refer to the exhibit. All switches have the default STP configuration and all links are Fast Ethernet. Which port on which switch will Spanning Tree place in blockingmode? © 2006, Shewzhen Polytechnic. All rights reserved. 25 思考题(Questions) 1.环路的存在,会导致 2.交换机的ID由 和 3.选举根桥时,具有较 、 口和 值的桥ID的交换机会成为根桥。 。 口是处于转发状态的。 、 6.决定指定口时,会按顺序考虑 7.缺省时,转发延时为 秒。 8.STP中,交换机的端口有 © 2006, Shewzhen Polytechnic. All rights reserved. 问题。 组成。 4.100M链路的新STP Cost为 5.STP收敛后 和 、 和 秒,Hello时间为 、 、 因素。 秒,BPDU的存活时间为 和 状态。 26