The Spanning Tree Protocol (STP) is a network protocol that ensures a loop-free topology for any bridged Ethernet local area network. The basic function of STP is to prevent bridge loops and ensuing broadcast radiation. Spanning tree also allows a network design to include spare (redundant) links to provide automatic backup paths if an active link fails, without the danger of bridge loops, or the need for manual enabling/disabling of these backup links. Spanning Tree Protocol (STP) is standardized as IEEE 802.1D. As the name suggests, it creates a spanning tree within a mesh network of connected layer-2 bridges (typically Ethernet switches), and disables those links that are not part of the spanning tree, leaving a single active path between any two network nodes.
The differences between Root Port and Designated Port are listed below.
Root Port is a single selected port on "a Switch" with least Path Cost to the Root Bridge. The Designated Port is the port that has the lowest Path Cost on a particular Local Area Network (LAN) segment. The Root Port is the port on the Bridge (Switch) with the least Path Cost from the switch to the Root Bridge. A Designated Port is the port on a Local Area Network (LAN) segment with the least cost to the root bridge. There can be ONLY one Root Port on a Bridge (Switch). There may be multiple Designated Ports on a Bridge (Switch). All the ports on a Root Bridge (Switch) are Designated Ports and there is no Root Port on a Root Bridge (Switch). A Root Port can NEVER be a Designated Port. If one end of a Local Area Network (LAN) segment is a Dedicated Port, other end is called as Non Designated Port (marked as NDP), if it is NOT a Root Port. Non Designated Port will be always in Blocking State, to avoid Layer 2 Switching loops.
In our last article we learn about basic functions of switching. We mentioned that one of the functions of a switch was Layer 2 Loop removal. The Spanning Tree Protocol (STP) carries out this function. STP is a critical feature; without it many switched networks would completely stop to function. Either accidentally or intentionally in the process of creating a redundant network, the problem arises when we create a looped switched path. A loop can be defined as two or more switches that are interconnected by two or more physical links. Switching loops create three major problems:
y y y
Broadcast stormsSwitches must flood broadcasts, so a looped topology will create multiple copies of a single broadcast and perpetually cycle them through the loop. MAC table instabilityLoops make it appear that a single MAC address is reachable on multiple ports of a switch, and the switch is constantly updating the MAC table. Duplicate frames Because there are multiple paths to a single MAC, it is possible that a frame could be duplicated in order to be flooded out all paths to a single destination MAC.
All these problems are serious and will bring a network to an effective standstill unless prevented
Root Port
After the root switch is elected, every other switch in the network needs to choose a single port on itself that it will use to reach the root. This port is called the root port. The root port is always the link directly connected to the root bridge, or the shortest path to the root bridge. If more than one link connects to the root bridge, then a port cost is determined by checking the bandwidth of each link. The lowest-cost port becomes the root port. If multiple links have the same cost, the bridge with the lower advertising bridge ID is used. Since multiple links can be from the same device, the lowest port number will be used.
Root Bridge
Switch with the lowest switch ID is chosen as root. The switch ID is made up of two components:
y y
The switch's priority, which defaults to 32,768 on Cisco switches (two bytes in length) The switch's MAC address (six bytes in length)
All other decisions in the networksuch as which port is to be blocked and which port is to be put in forwarding modeare made from the perspective of this root bridge
BPDUs
Which are sent out as multicast information that only other layer-2 devices are listening to. BPDUs are used to share information, and these are sent out as multicasts every two seconds. The BPDU contains the bridge's or switch's ID, made up of a priority value and the MAC address. BPDUs are used for the election process.
Path Costs
Path costs are calculated from the root switch. A path cost is basically the accumulated port costs from the root switch to other switches in the topology. When the root advertises BPDUs out its interfaces, the default path cost value in the BPDU frame is 0. When a connected switch receives this BPDU, it increments the path cost by the cost of its local incoming port. If the port was a Fast Ethernet port, then the path cost would be figured like this: 0 (the root's path cost) + 19 (the switch's port cost) = 19. This switch, when it advertises BPDUs to switches behind it, will include the updated path cost. As the BPDUs propagate further and further from the root switch, the accumulated path cost values become higher and higher.
Connection Type 10Gb 1Gb New Cost Value 2 4 Old Cost Value 1 1
100Mb 10Mb
19 100
10 100
Remember that path costs are incremented as a BPDU comes into a port, not when a BPDU is advertised out of a port. Designated Port A designated port is one that has been determined as having the best (lowest) cost. A designated port will be marked as a forwarding port. Each (LAN) segment also has a single port that is uses to reach the root. This port is called a designated port Forwarding port A forwarding port forwards frames. Blocked port A blocked port is the port that, in order to prevent loops, will not forward frames. However, a blocked port will always listen to frames Nondesignated port A nondesignated port is one with a higher cost than the designated port. Nondesignated ports are put in blocking modethey are not forwarding ports.
Port States
Blocking
Election of a root switch (for instance, when you turn on all the switches in a network) When a switch receives a BPDU on a port that indicates a better path to the root switch than the port the switch is currently using to reach the root If a port is not a root port or a designated port.
A port in a blocked state will remain there for 20 seconds by default during this state; the port is only listening to and processing BPDUs on its interfaces. Any other frames that the switch receives on a blocked port are dropped.
Listening
the port is still listening for BPDUs and double-checking the layer-2 topology. Again, the only traffic that is being processed in this state consists of BPDUs; all other traffic is dropped. default for this value is 15 seconds.
Learning
Port is still listening for and processing BPDUs on the port; however, unlike while in the listening state, the port begins to process user frames. When processing user frames, the switch is
examining the source addresses in the frames and updating its CAM table, but the switch is still not forwarding these frames out destination ports. Defaults to 15 seconds
Forwarding
the port will process BPDUs, update its CAM table with frames that it receives, and forward user traffic through the port.
Disabled
STP convergence has occurred when all root and designated ports are in a forwarding state and all other ports are in a blocking state.
Per-VLAN STP
STP doesn't guarantee an optimized loop-free network. PVST supports one instance of STP per VLAN.
With RSTP, there is still a root switch and there are still root and designated ports, performing the same roles as those in 802.1d. However, RSTP adds two additional port types: alternate ports and backup ports. These two ports are similar to the ports in a blocking state in 802.1d.
An alternate port is a port that has an alternative path or paths to the root but is currently in a
discarding state.
A backup port is a port on a segment that could be used to reach the root switch, but an active
port is already designated for the segment. The best way to look at this is that an alternate port is a secondary, unused root port, and a backup port is a secondary, unused designated port.
RSTP BPDUs
With 802.1w, if a BPDU is not received in three expected hello periods (6 seconds), STP information can be aged out instantly and the switch considers that its neighbor is lost and actions should be taken. This is different from 802.1d, where the switch had to miss the BPDUs from the roothere, if the switch misses three consecutive hellos from a neighbor, actions are immediately taken.