Bridging: The Spanning Tree Protocol

the Spanning Tree Protocol (STP) manages to make any topology loop free

At the leaves of the tree are the hosts which are linked to so-called access bridges (commonly called access switches): the bridges that give network connectivity to the hosts. Access bridges are mainly used to forward traffic between the hosts linked to the same bridge, but they also have one or more links to the upper-layer bridges. 

Note that the traffic exchanged between any pair of hosts within the L2 network uses L2 protocols to travel (i.e., Ethernet). Routing can be implemented at the core or through the core.
Root Bridge

• The root bridge is the only bridge that generates BPDUs. The other bridges transmit BPDUs only when they receive one.
• The root bridge makes sure each bridge in the network comes to know about a topology change when one occurs .

Note that the selection of the port states and roles (and therefore of the links that should be enabled or disabled) depends on the location of the root bridge in the topology: this is because first you select the root bridge, and then you build the best tree based on that.

Designated Bridges
While each tree has only one root bridge, there is one designated bridge for each LAN, which becomes the bridge all hosts and bridges on the LAN use to reach the root. The designated bridge is chosen by determining which bridge on the LAN has the lowest path cost to the root bridge.
Port states
An STPport is a port in a bridge that runs the STP. This port will process ingress BPDUs and transmit BPDUs

Disabled
The port is shut down (through administrative action); it does not receive or transmit any traffic.With the exception, ingress BPDUs are processed regardless of the port state. Whether a port in a given state receives ingress BPDUs or transmits BPDUs depends on the port’s role.
Blocking
The port is up, but the STPhas blocked it. It cannot be used to forward any data traffic.
Listening
The port is enabled, but it cannot be used to forward any data traffic.
Learning
The port is enabled, but it cannot be used to forward any data traffic; however, the bridge’s address learning process is active. The state allows a bridge to reduce the amount of
flooding that would otherwise be required with an empty forwarding database.
Forwarding
The port is enabled, learning is active, and data traffic can be forwarded.

In addition, an administrator can manually remove a port from any of these states and disable it. When a port is administratively disabled, it can be re-enabled only by another administrative intervention

Port roles

Root
For each bridge, with the exception of the root bridge, the port with the lowest path cost to the root bridge is selected as the root port.

Designated
On each LAN, the port with the smallest path cost to the root bridge is selected as the designated port. The bridge to which the designated port belongs is called the designated bridge for the LAN. Note that a bridge with ports on different LANs can have more than one designated port

Bridge and Port IDs

Bridge ID
Each bridge is assigned an ID, called the bridge ID, that is defined as an 8-byte value split into two components. The lowest six bytes are assigned the Ethernet MAC address of one of the bridge ports , and the highest two bytes are a configurable priority, called the bridge priority.

Port ID
Each port is assigned an ID. A portion of the ID represents a unique identifier called the port number. The way the port number is assigned is implementation dependent, and its value is meaningful only locally on the bridge.
Another portion of the ID, called the port priority, is used to assign a priority to the port (where a lower value means a higher priority).

Port cost
Each port is assigned a cost. The lower the value, the more preferred the port is. When not explicitly configured, the port is assigned a default cost based on the port’s speed.

Timers
The STPuses a set of per-port and per-bridge timers.

Bridge Protocol Data Units (BPDUs)

Configuration BPDU
Used to define the loop-free topology.
Topology Change Notification (TCN) BPDU
Used by a bridge to notify the root bridge about a detected topology change.

Flags
Only two flags are used: TC (Topology Change) and TCA (Topology Change Acknowledgment).
Root Bridge ID
ID of the root bridge. This is what the transmitting bridge thinks the current root bridge is.
Root Path Cost
Cost of the shortest path from the transmitting bridge to the root bridge. The cost is 0 when the transmitting bridge is (or thinks it is to become) the root bridge.

Bridge ID
ID of the transmitting bridge.
Port ID
Port identifier. See the section “Bridge and Port IDs” for its syntax.
Message Age
How much time has passed since the root bridge generated the information in this BPDU.
Max Age
Maximum lifetime for configuration BPDUs.
Hello Time
Timeout used by the Hello timer.
Forward Delay
Timeout used by the Forward Delay timer

