一、STP

1、两种BPDU格式

STP生成树协议_BPDU

2、选举比较顺序

■ Root Bridge ID (RBID)

■ Root Path Cost (RPC)

■ Sender Bridge ID (SBID)

■ Sender Port ID (SPID)

■ Receiver Port ID (RPID; not included in the BPDU, evaluated locally)

3、选举过程

①、Elect the root switch,通常把靠近核心的地方作为根交换机,把优先级配置最低即可。

The switch with the lowest bridge ID; the standard bridge ID is 2-byte priority followed by a MAC address unique to that switch.

STP生成树协议_BPDU_02

②Determine each switch’s Root Port

The one port on each nonroot switch that receives the superior resulting BPDU from among all received BPDUs on all its ports.

在非根交换机上收到较高级别的BPDU的为ROOT PORT。较高级别BPDU根据Root Path Cost(RPC)来计算。

③Determine the Designated Port for each segment

A converged STP topology results in only one switch forwarding Hellos onto each LAN

segment. The switch that forwards Hellos onto a LAN segment is called the designated

switch for that segment, and the port that it uses to forward frames onto that segment is

called the Designated Port (DP)

每个段发送较高级别BPDU的为DP。

④All ports that are neither Root Ports nor Designated Ports are superfluous in an

active topology and will be put into the Blocking state.

其他端口将被阻塞。

注:

1、Configuration BPDUs are sent out only from Designated Ports. Root and Non-Designated ports do not emit Configuration BPDUs because they would be inferior to BPDUs of a Designated Port on this segment and hence ignored.


2、Each port stores the best (that is, superior) BPDU it has received or sent itself.

Designated Ports store the BPDU they send; Root and Blocking ports store the best BPDU they receive. The stored BPDU determines the role of the port and is used for

comparisons.

4、接口状态

STP生成树协议_BPDU_03

二、PVST+和CST协同工作

1、在CST生成树中,其不知道任何vlan信息,所以其一个STP拓扑会用于所有vlan;对于PVST+其在trunk上使用vlan1和CST进行融合操作;在PVST+的其他vlan分别有各自的PVST+实例。

普通STP BPDU会发往0180.C200.0000,而PVST+会发往0100.0CCC.CCCD,而且会打上相应vlan的tag;CST交换机会把发往0100.0CCC.CCCD的多播帧当作普通帧进行泛洪,这样就可以在PVST+非vlan1内形成PVST+的无环网络。

2、在PVST+的vlan1中会同时发送标准的STP BPDU和PVST+的BPDU,但是只有标准的BPDU会用来计算生成树,PVST+的仅用来检测native vlan不匹配情况。

三、标准BPDU和PVST+ BPDU在Access和Trunk口的收发情况。

发方向:

1、在access口上仅发送标准IEEE BPDU。

2、在Trunk口上 a、在vlan1发送标准IEEE untag BPDU  b、在所有vlan发送PVST+ BPDU,包括vlan1,其中native vlan不打标,其他vlan需要打上相应vlan标签。

收方向:

1、access口仅接受处理标准IEEE BPDU。

2、在trunk口,根据标签把相应的BPDU分配到对应的vlan内,如果没有标签则分配到native vlan。然后检查BPDU中的PVID TLV,一致则处理,不一致则丢弃,并且宣告PVID_Inconsistent状态。