实现生成树 描述STP
透明桥接 A switch has the same characteristics as a transparent bridge. 交换机不对转发帧进行修改,MAC地址的学习,未知单播,广播的flooding,没有冗余功能。 A switch has the same characteristics as a transparent bridge.
What Is a Bridge Loop? 环路能发生在任何有一个冗余的路径或循环的桥接网络。 环路引起的现象广播风暴,MAC表不稳定,重复帧。 Bridge loops can occur any time there is a redundant path or loop in the bridge network.
Preventing Bridge Loops 禁用冗余的路径可以防止环路。可以手动关掉一个端口,但是没有自动备份的功能,生成树的思路,二层设备之间交换BPDU。 Bridge loops can be prevented by disabling the redundant path.
802.1D STP Configured root switch Redundant switch links Optimal path selection 配置根交换机 冗余交换机链接 最优路径选择 802.1D工作的离不开三个准则,四个要素,任何一个端口UP或者DOWN,生成树会重新收敛
Bridge Protocol Data Unit bpdu提供交换机之间的信息交换。 BPDUs provide for the exchange of information between switches.
The STP Root Bridge Reference point One root per VLAN Maintains topology 根桥交换机特点:一个参考点 每个vlan一个根 维护拓扑 CST,PVST,配置BPDU,拓扑改变BPDU
根桥的选择标准
扩展系统ID在桥ID字段 Bridge ID Without the Extended System ID Bridge ID with the Extended System ID 生成树要求一个交换机有唯一的BID,一个vlan就是一个虚拟交换机。CST的时候没有问题,PVST时要求一个VLAN有唯一的BID. PVST时建议手工设置根,否则,对于所有vlan,跟都是一个根
802.1D 16-bit Bridge Priority Field Using the Extended System ID Only four high-order bits of the 16-bit Bridge Priority field carry actual priority. Therefore, priority can be incremented only in steps of 4096, onto which will be added the VLAN number. Example: For VLAN 11: If the priority is left at default, the 16-bit Priority field will hold 32768 + 11 = 32779. 4 bits 12 bits Priority VLAN Number 20 215 Priority Values (Hex) Priority Values (Dec) 0 0 1 4096 2 8192 . . . . 8 (default) 32768 . . F 61440 只有四个高阶位的16位网桥优先级字段携带实际优先。 因此,优先级可以递增只有在步骤4096,到这将添加了VLAN号码。 示例:对于VLAN 11:如果优先级是留在默认,16位的优先级字段将容纳32768 + 11 = 32779。
Configuring the Root Bridge Switch(config)#spanning-tree vlan 1 root primary This command forces this switch to be the root. Switch(config)#spanning-tree vlan 1 root secondary This command configures this switch to be the secondary root. Or Root primary 第一次减2档,后面每次减1档;root secondary 是每次比root primary 小1 Switch(config)#spanning-tree vlan 1 priority priority This command statically configures the priority (in increments of 4096).
根桥选择 选举过程 Which switch has the lowest bridge ID?
生成树操作 One root bridge per network One root port per nonroot bridge One designated port per segment Nondesignated ports are blocking
生成树端口状态 Spanning tree transitions each port through several different states. 生成树转换每个端口通过几个端口状态。
本地交换机根端口选举 从多个端口收到BPDU,代表到根有备用路径
Spanning Tree Path Cost Link Speed Cost (Revised IEEE Spec) Cost (Previous IEEE Spec) 10 Gbps 2 1 1 Gbps 4 100 Mbps 19 10 10 Mbps 100 COST是累加的,是发送者到根桥的COST
Spanning Tree Protocol Root Port Selection SW X is the root bridge. SW Y needs to elect a root port. Which port is the root port on SW Y? Fast Ethernet total cost = 0 + 19. Ethernet total cost = 0 + 100.
STP Designated Port Selection Switch X is the root bridge. All ports on the root bridge are designated ports because they have a path cost of 0. Because the Ethernet segment has a path cost of 100, switch Y will block on that port. Do all segments have a designated port?
Example: Layer 2 Topology Negotiation TCN;当链路断掉,交换机损坏;端口变成转发;拓扑改变BPDU;BPDU TYPE=80;35秒,根连续发;交换机会把MAC表老化至15秒
Enhancements to STP PortFast Per VLAN Spanning Tree+ (PVST+) Rapid Spanning Tree Protocol (RSTP) Multiple Spanning Tree Protocol (MSTP) MSTP is also known as Multi-Instance Spanning Tree Protocol (MISTP) on Cisco Catalyst 6500 switches and above Per VLAN Rapid Spanning Tree (PVRST) 802.1D+VLAN=PVST;CST没有PVST灵活,而且不兼容;PVST+能和CST兼容(通过vlan1生成树不打TAG的方式; PVST和CST都有缺点,出现了RSTP(快速生成树),MSTP(多实例);PVRST还是cisco私有的 Postfast特点(1.up-down会不会发拓扑改变bpdu。2.会不会发BPDU。3.跳过了30秒等待时间)
Describing PortFast
Configuring PortFast Configuring Verifying spanning-tree portfast (interface command) or spanning-tree portfast default (global command) enables PortFast on all nontrunking ports Verifying show running-config interface fastethernet 1/1
IEEE Documents IEEE 802.1D - Media Access Control (MAC) bridges IEEE 802.1Q - Virtual Bridged Local Area Networks IEEE 802.1w - Rapid Reconfiguration (Supp. to 802.1D) IEEE 802.1s - Multiple Spanning Tree (Supp. to 802.1Q) IEEE 802.1t - Local and Metropolitan Area Network: Common Specifications
Summary Transparent bridges require no client configuration. A bridge loop may occur when there are redundant paths between switches. A loop free network eliminates redundant paths between switches. The 802.1D protocol establishes a loop-free network. The root bridge is a reference point for STP. Each STP port will host a specific port role. Enhancements now enable STP to converge more quickly and run more efficiently.