Spanning tree protocol is a mechanism to prevent loops among switches. There could be a loop in one switch as well, but we are here considering multiple switches and preventing them to create a loop.
Loop is the condition where your switch sends a packet from one interface and somehow the same packets get back to same switch on difference interface.
This is layer-2 switch and are comparatively dangerous than Layer-3 loops.
This loop ends up in a broadcast storm. The simplest solution of preventing and deleting loop is turn off one of your switch and boot it again the loop will probably end. But what if this happens multiple times in your network you cannot just sit next to switch and keep it reloading.
Cisco with conjunction other networking organization found a method to prevent this loop and it is called Spanning Tree Protocol.
SPT looks and talks to switches for loop condition if it sees loop it takes countermeasures to stop the loop.
This protocol by default is enabled on all Cisco switches and at CCNA level you are only required to understand its functions and working.
The following illustration is showing the normal loop-free network architecture.
The following illustration shows the loop condition in a single switch.
This is the cabling issue where someone accidently plugged the cables two ends into the same switch, it is not necessary to create this type of loop on physical switch, there could be someone maliciously plugs the cables end into the wall jack where there are two ports. This loop is bi-directional as shown in following illustration and could be eliminated by ejecting one end of cable.
The following illustration shows the common loop.
Here someone had idea to make a redundant uplinks so if one goes down the other is flowing the traffic but this is creating a loop unless we use ether-channel ( a technique to maximize the speed of single port with two or more ports). Assuming that we just plugged-in another cable without any configuration, this created a loop.
The following illustration is showing the typical condition of loop where you have tons of switches in organization and you mistakenly create the following architecture.
This is the loop condition and the simplest way to get rid of loop we can just unplug any of the cable.
There you go we unplugged the cable and loop has gone but we did this manually and it is not possible in giant network architecture.
Here we use the STP which automatically identifies and prevent the loop by blocking any port and this ends loop.
This blocked interface is called null interface and every packet that comes at this interface is wasted.
This is not all for instance your network cable damages and the loop gets end then STP unblocks the interface and packets are passed.
Notice that in case of failure STP automatically unblocked the interface and everything is working properly.
How beautiful is this we got redundancy without any configuration. But this redundancy is not 100 percent availability because this protocol works on timer and takes at least 30 seconds to shutdown and turn back on the interfaces.
STP is not Cisco property it is contributed struggle of multiple networking organization and this protocol has been standardize by IEEE and have the standard code 802.1d.
Spanning Tree works a bit differently on Cisco switches than any other switches, we can tweak the default configuration and make this work faster as well.
Spanning Tree Protocol Working
The question is how does the spanning tree picks the interface to block, as in our example above it blocked the port, however it could have blocked any port why did it picked the exact port.
It could have blocked as shown in following illustration.
This is all because of spanning tree decision making, where there are multiple switches connected there goes an underlying election among switches and only the one switch is elected to become a master and the master is called root bridge.
The root bridge will never shut down its port.
The process to elect the root bridge. In this election 3 things are gathered from every switch MAC address, Priority, and Bridge ID.
Bridge ID is combination of MAC address and priority.
Cisco switches run each spanning tree per VLAN and its is called Per-VLAN Spanning Tree + (PVST+). The Cisco switches take the priority number and add VLAN id into it to make the bridge ID.
In this case the NYACCESS1 has got the election and became root bridge. This switch is a old school switch this is the one reason why you may want to change the spanning-tree protocol.
The switches send BPDU (bridge protocol data unit) to each other and each switch sends and receives this data, and if there is no root bridge the election takes place and election looks at the priority number which is between 0 to 65535 and the default priority number is 32768 the exact half of total range. The switch which has the lowest priority number wins the election, and if there is a tie meaning that all switches have same priority number then the election goes to MAC address, and which ever switch has lowest first two digits number wins the election.
We can change the root bridge by changing the priority ID and the ideal switch that should be root bridge is the switch that sits in the middle of all switch and it is usually core switch at the middle.
Note that by default all switches have priority number 32768 and the election ties here and election goes to MAC address and older Cisco switches have low MAC address value and it is definite that the older switch will become root bridge.
Prerequisites for 200-301
200-301 is a single exam, consisting of about 120 questions. It covers a wide range of topics, such as routing and switching, security, wireless networking, and even some programming concepts. As with other Cisco certifications, you can take it at any of the Pearson VUE certification centers.
The recommended training program that can be taken at a Cisco academy is called Implementing and Administering Cisco Solutions (CCNA). The successful completion of a training course will get you a training badge.
Full Version 200-301 Dumps