How can Spanning Tree help us in real life?
When we talk about switches which make you think about Spanning Tree Protocol (“STP”). In our Life, we need switches, usually it will be connected a “Access Layer”. Access Layer is always connected with End Devices like your laptop, mobile…etc part of the duties is to give your access to a specific resources Like (” Going to your company internal website to work or Going to company’s File sharing system if it in house)
If there is no STP, the traffic doesn’t no where to stop. All those switches will just keeping send traffic, that create Traffic Loop. I don’t want this happen, thats why here STP to help us.
Figure 1.1 you can see that there is 5 switches both connected with cross-over cable. But actually when STP is in place, your switch network, it will be on the image Figure 1.2
__________________________________
SPANNING TREE
Once you connect your switches with cable, It will not start straight away. The port will have 4 states
Blocking – Blocked
Listening – listen and send BPDUs
Learning – stop sending its own BPDUs, relay the superior BPDUs
Forwarding – forwarding traffic
After went through this 4 states, The switches will know who is Root Bridge. Root Bridge will be only ONE. In our case, The Root Bridge it is SW2, because its MAC address is lowest “001.9671.5E2B”, if compare with other switches.
__________________________________ __________________________________
ROOT BRIDGE & BPDU
Figure 3.1 blow, ” show spanning-tree” command on SW2. you can see spanning tree protocol information. It will tell you what is your Bridge ID, who is root bridge and its ID, what is Priority.
In this case, Root Bridge and your Bridge ID is the same “0001.9671.5E2B” All Switches will know this information, it is because switches sending Bridge Protocl Data Unit (” BPDU “). They will have the information they need, to make a decision which port will be Root Port, Designed Port or Altn Port. Then the network will become Figure 1.2 image.
__________________________________ __________________________________ __________________________________
PRIORITY
Bridge ID = Priority + extended system ID + MAC
By Default Priority is 32768 + VLAN index. You can see figure 4.1, Priority 32778 = 32768 + VLAN 10. Lowest Priority who will become Root Bridge.
Now we input a command on SW5, “spanning-tree vlan 10 root primary” to force SW5 become root bridge in VLAN 10. Figure 4.2, we can see the Priority of SW5 is 24586.