Spanning Tree Protocol (STP) is a network protocol designed to prevent layer 2 loops. It is standardized as IEEE 802.D protocol. STP blocks some ports on switches with redundant links to prevent broadcast storms and ensure loop-free topology. With STP in place, you can have redundant links between switches in order to provide redundancy.
2. Overview
Spanning Tree Protocol (STP) allows Ethernet LANs to have to have redundant link without
loops.
STP is a part of 802.1D standard, overtime the STP (Spanning Tree Protocol) became legacy and
RSTP (Rapid Spanning Tree Protocol) took its place.
• Section 1 : How STP and RSTP discovers a tree with links with no loop.
• Section 2 : Different between STP and RSTP
• Section 3 : How RSTP works better than STP while reacting to a change.
3. LOOP AVOIDANCE
• If multiple connection between two switches are created for redundancy
puroses,network loop can occur.
• Spanning Tree Protocol ( STP ) is used to prevent from network loops while
still permitting redundancy.
4. SPANNING TREE PROTOCOL CONCEPT
• Spanning tree is a protocol that run on switch that help to solve the loop.
• Stp work in switch to avoid loop in switch or spanning tree protocol is a
network protocol that builds a loop- free logical topology for ethernet
network.
• Stp is open standard .
• Stp works when multi switch or used with redunnand links.
• By default stp is ennabled in all the cisco switches.
5. NEEDS
Without stp we have the following issues.
• Layer 2 loop
• Dublicate unicaste frames.
• Broadcaste storm
6. Please note that the original frame also
went via Gi0/1 towards Gi0/2
7. The STP Bridge ID and Hello BPDU
We need to understand the message flowing between two switches.
The STP/RSTP Bridge ID (BID) is an 8-byte value unique to each switch.= 2-byte is Priority field &
6 byte System ID Extension or MAC.
STP/RSTP defines messages called Bridge Protocol Data Units (BPDU), also called Configuration
BPDU.
Most common BPDU is Hello BPDU which carries many details including BID so switch can
understand which BPDU sent by which switch.
8.
9.
10. HOW IT WILL WORK
• Selecting the root bridge. 32768
• Selecting the root port.
• Selecting the designated port
• Blocking the unnessery port
11. How Spanning Tree Works
• The process used by switch is called Spanning tree algorithm.
STP/RSTP uses three criteria to choose whether to put an interface in forwarding state:
1. Elect a Root Switch : The switch having best BID (Bridge ID) becomes the root switch.
2. Elect Root Port : to a segment of switches that interface is called Designated Port. Root
port is the port with lowest cost to reach the Root switch on a Non Root switch.
3. The switch interface which is attached
All the other interfaces are placed in blocking state.
12. SELECTING THE ROOT BRIDGE
• The bridge with the lowest bridge id.
• Bridge id = priority + mac address of the switches
• And priority of all switches is 32768+1 = 32769.
• All switches have same priority then they will compare mac address .
• All switches exchange information that is called as bridge protocol data unit (BPDU) . Switches sends
BPDU every 2 sec .
• To check we will type command : sh spanning-tree
• From the all switches to the network 1 is elected as a root bridge.
• Every network will have only 1 root bridge and all the remaining switches will be considered as non root
bridge.
14. • Forwarding port
• It also have two type designated poet and root port.
non forwarding ports
It is also called blocking port
15. Different type of spanning tree
• STP --- it is IEEE 802.1D - it is legacy standard of spanning tree .it is very old when we
have use bridges . Is is a basis of other version of stp.
• CST--- it is comman spanning tree ---- assume that there is one spanning tree instance for
the entire bridged network ---- we do not use this now.
• PVST ( per VLAN Spanning tree v) it is cisco proprietary ever vlan have separate spanning
tree --- only support ISL ( it calculate a topology for each vlan ).
• PVST+ ----- is open standard --- support ISL and 802.1Q . Today we offand refer PVST+ as
PVST .
• PVST is a saying every vlan have separate stp.
• RSTP
16.
17. IEEE 802.1D STP
• The original version of STP comes from the IEEE 802.1D standards.
802.1D Port States :
1.Disabled: The port is in shutdown state
2.Blocking : Port is enabled, can only receive BPDU’s but neither sending any traffic or learning
MAC address.
3.Listening: It can send and receive BPDU’s, cannot forward any traffic or learn any mac address.
4.Learning: The switch still does not forward any other network traffic, however it learns MAC address.
5.Forwarding: The switch port can forward all network traffic and can update the MAC address.
6.Broken: The switch has detected a configuration or an operational problem, and it discards the packet until issue
gets fixed.
The entire process takes around 30 seconds.
18. Stp port states
• Blocking 20 sec.
• Listioning 15 sec.
• Learning 15 sec.
• Forwarding no limits .
• Disable no limit.
19. Port States Receive BPDU Send BPDU Learn MAC Forward Frames
Blocking Yes No No No
Listening Yes Yes No No
Learning Yes Yes Yes No
Forwarding Yes Yes Yes Yes
Broken - - - -
20. LAB
• Connect 5 switches and find who became
Root switch and Why
• Etherchannel
• Connect a switch port to a PC and
configure the switch port with BPDU
Guard and check the result
• Connect a switch port to a switch and
configure the switch port with BPDU
Guard and check the result
INTERVIEW QUESTIONS
1. What is STP and RSTP
2. STP States ?
3. RSTP States ?
4. STP vs RSTP ?
5. Root switch election process
6. Port roles in STP and RSTP
7. Define the port roles