STP(Spanning Tree Protocol)
Switching Loops
A Layer-2 switch belongs to only one broadcast domain, and will forward both broadcasts and multicasts out every port but the originating port.
When a switching loop is introduced into the network, a destructive broadcast storm will develop within seconds. A storm occurs when broadcasts are endlessly forwarded through the loop. Eventually, the storm will choke off all other network traffic.
If HostA sends out a broadcast, SwitchD will forward the broadcast out all ports in the same VLAN, including the trunk ports connecting to SwitchB and SwitchE. In turn, those two switches will forward that broadcast out all ports, including the trunks to the neighboring SwitchA and SwitchC.
The broadcast will loop around the switches infinitely. In fact, there will be two separate broadcast storms cycling in opposite directions through the switching loop. Only powering off the switches or physically removing the loop will stop the storm.
Spanning Tree Protocol (STP)
Spanning Tree Protocol (STP) was developed to prevent the broadcast storms caused by switching loops. STP was originally defined in IEEE 802.1D.
Switches running STP will build a map or topology of the entire switching network. STP will identify if there are any loops, and then disable or block as many ports as necessary to eliminate all loops in the topology. A blocked port can be reactivated if another port goes down. This allows STP to maintain redundancy and fault-tolerance.
STP switches exchange Bridge Protocol Data Units (BPDU’s) to build the topology database. BPDU’s are forwarded out all ports every two seconds, to a dedicated MAC multicast address of 0180.c200.0000.
Building the STP topology is a multistep convergence process:
• A Root Bridge is elected
• Root ports are identified
• Designated ports are identified
• Ports are placed in a blocking state as required, to eliminate loops
The Root Bridge serves as the central reference point for the STP topology. STP was originally developed when Layer-2 bridges were still prevalent, and thus the term Root Bridge is still used for nostalgic reasons. It is also acceptable to use the term Root Switch, though this is less common.
Electing an STP Root Bridge
The first step in the STP convergence process is electing a Root Bridge, which is the central reference point for the STP topology. As a best practice, the Root Bridge should be the most centralized switch in the STP topology.
Bridge ID choose base on Bridge priority,MAC address
The default priority is 32,768, and the lowest priority wins. If there is a tie in priority, the lowest MAC address is used as the tie-breaker.
Switches exchange BPDU’s to perform the election process, and the lowest Bridge ID determines the Root Bridge:
• SwitchB, SwitchC, and SwitchE have the default priority of 32,768.
• SwitchA and SwitchD are tied with a lower priority of 100.
• SwitchA has the lowest MAC address, and will be elected the Root Bridge.
it receives a BPDU from a switch with a lower Bridge ID. This is referred to as a superior BPDU. The election process is continuous – if a new switch with the lowest Bridge ID is added to the topology, it will be elected as the Root Bridge.
Identifying Root Ports
The second step in the STP convergence process is to identify root ports. The root port of each switch has the lowest root path cost to get to the Root Bridge. Each switch can only have one root port. The Root Bridge cannot have a root port, as the purpose of a root port is to point to the Root Bridge. Path cost is a cumulative cost to the Root Bridge, based on the bandwidth of the links. The higher the bandwidth, the lower the path cost:
A lower cost is preferred. Consider the following example:
SwitchB has two paths to the Root Bridge:
• A direct connection to SwitchA, with a path cost of 4.
• Another path through SwitchD, with a path cost of 16.
The lowest cumulative path cost is considered superior, thus the port directly connecting to SwitchA will become the root port. A BPDU advertising a higher path cost is often referred to as an inferior BPDU.
Identifying Designated Ports
The third step in the STP convergence process is to identify designated ports. A single designated port is identified for each network segment. This port is responsible for forwarding BPDUs and frames to that segment. If two ports are eligible to become the designated port, then there is a loop. One of the ports will be placed in a blocking state to eliminate the loop. Similar to a root port, the designated port is determined by the lowest cumulative path cost leading the Root Bridge. A designated port will never be placed in a blocking state, unless there is a change to the switching topology and a more preferred designated port is elected
Note: A port can never be both a designated port and a root port
Ports on the Root Bridge are never placed in a blocking state. Thus, the two ports off of SwitchA will automatically become designated ports. Remember, every network segment must have one designated port, regardless if a root port already exists on that segment. Thus, the network segments between SwitchB and SwitchD, and between SwitchC and SwitchE, both require a designated port. The ports on SwitchD and Switch E have already been identified as root ports, thus the ports on Switch B and C will become the designated ports.
Because two ports on this segment are eligible to become the designated port, STP recognizes that a loop exists. One of the ports must be elected as the designated port, and the other must be placed in a blocking state. Normally, whichever switch has the lowest cumulative path cost will have its port become designated. The switch with the highest path cost will have its port blocked. In the above example, there is a tie in cumulative path cost. Both SwitchD and SwitchE have a path cost of 12 to reach the Root Bridge on that segment. The lowest Bridge ID is used as the tiebreaker. SwitchD has a priority of 100, and SwitchE has the default priority of 32,768. Thus, the port on SwitchD will become the designated port. The port on SwitchE will be placed in a blocking state. As with electing the Root Bridge, if there is a tie in priority, the lowest MAC address is used as the tie breaker. Remember: Any port not elected as a root or designated port will be placed in a blocking state.
Versions of STP
There are three flavors of the original 802.1D version of STP:
• Common Spanning Tree (CST)
• Per-VLAN Spanning Tree (PVST)
• Per-VLAN Spanning Tree Plus (PVST+)
CST utilizes a single STP instance for all VLANs, and is sometimes referred to as mono spanning tree. All CST BPDU’s are sent over the native VLAN on a trunk port, and thus are untagged.
PVST employs a separate STP instance for each VLAN, improving flexibility and performance. PVST requires trunk ports to use ISL encapsulation. PVST and CST are not compatible.
The enhanced PVST+ is compatible with both CST and PVST, and supports both ISL and 802.1Q encapsulation. PVST+ is the default mode on many Cisco platforms. STP has continued to evolve over time. Modern extensions of STP will be covered later in this guide:
• Rapid Spanning Tree Protocol (RSTP)
• Multiple Spanning Tree (MST)
STP Port States
As STP converges the switching topology, a switch port will progress through a series of states:
• Blocking
• Listening
• Learning
• Forwarding
STP Timers
Switches running STP exchange BPDUs to build and converge the topology database. There are three timers that are crucial to the STP process:
• Hello timer
• Forward delay timer
• Max age timer
The hello timer determines how often switches send BPDUs. By default, BPDUs are sent every 2 seconds.
The forward delay timer determines how long a port must spend in both a learning and listening state: • Introducing this delay period ensures that STP will have enough time to detect and eliminate loops. • By default, the forward delay is 15 seconds.
• Because a port must transition through two forward delays, the total delay time is 30 seconds.
The max age timer indicates how long a switch will retain BPDU information from a neighbor switch, before discarding it:
• Remember that BPDUs are sent every two seconds.
• If a switch fails to receive a BPDU from a neighboring switch for the max age period, it will assume there was a change in the switching topology.
• STP will then purge that neighbor’s BPDU information.
• By default, the max age timer is 20 seconds.
Timers must be changed on the Root Bridge. The Root Bridge will propagate the new timer values to all switches using BPDUs
STP Topology Changes
•Configuration BPDUs
• Topology Change Notification (TCN) BPDUs
Switching Loops
A Layer-2 switch belongs to only one broadcast domain, and will forward both broadcasts and multicasts out every port but the originating port.
When a switching loop is introduced into the network, a destructive broadcast storm will develop within seconds. A storm occurs when broadcasts are endlessly forwarded through the loop. Eventually, the storm will choke off all other network traffic.
If HostA sends out a broadcast, SwitchD will forward the broadcast out all ports in the same VLAN, including the trunk ports connecting to SwitchB and SwitchE. In turn, those two switches will forward that broadcast out all ports, including the trunks to the neighboring SwitchA and SwitchC.
The broadcast will loop around the switches infinitely. In fact, there will be two separate broadcast storms cycling in opposite directions through the switching loop. Only powering off the switches or physically removing the loop will stop the storm.
Spanning Tree Protocol (STP)
Spanning Tree Protocol (STP) was developed to prevent the broadcast storms caused by switching loops. STP was originally defined in IEEE 802.1D.
Switches running STP will build a map or topology of the entire switching network. STP will identify if there are any loops, and then disable or block as many ports as necessary to eliminate all loops in the topology. A blocked port can be reactivated if another port goes down. This allows STP to maintain redundancy and fault-tolerance.
STP switches exchange Bridge Protocol Data Units (BPDU’s) to build the topology database. BPDU’s are forwarded out all ports every two seconds, to a dedicated MAC multicast address of 0180.c200.0000.
Building the STP topology is a multistep convergence process:
• A Root Bridge is elected
• Root ports are identified
• Designated ports are identified
• Ports are placed in a blocking state as required, to eliminate loops
The Root Bridge serves as the central reference point for the STP topology. STP was originally developed when Layer-2 bridges were still prevalent, and thus the term Root Bridge is still used for nostalgic reasons. It is also acceptable to use the term Root Switch, though this is less common.
Electing an STP Root Bridge
The first step in the STP convergence process is electing a Root Bridge, which is the central reference point for the STP topology. As a best practice, the Root Bridge should be the most centralized switch in the STP topology.
Bridge ID choose base on Bridge priority,MAC address
The default priority is 32,768, and the lowest priority wins. If there is a tie in priority, the lowest MAC address is used as the tie-breaker.
Switches exchange BPDU’s to perform the election process, and the lowest Bridge ID determines the Root Bridge:
• SwitchB, SwitchC, and SwitchE have the default priority of 32,768.
• SwitchA and SwitchD are tied with a lower priority of 100.
• SwitchA has the lowest MAC address, and will be elected the Root Bridge.
it receives a BPDU from a switch with a lower Bridge ID. This is referred to as a superior BPDU. The election process is continuous – if a new switch with the lowest Bridge ID is added to the topology, it will be elected as the Root Bridge.
Identifying Root Ports
The second step in the STP convergence process is to identify root ports. The root port of each switch has the lowest root path cost to get to the Root Bridge. Each switch can only have one root port. The Root Bridge cannot have a root port, as the purpose of a root port is to point to the Root Bridge. Path cost is a cumulative cost to the Root Bridge, based on the bandwidth of the links. The higher the bandwidth, the lower the path cost:
A lower cost is preferred. Consider the following example:
SwitchB has two paths to the Root Bridge:
• A direct connection to SwitchA, with a path cost of 4.
• Another path through SwitchD, with a path cost of 16.
The lowest cumulative path cost is considered superior, thus the port directly connecting to SwitchA will become the root port. A BPDU advertising a higher path cost is often referred to as an inferior BPDU.
Identifying Designated Ports
The third step in the STP convergence process is to identify designated ports. A single designated port is identified for each network segment. This port is responsible for forwarding BPDUs and frames to that segment. If two ports are eligible to become the designated port, then there is a loop. One of the ports will be placed in a blocking state to eliminate the loop. Similar to a root port, the designated port is determined by the lowest cumulative path cost leading the Root Bridge. A designated port will never be placed in a blocking state, unless there is a change to the switching topology and a more preferred designated port is elected
Note: A port can never be both a designated port and a root port
Ports on the Root Bridge are never placed in a blocking state. Thus, the two ports off of SwitchA will automatically become designated ports. Remember, every network segment must have one designated port, regardless if a root port already exists on that segment. Thus, the network segments between SwitchB and SwitchD, and between SwitchC and SwitchE, both require a designated port. The ports on SwitchD and Switch E have already been identified as root ports, thus the ports on Switch B and C will become the designated ports.
Because two ports on this segment are eligible to become the designated port, STP recognizes that a loop exists. One of the ports must be elected as the designated port, and the other must be placed in a blocking state. Normally, whichever switch has the lowest cumulative path cost will have its port become designated. The switch with the highest path cost will have its port blocked. In the above example, there is a tie in cumulative path cost. Both SwitchD and SwitchE have a path cost of 12 to reach the Root Bridge on that segment. The lowest Bridge ID is used as the tiebreaker. SwitchD has a priority of 100, and SwitchE has the default priority of 32,768. Thus, the port on SwitchD will become the designated port. The port on SwitchE will be placed in a blocking state. As with electing the Root Bridge, if there is a tie in priority, the lowest MAC address is used as the tie breaker. Remember: Any port not elected as a root or designated port will be placed in a blocking state.
Versions of STP
There are three flavors of the original 802.1D version of STP:
• Common Spanning Tree (CST)
• Per-VLAN Spanning Tree (PVST)
• Per-VLAN Spanning Tree Plus (PVST+)
CST utilizes a single STP instance for all VLANs, and is sometimes referred to as mono spanning tree. All CST BPDU’s are sent over the native VLAN on a trunk port, and thus are untagged.
PVST employs a separate STP instance for each VLAN, improving flexibility and performance. PVST requires trunk ports to use ISL encapsulation. PVST and CST are not compatible.
The enhanced PVST+ is compatible with both CST and PVST, and supports both ISL and 802.1Q encapsulation. PVST+ is the default mode on many Cisco platforms. STP has continued to evolve over time. Modern extensions of STP will be covered later in this guide:
• Rapid Spanning Tree Protocol (RSTP)
• Multiple Spanning Tree (MST)
STP Port States
As STP converges the switching topology, a switch port will progress through a series of states:
• Blocking
• Listening
• Learning
• Forwarding
STP Timers
Switches running STP exchange BPDUs to build and converge the topology database. There are three timers that are crucial to the STP process:
• Hello timer
• Forward delay timer
• Max age timer
The hello timer determines how often switches send BPDUs. By default, BPDUs are sent every 2 seconds.
The forward delay timer determines how long a port must spend in both a learning and listening state: • Introducing this delay period ensures that STP will have enough time to detect and eliminate loops. • By default, the forward delay is 15 seconds.
• Because a port must transition through two forward delays, the total delay time is 30 seconds.
The max age timer indicates how long a switch will retain BPDU information from a neighbor switch, before discarding it:
• Remember that BPDUs are sent every two seconds.
• If a switch fails to receive a BPDU from a neighboring switch for the max age period, it will assume there was a change in the switching topology.
• STP will then purge that neighbor’s BPDU information.
• By default, the max age timer is 20 seconds.
Timers must be changed on the Root Bridge. The Root Bridge will propagate the new timer values to all switches using BPDUs
STP Topology Changes
•Configuration BPDUs
• Topology Change Notification (TCN) BPDUs
thanks
ReplyDelete