Spanning Tree Protocol – Interview Key Points –
Spanning Tree Protocol (STP) is an Ethernet protocol that works on bridges and switches. It was invented by Radia Joy Pearlman at Digital Equipment Corporation in 1985. 802.1D was the first IEEE standard for STP and was published in 1990.
Ever-since we made networks, we often build them with redundant paths. Redundancy in network paths can protect against failure of a link, but redundancy results in loops. STP searches for any loops on the network and avoids them. Loops are dangerous for networks, as the data traveling can end up circling in the loop and bringing the network to near halt. Broadcast and Multicast are the real culprits that can end up circling the loop, such a situation is known as Broadcast Storm or Broadcast radiation.
STP if enabled in this network, all switches will participate in the Root Bridge election process. Once a root bridge is appointed, one of the switches will block one of its link participating in the loop. This cuts the loop and we no more have Broadcast Storms in our network. If an active link fails, the blocking link is activated and thus we get redundancy against link failure in our topology. Please note that STP doesn’t helps in bundling and adding of link bandwidth to increase throughput. It is rather used to detect accidental loops and provide redundancy.
Following are some important points that one should remember about Spanning Tree Protocol with respect to an interview on the topic. I would be covering the most fundamental concepts of Spanning Tree Protocol in here. We would be discussing RSTP or MST in a different blog:
Versions of Spanning Tree Protocol –
- There are three versions of Spanning Tree Protocol. They are:
- IEEE 802.1d Spanning Tree Protocol
- IEEE 802.1w Rapid Spanning Tree Protocol
- IEEE 802.1s Multiple Spanning Tree Protocol
STP Bridge ID:
All switches running Spanning Tree Protocol, needs to have an identity known as Bridge ID or BID. It’s an 8-byte value, that split into 2 pieces. The first 2-bytes are reserved for Priority Value and the remaining 6-bytes are meant for the MAC Address.
The default STP priority value is 32768 on Cisco switches, where as they could range from 0 to 61440. One can simply configure the priority value in the increments of 4096. The lower the value is, higher the chances of a switch being elected as the root bridge. If the priority value of 2 or more switches is the same, then the switch having the lowest mac-address as elected as the root bridge.
BPDU stands for Bridge Protocol Data Unit. Spanning Tree Protocol uses BPDU to exchange information such as BID, originating switch port, port priority, port cost, etc. These are layer2 multicast packets and the MAC address reserved for STP BPDU is 01:80:c2:00:00:00. There are 2 types of BPDU, Configuration BPDU and Topology Change Notification (TCN) BPDU.
Configuration BPDU’s are created at the root bridge and sent out of Designated Forwarding Ports every 2 seconds. Root bridge sends these BPDU in the downstream direction to non-root bridges periodically.
Topology Change Notification (TCN) BPDU is created by non-root bridge and are sent in upstream direction to the root bridge informing about topology changes if it occurs.
STP Root Bridge:
A switch participating in a loop, with Spanning Tree Protocol configuration such that it’s bridge ID is lowest in the loop, is appointed as the root bridge. Root bridge doesn’t block any of its interface. Switch with the highest bridge ID in the loop will block one of its interface. Root bridges won’t have any Blocking Port or Root Port. You may only find Designated Ports on root bridges.
STP Root Port:
Root ports are the ports available on non-root bridges in a topology. On non-root switches that are participating in a loop, the root port has the least cost as compared to other ports, of the switch. Root port always receives BPDU’s.
It is a non-root port, which is allowed to forward traffic in the topology. It’s usually the port not participating in the loop, connected to the end-device or a port on a root bridge. You may even find this port on non-root bridge, as well participating in a loop such that the cost to root bridge isn’t the lowest, or it isn’t even a blocking port. BPDU’s are always sent out of this port.
STP Port States:
Spanning Tree Protocol enabled switches have their ports in one of the following 5 states.
A port on a non-root switch with highest BID, with highest cost to reach the root bridge, would be a blocking port. Such ports can only receive BPDU’s but blocks all other types of traffic. These BPDU’s should be received periodically every 2 seconds. If the BPDU’s don’t show up for 20 seconds, the port transitions to listening state.
Before a port transitions to designated or root forwarding, it has to go through listening state. It is in this state, STP switch decides, if the port should transition to forwarding state, by processing BPDU’s. The port stays in listening state for 15 seconds. In this state, the listening port will not forward any frames.
In this state, the switch continues to receive BPDU’s and update MAC Addresses learnt on the port to MAC Address Table. Switches continues to drop frames on ports in learning state. The port stays for an additional 15 seconds in learning state, after transitioning from listening state.
This state is finally when a port starts forwarding frames. After a blocking port stops receiving BPDU’s for 20 seconds, it transitions to listening and then learning states and then after a total of 50 seconds to forwarding state. In case, an end device gets connected to an available port, the port transitions through listening and learning to forwarding state after a total of 30 seconds. A forwarding port may be a designated or a root port. If the forwarding port is a root port, it receives BPDU, whereas a designated forwarding port sends out BPDU’s.
A network admin manually disables a port. Such port neither participates in STP operations nor they can forward frames. An unused switch-port is usually set to disabled state.
Spanning Tree Protocol Timers:
Spanning Tree Protocol have 3 timers, they are:
- Forward Delay
- Max Age
Default hello time is 2 seconds. It’s the time difference in-between BPDU’s. One can adjust STP hello timer ranging from 1 seconds to 10 seconds.
Forward Delay timer:
The time interval that a port spends in listening and learning state is known as forward delay timer. The default forward delay timer is set to 15 seconds, one can set this between 4 seconds to 30 seconds.
Max Age timer:
It’s the time frame, that a blocking port holds for, if it isn’t receiving BPDU’s before transitioning to listening state. Default value is 20 seconds. One can change this value ranging from 6 seconds to 40 seconds.
I tried to accumulate some important key concepts of Spanning Tree Protocol in this blog. I will be back with RSTP and MST in another blog. Meanwhile, keep studying, keep growing.
Call the Trainer and Book your free demo Class for JAVA now!!!
© Copyright 2021 | Sevenmentor Pvt Ltd.