Priority Vector

Four components of the configuration BPDU—Root Bridge ID, Root Path Cost, Bridge ID, and Port ID—make up the priority vector. Because these four components are in sequence, this vector can be seen as a single 22-byte number.  the priority vector determines who wins the bidding for contested roles such as root bridge and designated bridge.
Given two priority vectors PV1=[BR-Root1,Cost1,BR-ID-1,Port-ID1] and PV2=[BR-Root2,Cost2,BR-ID-2,Port-ID2] , PV1 is said to be superior when it is a lower numeric value than PV2, and inferior when PV1 is a higher numeric value than PV2. In other words, PV1 is superior to PV2 if BR-Root1 < BR-Root2, or, in case they are the same, if Cost1 < Cost2, or, if they are the same too, if BR-ID1 < BR-ID2, or, when the two bridge IDs match too, when Port-ID1<Port-ID2.

When to Transmit Configuration BPDUs

• The root bridge runs a timer (the Hello timer) that expires regularly and triggers the transmission of configuration BPDUs. One BPDU is transmitted on each one of its designated ports. Only the root bridge generates new BPDUs, but when a bridge is first enabled, it thinks it is the root bridge (because it has no other priority vector to compare its own to). So it places all of its ports into the designated role, starts its Hello timer, and begins to generate BPDUs
• Nonroot bridges generate BPDUs only in response to ones they receive on their root ports; in other words, they relay BPDUs. BPDUs transmitted by nonroot bridges carry the same information as the BPDUs they received, with the exception of the following fields that they update :
• The transmitter’s bridge ID and port ID are replaced by the bridge with its own information.
• The bridge updates the cost to be the sum of the cost it received and the cost of the port on the local bridge (its root port) that it received the BPDU on.
• The message age is updated

Regardless of whether a bridge is the root bridge, it transmits a configuration BPDU
in the following cases as well:
• When a bridge receives a BPDU with a priority vector that’s inferior to the one it would use on the same port, it replies with its own (superior) information.
• When a bridge receives a TCN BPDU, it acknowledges its reception right away with the transmission of a configuration BPDU that has a special flag set. This helps propagate changes in topology quickly
the STP enforces rate limiting: a bridge cannot transmit more than one Configuration BPDU per second out of any of its ports

While there can be one root port per bridge, there is only one designated port per LAN. The STPensures that each bridge chooses the same port. The designated port should be the one that has the lowest path cost to the root bridge. Thus, it’s the port with the best priority vector.

These are the bridge timers:
Hello
Used to regularly generate configuration BPDUs. Only the root bridge uses it.
TCN
Used by a bridge that has detected a topology change and must notify the root bridge about it.
Topology change
Used by the root bridge to remember to set a specific flag in its configuration BPDUs. This flag is used to notify the other bridges about a topology change.
Aging timer
Used to clean up stale addresses from the forwarding database. This timer is used by the bridge regardless of whether the STPis used. 

Each bridge keeps two copies of its timer configuration: the one configured locally by the administrator, and the one received from the root bridge.

The root bridge is the only one that uses its own configured timers; it makes all the other bridges adopt its configuration. Nonroot bridges use the timer configurations carried by the BPDUs they receive on their root ports.

These are the port timers:

Message Age
the information carried by a BPDU
has a limited lifetime.
The timer is restarted each time a BPDU is received on the port. Whenever a BPDU is received, its message age is compared to the network’s max age and the frame is dropped if it is too old. The Message Age timer runs on nondesignated ports (i.e., the ones that receive superior BPDUs).  When the timer expires, the port is restarted, and therefore assigned the designated role.
Forward Delay
Takes care of the state transitions from listening to learning, and from learning to forwarding.
Hold
The Hold timer, when needed, runs on designated ports (the ones transmitting configuration BPDUs).

Avoiding Temporary Loops
The root and designated ports are the only ones that are assigned the forwarding state. When a port is assigned the root or designated role, however, it is not assigned the forwarding state right away: it first has to go through two intermediate states. These intermediate states suppress the risk of temporary loops while the network converges toward a stable loop-free topology.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值