A large complex switched or bridged network with multiple switches in a redundant network can cause multiple loops to occur in a switched network. As depicted in the diagram below, you can run into the following multiple-loop scenarios:
- A loop can exist within another loop.
- A broadcast storm of looping packets can quickly clog the network with unnecessary traffic and prevent packet switching.
Layer 2 LAN protocols, such as Ethernet, lack a mechanism to recognize and eliminate endlessly looping packets. Some Layer 3 protocols such as IP implement a Time To Live (TTL) mechanism that limits the number of times a packet can be retransmitted by networking devices. Since Layer 2 devices lack such a mechanism they will continue to retransmit looping traffic indefinitely, eventually bringing the network down to its knees. To counter this there must be a mechanism to prevent loops in the bridged or switched network. This loop-avoidance can be achieved through the Spanning Tree Protocol.
How Spanning Tree works:
Spanning Tree Protocol is a bridge-to-bridge protocol generally in use on most Catalyst switches is the IEEE 802.1d version.
The purpose of the STP is to maintain a loop-free network. A loop-free path is accomplished when a device recognizes a loop in the topology and blocks one or more redundant ports. As shown in the diagram below there is now only one active path from one segment to another.
Spanning Tree Protocol continuously explores the network so that a failure or addition of a link, switch, or bridge is discovered quickly. When the network topology changes, the STP reconfigures switch or bridge ports to avoid a total loss of connectivity or the creation of new loops.
Spanning Tree Protocol is enabled by default in Cisco Catalyst switches.
The Spanning Tree Protocol provides a loop-free network topology by doing the following:
How Spanning Tree works:
Spanning Tree Protocol is a bridge-to-bridge protocol generally in use on most Catalyst switches is the IEEE 802.1d version.
The purpose of the STP is to maintain a loop-free network. A loop-free path is accomplished when a device recognizes a loop in the topology and blocks one or more redundant ports. As shown in the diagram below there is now only one active path from one segment to another.
Spanning Tree Protocol is enabled by default in Cisco Catalyst switches.
The Spanning Tree Protocol provides a loop-free network topology by doing the following:
- Electing a root bridge: Only one bridge is designated as the root bridge in a given broadcast domain. All ports on the root bridge are in the forwarding state and are called designated ports. When in the forwarding state, a port can send and receive traffic. In the above diagram, SW1 is elected as the root bridge.
- For each nonroot bridge, there will be one root port: The root port is the lowest cost path from the nonroot bridge to the root bridge. Root ports are in the forwarding state and provide connectivity back to the root bridge. Spanning Tree path cost is an accumulated cost based on bandwidth. In the diagram, from SW2 the lowest cost path to the root bridge is through the 100BaseT Fast Ethernet link. In the event that the cost is the same, the deciding factor would be the lowest port number.
- On each segment, there is one designated port: The designated port is selected on the bridge that has the lowest-cost path to the root bridge. Designated ports are in the forwarding state and are responsible for forwarding traffic for the segment. In the above diagram, the designated ports for both segments are on the root bridge because the root bridge is directly connected to both segments. The 10BaseT Ethernet port on SW2 is a nondesignated port because there is only one designated port per segment. Nondesignated ports are normally in the blocking state to break the loop topology. When a port is in the blocking state, the port is not forwarding traffic. This does not mean that the port is disabled. It means that Spanning Tree is preventing it from forwarding traffic.
Bridge IDs and Port States:
Switches (bridges) running the Spanning Tree Algorithm exchange configuration messages with other switches (bridges) at regular intervals using a multicast frame called the Bridge Protocol Data Unit BPDU. By default the BPDU is sent every two seconds. One of the pieces of information included in the BPDU is the bridge ID.
Spanning Tree calls for each bridge to be assigned a unique identifier (bridge ID). Typically, the bridge ID is made up of a priority (two bytes) plus the bridge MAC address (six bytes). The IEEE 802.1d default priority is 32768, the midrange value. The root bridge is the bridge with the lowest bridge ID.
Sidenote: Each switch selects one of its MAC addresses for use in the Spanning Tree bridge ID. A switch with multiple VLANs uses an increment from this base MAC address for the Spanning Tree bridge ID for each VLAN.
In our diagram, because both switches are using the same default priority, the one with the lower MAC address will be the root bridge. SW1 is the root bridge with a bridge ID of 8000.0c00.1111.1111 . The hexadecimal value 8000 is the bridge priority (decimal 32768). The 0c00.1111.1111 value is the device's MAC address.
A word of caution. Spanning Tree root selection is automatic. Although this is convenient it might not always be ideal since it could cause your traffic to flow in a suboptimal path. It is always a good practice to set the priority of the switch or bridge that needs to be designated as the root. In order to have a bridge become the root you would want to lower the priority. The golden rule in STP is: lower the priority number, better the status quo. And that applies to all numbers. Lower the number, higher the importance.
After the BPDUs have been exchanged, the port states on the switches would be in the states shown in the below diagram.
Spanning Tree calls for each bridge to be assigned a unique identifier (bridge ID). Typically, the bridge ID is made up of a priority (two bytes) plus the bridge MAC address (six bytes). The IEEE 802.1d default priority is 32768, the midrange value. The root bridge is the bridge with the lowest bridge ID.
Sidenote: Each switch selects one of its MAC addresses for use in the Spanning Tree bridge ID. A switch with multiple VLANs uses an increment from this base MAC address for the Spanning Tree bridge ID for each VLAN.
In our diagram, because both switches are using the same default priority, the one with the lower MAC address will be the root bridge. SW1 is the root bridge with a bridge ID of 8000.0c00.1111.1111 . The hexadecimal value 8000 is the bridge priority (decimal 32768). The 0c00.1111.1111 value is the device's MAC address.
A word of caution. Spanning Tree root selection is automatic. Although this is convenient it might not always be ideal since it could cause your traffic to flow in a suboptimal path. It is always a good practice to set the priority of the switch or bridge that needs to be designated as the root. In order to have a bridge become the root you would want to lower the priority. The golden rule in STP is: lower the priority number, better the status quo. And that applies to all numbers. Lower the number, higher the importance.
After the BPDUs have been exchanged, the port states on the switches would be in the states shown in the below diagram.
- The ports on SW1, the root bridge, are designated ports (forwarding).
- The Fast Ethernet port on SW2 is the root port (forwarding). It has a lower-cost path to the root bridge than the Ethernet port.
- The Ethernet port on SW2 is the nondesignated port (blocking). There is only one designated port per segment.
Spanning Tree Path Cost:
Based on the following diagram of the switched network setup, try to determine the following:
- What is the root bridge ?
- What are the designated, nondesignated, and root ports ?
- What are the forwarding and blocking ports ?
Using the Spanning Tree Protocol, we can determine the following for the switched network:
- Root bridge --- Switch SW3 because it has the lowest bridge ID (priority and MAC address).
- Root port --- Port 0s of switches SW1 and SW2 because they are the path to the root.
- Designated port --- Port 0 of switch SW3. All ports on the root are designated ports. Port 1 of switch SW1 is a designated port. Because both SW1 and SW2 have the same cost to the bridge, the designated port is selected to be on switch SW1 since it has a lower bridge ID than switch SW2.
- Blocking --- Port 1 on switch SW2. The nondesignated port on the segment.
- Forwarding --- All designated ports and root ports are in the forwarding state.
Spanning Tree States:
There are four Spanning Tree states:
There are four Spanning Tree states:
- Blocking
- Listening
- Learning
- Forwarding
Spanning Tree transitions through these states to maintain a loop-free topology.
During normal operations, a port is in either the forwarding or blocking state. Forwarding ports provide the lowest-cost path to the root bridge. Two transitional states occur when a device recognizes a change in the network topology. During a topology change, a port temporarily implements the listening and learning states.
All ports start in the blocking state to prevent bridge loops. The port stays in a blocked state if the Spanning Tree determines that there is another path to the root bridge that has a better cost. Blocking ports can still receive BPDUs.
Ports transition from the blocked state to the listening state. When the port is in the transitional listening state, it can check for BPDUs. This state is really used to indicate that the port is getting ready to transmit but would like to listen for just a little longer to make sure it does not create a loop.
When the port is in learning state, it can populate its MAC address table with MAC addresses heard on its ports but it does not forward frames.
In the forwarding state, the port can send and receive data.
The normal time it takes for a port to transition from the blocking state to the forwarding state is 50 seconds. Spanning Tree timers can be tuned to adjust the timing. Normally, these timers should be set to the default value. The default values are put in place to give the network enough time to gather all the correct information about the network topology. The time it takes for a port to transition from the listening state to the learning state or from the learning state to the forwarding state is called the forwarding delay. Spanning Tree timers are consistent throughout the bridge/switch topology, and their values are set by the root bridge. The table below lists the default values for Spanning Tree timers.
Spanning Tree Recalculation:
When there is a topology change due to a bridge or link failure, the Spanning Tree Protocol readjusts the network topology to ensure connectivity by placing blocked ports to the forwarding states.
In the below diagram, if switch SW1 (the root bridge) fails, switch SW2 will detect the missing BPDU from the root bridge. One of the Spanning Tree timers is called the Max Age timer. When the Max Age timer expires and a new BPDU has not been received from the neighbor, a new Spanning Tree recalculation is initiated. Port 1 moves to listening and then transitions to learning and finally to forwarding.
After the network is converged, switch SW2 becomes the root bridge. It forwards traffic between the two segments when its ports transition to the forwarding state and become the designated ports.
How Devices Stay Informed About the Topology:
Convergence is a necessity for normal network operations in a bridged/switched environment. For a switched or bridged network, a key issue is the amount of time required for convergence when network topology changes. Convergence in the Spanning Tree Protocol means a state where all the switches and bridge ports have transitioned to either the forwarding or blocking state.
Fast convergence is a desirable network feature because it reduces the period of time that bridges and switches have ports in transitional states and are not sending traffic. Although the term fast is ambiguous and relative at best, what is being stated here is that a topology change in the bridged/switched network will require time to reestablish full connectivity. It is important to remember this when designing bridged/switched networks.
During a topology change, affected devices will not be able to fully communicate until Spanning Tree has converged.
Ports transition from the blocked state to the listening state. When the port is in the transitional listening state, it can check for BPDUs. This state is really used to indicate that the port is getting ready to transmit but would like to listen for just a little longer to make sure it does not create a loop.
When the port is in learning state, it can populate its MAC address table with MAC addresses heard on its ports but it does not forward frames.
In the forwarding state, the port can send and receive data.
The normal time it takes for a port to transition from the blocking state to the forwarding state is 50 seconds. Spanning Tree timers can be tuned to adjust the timing. Normally, these timers should be set to the default value. The default values are put in place to give the network enough time to gather all the correct information about the network topology. The time it takes for a port to transition from the listening state to the learning state or from the learning state to the forwarding state is called the forwarding delay. Spanning Tree timers are consistent throughout the bridge/switch topology, and their values are set by the root bridge. The table below lists the default values for Spanning Tree timers.
Spanning Tree Recalculation:
When there is a topology change due to a bridge or link failure, the Spanning Tree Protocol readjusts the network topology to ensure connectivity by placing blocked ports to the forwarding states.
In the below diagram, if switch SW1 (the root bridge) fails, switch SW2 will detect the missing BPDU from the root bridge. One of the Spanning Tree timers is called the Max Age timer. When the Max Age timer expires and a new BPDU has not been received from the neighbor, a new Spanning Tree recalculation is initiated. Port 1 moves to listening and then transitions to learning and finally to forwarding.
After the network is converged, switch SW2 becomes the root bridge. It forwards traffic between the two segments when its ports transition to the forwarding state and become the designated ports.
How Devices Stay Informed About the Topology:
Convergence is a necessity for normal network operations in a bridged/switched environment. For a switched or bridged network, a key issue is the amount of time required for convergence when network topology changes. Convergence in the Spanning Tree Protocol means a state where all the switches and bridge ports have transitioned to either the forwarding or blocking state.
Fast convergence is a desirable network feature because it reduces the period of time that bridges and switches have ports in transitional states and are not sending traffic. Although the term fast is ambiguous and relative at best, what is being stated here is that a topology change in the bridged/switched network will require time to reestablish full connectivity. It is important to remember this when designing bridged/switched networks.
During a topology change, affected devices will not be able to fully communicate until Spanning Tree has converged.
No comments:
Post a Comment