Step One - Electing Root BridgeWhen switch first becomes active, all of its active ports begin to send the BPDUs to well-known STP multicast address 01-80-c2-00-00-00. The default BPDU interval is 2 seconds, by default. The BPDUs contain the Bridge ID, Path cost to the Root bridge, etc.
Because the switch is just booted, it has no idea who Root bridge is. So, it announce itself as the Root bridge and set the Path cost to Root bridge to 0.
If the switch is connected with other switches, it will receive BPDUs from the neighbor. Once the switch receives a BPDU from another switch, it compares the received BPDU with itself using four-step decision sequence.
STP Four Steps Decision Sequence :
If the received BPDU is not better than itself, the received BPDU will be ignored.
If the received BPDU is better than itself, the switch performs the following task:1. Save the better BPDU in memory as the best BPDU it ever received.2. Stop sending the BPDU that announcing itself as the Root.3. Modify the better BPDU and relay it to all active ports4. Every time a BPDU is received, the switch performs this four-step decision sequence with the best BPDU of the switch.After the STP has converged, only Root bridge sends the BPDU. Non-Root bridges only relay or forward the BPDU.Only Bridge ID is needed when elect the Root bridge. The one with the lowest Bridge ID wins.Bridge ID consists of a Bridge Priority and a MAC address. If the Bridge priority are equal, the lower MAC address makes the Bridge ID better.If the attractive BPDU stops arriving from a neighbor for a period of time (20 seconds by default), the local port can once again resume the sending of BPDUs.
Note
A bridge uses four-step decision sequence to save a copy of the best BPDU seen on every port. When making this evaluation, it considers all of the BPDUs received on the port as well as the BPDU that would be sent on that port. As every BPDU arrives, it is checked against this four-step sequence to see if it is more attractive than the existing BPDU saved for that port. If the new BPDU (or the locally generated BPDU) is more attractive, the old value is replaced.
Step 2 - Electing Root Port
A bridge's Root Port is the port that is closest to the Root Bridge. Every non-Root Bridge must select one and only one Root Port. All ports of Root bridge is considered Root ports.There is a filed called Root Path Cost in the BPDUs. It's a cumulative cost of all links to the Root Bridge. As the Root Path Cost travels along, other switches can modify its value to make it cumulative.The original IEEE 802.1D standard defined Path Cost as 1000 Mbps divided by the link bandwidth in megabits per second. These Modern networks commonly are both either too close to or greater than the maximum scale of 1000 Mbps. The IEEE now uses a nonlinear scale for Path Cost.Generally, the higher the bandwidth of a link, the lower the cost of transporting data across it.Root Path Cost and Path CostRoot Path Cost is the cumulative cost of all the links leading to the Root Bridge. Only the Root Path Cost is carried inside the BPDU.The Path Cost, however, is not contained in the BPDU. It is known only to the local switch where the port resides.
The Root Path Cost value is determined in the following manner:
1. The Root Bridge sends out a BPDU with a Root Path Cost value of 0 because its ports sit directly on the Root Bridge.
2. When the next-closest neighbor receives the BPDU, it adds the Path Cost of its own port where the BPDU arrived. (This is done as the BPDU is received.)
3. The neighbor sends out BPDUs with this new cumulative value as the Root Path Cost.4. The Root Path Cost is incremented by the ingress port Path Cost as the BPDU is received at each switch down the line.5. Notice the emphasis on incrementing the Root Path Cost as BPDUs are received. When computing the Spanning Tree algorithm manually, remember to compute a new Root Path Cost as BPDUs come in to a switch port, not as they go out.
Remember that STP costs are incremented as BPDUs are received on a port, not as they are sent out a port.Path Cost is a value assigned to each port. It is added to BPDUs received on that port to calculate the Root Path Cost.Root Path Cost is defined as the cumulative cost to the Root Bridge. In a BPDU, this is the value transmitted in the cost field. In a bridge, this value is calculated by adding the receiving port's Path Cost to the value contained in the BPDU.
Step 3 - Electing Designated PortsInstead, only one of the links on a segment should forward traffic to and from that segment―the one that is selected as the Designated Port. Switches choose a Designated Port based on the lowest cumulative Root Path Cost to the Root Bridge. For example, a switch always has an idea of its own Root Path Cost, which it announces in its own BPDUs. If a neighboring switch on a shared LAN segment sends a BPDU announcing a lower Root Path Cost, the neighbor must have the Designated Port. If a switch learns only of higher Root Path Costs from other BPDUs received on a port, however, it then correctly assumes that its own receiving port is the Designated Port for the segment.
Disable - Ports that are administratively shut down, or by the system because of a fault condition, are in Disable state.Blocking - After a port initializes, it begins in the Blocking state so that no bridging loops can form.
- Only can receive BPDUs
- Cannot receive or transmit data
- Cannot add MAC address to CAM
- Cannot send BPDU
Listening (15 seconds)- A port is moved from Blocking to Listening if the switch thins that the port can be selected are a Root port or Designated port. The Listening state is 15 seconds long, by default. This period of time called the Forward Delay.
- Can receive BPDUs
- Can send BPDUs
- Cannot receive or send data
- Cannot add MAC address to CAM
Learning (15 seconds)- Recording MAC address before forwarding frames. The port also stay in Learning state is also 15 seconds long.
- Can receive BPDUs
- Can send BPDUs
- Can add MAC to CAM
- Cannot receive or send data
Forwarding - Port can do anything in this state.
A switch port is allowed into the Forwarding state only if no redundant links (or loops) are detected and if the port has the best path to the Root Bridge as the Root Port or Designated Port.
STP uses three timers to make sure that a network converges properly before a bridging loop can form.Hello Time - The time interval between Configuration BPDUs sent by the Root Bridge. The Hello Time value configured in the Root Bridge switch determines the Hello Time for all nonroot switches because they just relay the Configuration BPDUs as they are received from the root. However, all switches have a locally configured Hello Time that is used to time TCN
BPDUs when they are retransmitted. The IEEE 802.1D standard specifies a default Hello Time value of 2 seconds.Forward Delay ―The time interval that a switch port spends in both the Listening and Learning states. The default value is 15 seconds.Max (maximum) Age ―The time interval that a switch stores a BPDU before discarding it. If the switch port loses contact with the BPDU’s source, the switch assumes that a topology change must have occurred after the Max Age time elapsed and so the BPDU is aged out. The default Max Age value is 20 seconds.
Tips
The timers never should be changed from the defaults without careful consideration. Then the values should be changed only on the Root Bridge switch.The default STP timer values are based on some assumptions about the size of the network. A reference model of a network having a diameter of 7 switches derives these values. The diameter is measured from the Root Bridge switch
outward, including the Root Bridge.Cisco recommends that if changes need to be made, only the network diameter value should be modified on the Root Bridge switch. When the diameter is changed, the switch calculates new values for all 3 timers automatically.
A topology change occurs when a switch either moves a port into the Forwarding state or moves a port from the Forwarding or Learning states into the Blocking state.To announce a change in the active network topology, switches send a TCN BPDU. The switch sends a TCN BPDU out its Root Port so that, ultimately, the Root Bridge receives news of the topology change. Notice that the TCN BPDU carries no data about the change but informs recipients only that a change has occurred.The switch continues sending TCN BPDUs every local Hello Time interval until it gets an acknowledgment from its upstream neighbor. As the upstream neighbors receive the TCN BPDU, they propagate it on toward the Root Bridge and send their own acknowledgments. When the Root Bridge receives the TCN BPDU, it also sends out an acknowledgment. However, the Root Bridge sets the Topology Change flag in its Configuration BPDU, which is relayed to every other bridge in the network.When non-Root bridges receives TCN BPDUs, they will shorten their bridge table aging times from the default (300 seconds) to the Forward Delay value (default 15 seconds). This condition lasts for the sum of the Forward Delay and the Max Age (default 15 + 20 seconds).Direct Topology Changes
A direct topology change is one that can be detected on a switch interface. For example, if a trunk link suddenly goes down, the switch on each end of the link can immediately detect a link failure. The absence of that link changes the bridging topology, so other switches should be notified.The total time of reconvergence time that caused by direct topology changes about two times the Forward Delay period (15 seconds), or 30 seconds total.Indirect Topology ChangesA Indirect topology change is one that can not be detected on a switch interface. The link status at each switch stays up, but something between them has failed or is filtering traffic.As a result of the indirect link failure, the topology doesn’t change immediately. Because this type of failure relies on
STP timer activity, it generally takes longer to detect and mitigate.The total time is roughly the time until the MaxAge timer expired (20 seconds), plus the time until the next Configuration BPDU was received (2 seconds), plus the time that port 1/2 spent in the Listening (15 seconds) and Learning (15 seconds) states. In other words, 52 seconds elapse if the default timer values are used.
Insignificant Topology ChangesObviously, user ports are expected to go up and down as the users reboot their machines, turn them on and off as they go to and from work, and so on. Regardless, TCN messages are sent by the switch, just as if a trunk link between switches had changed state.No actual topology change occurred because none of the switches had to change port states to reach the Root Bridge. Instead, powering off the PC caused all the switches to age out entries from their bridge or CAM tables much sooner
than normal.Given enough PCs, the switches could be in a constant state of flushing bridge tables. Also remember that when a switch doesn’t have a CAM entry for a destination, the packet must be flooded out all its ports. Flushed tables mean more unknown unicasts, which mean more broadcasts or flooded packets throughout the network.You can enable the STP PortFast feature on a port with a single attached PC. As a result, TCNs aren’t sent when the port changes state, and the port is brought right into the Forwarding state when the link comes up.
CSTThe IEEE 802.1Q standard specifies how VLANs are to be trunked between switches. It also specifies only a single instance of STP that encompasses all VLANs. This instance is referred to as the Common Spanning Tree (CST). All CST BPDUs are transmitted over trunk links using the native VLAN with untagged frames.
Having a single STP for many VLANs simplifies switch configuration and reduces switch CPU load during STP calculations. However, having only one STP instance can cause limitations, too.Redundant links between switches will be blocked with no capability for load balancing. Conditions also can occur that would cause CST to mistakenly enable forwarding on a link that does not carry a specific VLAN, whereas other links would be blocked.
PVSTCisco has a proprietary version of STP that offers more flexibility than the CST version. Per-VLAN Spanning Tree (PVST) operates a separate instance of STP for each individual VLAN. This allows the STP on each VLAN to be configured independently, offering better performance and tuning for specific conditions. Multiple spanning-trees also make load balancing possible over redundant links when the links are assigned to different VLANs. One link might forward one set of VLANs, while another redundant link might forward a different set.
Because of its proprietary nature, PVST requires the use of Cisco Inter-Switch Link (ISL) trunking encapsulation between switches. In networks where PVST and CST coexist, interoperability problems occur. Each requires a different trunking method, so BPDUs are never exchanged between STP types.
PVST+Cisco has a second proprietary version of STP that allows devices to interoperate with both PVST and CST. Per-VLAN Spanning Tree Plus (PVST+) effectively supports three groups of STP operating in the same campus network:
1. Catalyst switches running PVST
2. Catalyst switches running PVST+
3. Switches running CST over 802.1Q
To do this, PVST+ acts as a translator between groups of CST switches and groups of PVST switches. PVST+ can communicate directly with PVST by using ISL trunks. To communicate with CST, however, PVST+ exchanges BPDUs with CST as untagged frames over the native VLAN. BPDUs from other instances of STP (other VLANs) are propagated across the CST portions of the network by tunneling. PVST+ sends these BPDUs by using a unique multicast address so that the CST switches forward them on to downstream neighbors without interpreting them first. Eventually, the tunneled BPDUs reach other PVST+ switches where they are understood.
0人
|
了这篇文章 |
点击图片可刷新验证码请点击后输入验证码博客过2级,无需填写验证码
同时赞一个