What is STP ?
Why do we have a Loop ?
- Spanning Tree Protocol
- If we create redundancy in our Network, in-order to avoid single point of Failure, It leads to looping in the Network.
- It helps to avoid loops in Switched Network.
- Redundancy Brings Loops in the Network.
Why do we have a Loop ?
- PC--1 sends an ARP request because it’s looking for the MAC address of PC--2.
- An ARP request is a broadcast frame.
- Switch A will forward this broadcast frame on all it links, except the link where the frame originated from.
- Switch B will receive both broadcast frames.
- Now what does switch B do with those broadcast frames?
- It will forward it out of every link except the link where it originated from.
- This means that the frame that was received on Interface 1 will be forwarded on
- Interface 2.
- The frame that was received on Interface 2 will be forwarded on Interface 1.
- Spanning Tree is Enabled by Default, All our Switches will use special frame called
- as BPDU (Bridge Protocol data unit)
- First of all spanning tree will elect a root bridge; this root-bridge will be the one that has the best “bridge ID”.
- Bridge ID : Priority + Mac-Address.
- The lower the bridge ID, the better it is.
- By default the priority is a value of 32768 but you can change it if you want.
- First STP checks for Priority, if Priority is same then it checks for MAC-Address.
- Default STP is PVST (Per VLAN Spanning Tree )
Consider the above Example,
When you look at the 3 Switches, there is loop in the Network as SW-1 --> SW-2 --> SW-3 -->SW-1.
Lets look into the Process:
- First Switches Check for Who will become Root-Bridge, (Root -Bridge is based on priority and Mac-Address)
- First Switches, Checks for the Priority, By default the Priority will be the same on all switches.
- If the Priority is different on each switch, the Switch with Lower Priority will become Root-Bridge.
- If the Priority is same, then it chooses the Mac-Address, which is the Tie-Breaker.
- Lower the Mac-Address value will be elected as the Root-Bridge.
- In the Above Example, SW-1 is the Root Bridge,
Root Bridge
- Priority and Mac-Address make up a Bridge ID.
- The one with Lower Bridge ID becomes Root Bridge.
- Lower the Priority will be Selected as a Root Bridge.
- If Priority is Same, then it will check into the Mac-address.
- All ports in Root Bridge will become Designated Port and it will be Forwarding state.
If you Look at the Above picture, you can see D , D is Designated port, which means the port is Active.
STP Ports
- Designated Port :
- All ports in Root Bridge will become Designated Port and it will be Forwarding state.
- Root Port :
- Shortest path to reach the Root Bridge
- Shortest Path is Based on the interface COST
- Only One Root port is valid per Switch.
- Alternate Port :
- Alternate Port will be in Blocked mode, and it will come to designated port once the current link to reach the Root Bridge is down.
- In the above Scenario, SW-1 is the Root-Bridge, So the Root-port will only be in SW-2 and SW-3.
- SW-2 will select the interface no.2 as a Root-port, (As it is the Shortest path to reach the Root-Bridge), and SW-3 will select the interface no.1 as a Root-port.
- Note : Shortest Path is Based on the cost of the interface, not by the number of routers it need to pass to reach the Root-Bridge)
Next we need see about SW-2's port no.2 and SW-3's port no.2, who's port will be up and who's port will be blocked or down.
- D- Designated port , R- Root port and A - Alternate port
- Now again we need check about the Priority and MAC-Address of the Switch.
- When we check at SW-2 and SW-3, switch-2's Mac Address is low and Switch 2 wins the Battle and the port belongs to SW-2 will be up(Designated port), and the port of SW-3 will be in Alternate mode and it is in Blocked state. (Blocked state port won't send any traffic).
COST
- This is the default cost of the Interface, But it can also be Changed.
- Lower the Cost is better to reach the Root Bridge.
- 4 Gig interface is better than 1 Fast-Ethernet interface
STP Basic Command
- Switch-A# show spanning-tree
- This command shows us which Switch is Root-Bridge
- How to reach the Root-Bridge
- Local Switch mac-address and Root-Bridge Mac-Address.
- What is the Port State of the Interface.
STP Port States
- Blocking
- It will be in 20 seconds. The interface is similar to down.
- Listening
- When you connect a Cable to an interface it will be in Listening mode (15 sec )
- At this stage, it will send BPDU’s , but does not learn MAC-Address and no data-transmission
- Learning
- Again After 15 sec it moves from Listening to Learning mode.
- At this stage, it will send BPDU’s , but learns MAC-Address and no data-transmission
- Forwarding
- After 30 sec of connecting a cable it will be moving to forwarding state.
- At this stage, it will send BPDU’s , but learn MAC-Address and data-transmission is done.
Note : By Default All switches run PVST (Per VLAN Spanning tree Protocol)
Each Switch will be the Root-Bridge for Each-VLAN.
That's it about STP
You can also Look into my Video Tutorial
What is STP- Spanning Tree Protocol in Tamil
What is PVST- Per VLAN Spanning Tree Protocol in Tamil
What is STP- Spanning Tree Protocol in Tamil
What is PVST- Per VLAN Spanning Tree Protocol in Tamil
Post a Comment
Post a Comment