Spanning Tree-CCNP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Networkforyou

Welcome
To
Network for you
STP

Email us: 1 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Spanning Tree Protocol:


• STP Stand for Spanning Tree Protocol.
• STP is work in Switch to avoid loop in switch's or in other words we can say the spanning Tree
protocol is a network protocol that builds a loop-free logical topology for Ethernet networks.
• STP is Open Standard.
• STP works when multiple switches are used with redundant links.
• By default it is enable in CISCO Switches.
• STP will help us to create a loop free topology by blocking certain interfaces.
• Redundant link can creates network loops that flood down frames in the network.
• STP automatically removes layer 2 switching loops by shutting down redundant links.
• To finds a redundant link, it uses an algorithm, known as Spanning-tree algorithm (STA).
• STP used STA to prevent layer 2 loops.
• Spanning Tree Algorithm detecting layer 2 loops and blocks it until first one link goes down or
disconnected.
• Spanning Tree Protocols use BPDU (bridge protocol data unit) in every 2 second for preventing layer
2 loops.

Let see with Example:

Without STP we have the following issues.


1. Broadcast Storm
2. MAC Database Instability
3. Multiple Frame Transmission

Email us: 2 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Broadcast Storm:
• When switch receives broadcast frame, it continues broadcasting them.
• The Switches broadcasting them again to its other interfaces.
• Broadcasting will keep going on forever until we shut down the network.
• This Process is known as Broadcast storm of switches.
• Broadcast storm consumes the entire bandwidth of the network.
• Broadcast storm denies bandwidth for normal network traffic.

Email us: 3 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

MAC Database Instability:


• MAC tables are built by examining the source MAC address on a packet received.
• The source MAC address is tied to the interface it was received on.
• If loop occurs in the network then same source MAC address could be seen on more than
one Interface.
• So MAC table will be unstable that is instability of MAC table causes copies of same frame to
be delivered to multiple interfaces.
• MAC Instability results multiple copies of a frame arrive on different interface of switch.

Email us: 4 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Multiple Frame Transmission:


• Multiple copies of unicast frames may be delivered to destination host.
• Multiple copies of the same frame can cause unrecoverable errors.
Switch Priority:
• By default, all Cisco Switches has a Bridge Priority or Switch Priority value of 32,768.
• Bridge Priority value decides which Switch can become Root Bridge (Root Switch).
• Switch with lowest Bridge Priority (Switch Priority) Value will become the Root Switch.
Let see How STP is working.
• STP Selecting Root Bridge.
• STP Selecting Root Port.
• STP Selecting Designated port and non-Designated port.

Email us: 5 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Selecting the Root Bridge:


• The bridge with the lowest Bridge ID.
• Bridge ID = Priority + MAC address of the switch.
• All Switches priority is 32768+1 = 32769
• All Switches have same priority then they will compare MAC address.
• All Switches exchange information that is called BPDU (Bridge Protocol Data Units).
• Switches Send BPDU every 2 second.
• To Check we will use command : sh spanning-tree
• From the all switches in the network one is elected as Root Bridge. And all the remaining
switches will be considered as Non root Bridge.

Non-Root Bridge:

• Except Root Bridge, all remaining switches of network are considered as Non-Root
Bridges.
• Non-Root Bridges receive updates from Root Bridge & update their STP databases
relatively.
Port Priority:

• Each port of a Switch has a Port Priority value associated with it, 128 by default.

Email us: 6 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

• Gi0/1 128.20 P2P: Gi0/1 is the interface 128 is default value and 20 is port number.
• P2P means Point-to-point (Full Duplex) and Shr means Shared (Half Duplex) like hub.
Spanning Tree Port Roles:
Designated Port:

• A non – root port, which is forwarding away from the root switch.
• Switch can have multiple designated ports & marked as forwarding port.
• For root bridges all switch ports are designated ports.
• In Cisco Switches a Root Port can never be a designated port.
Non-Designated Port:

• Non-designated port having higher port cost than the designated port.
• Spanning Tree Protocol marks non-designated port as the blocking port.
• Non-designated port not forward any frames and used to remove loops.
• If any change in topology, the same port may become a designated port.
• The non-designated port of is a Cisco switch port that is blocked.
• A non-designated port of switch is not a root port or a designated port.
Root Port:

• The Root port is the port that directly connects to the Root Bridge
• The Root Port is the port which has least cost to reach root switch.
• The Root port is the port that is closest to the root bridge.
• Every non-root bridge must have a root port connect to root switch.
• Only one Root Port on non-root Switch and no Root Port in root bridge.
• A Root Port has the least cost from the "Switch" to the Root Bridge.
• The Root ports forward traffic toward the root bridge.
Alternate Port:
• Alternative port moves to the forwarding state if any change in topology.
• Alternate port is a best alternate path to the root bridge or Switch.
Forwarding Ports:
• It also has two type designated ports and Root ports.

Email us: 7 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Blocking Ports:
• It is also called Non-Forwarding ports
Selecting the Root Port:
• Shortest path to the root bridge (Every non root bridge looks the best way to go root
bridge) Least cost (speed).
• Typical Costs of different Ethernet networks.

Speed Cost

10Gbps 2

1Gbps 4

100Mbps 19

10Mbps 100
STP Port states

1. Listening 15 sec.
2. Learning 15 sec.
3. Blocking 20 sec.
4. Forwarding No limits
5. Disable No limits

Listening State:
• After blocking state, Root Port or Designated Port will move to listening state.
• During listening state, port discards frames received from attached network segment.
• During listening state port discards frames switched from another port for forwarding.
• After 15 seconds, the switch port moves from the listening state to the learning state.
Learning State:
• Only root port & designated ports enter into learning state from listening.
• A Cisco Switch port change to learning state after the listening state.
• During the learning state, the port is listening for and processing BPDUs.
• In the learning state, the port begins to process the user frames.

Email us: 8 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

• In the learning state, the port start updating the MAC address table.
• Data or user frames are not forwarded to the destination port of switch.
• After 15 seconds, switch port moves from learning state to forwarding state.
Forwarding State:
• In this state, the switch listens and processes both BPDUs and user frames.
• Port in forwarding state forwards frames across attached network segment.
• In forwarding state, port will process BPDUs & update its MAC Address table.
• Data frames are forwarded to destination, Forwarding State is normal state.
• The Data and configuration messages are passed through the port or link.
Blocking State:
• When we power on a Switch, the switch puts all of its ports in this state.
• The Switch Ports will go into a blocking state at the time of election process.
• In Blocking state, the switch only listens and processes the BPDUs only.
• Switch port in blocking state does not participate in frame forwarding.
• Port in blocking state discards frames received from attached network segment.
• During blocking state, port only listening & processing BPDUs on its interfaces.
• After 20 seconds, switch port changes from the blocking state to listening state.
Disabled State:
• A port in the disabled state does not participate in frame forwarding.
• A port in the disabled state does not participate in operation of STP.
• A port in the disabled state is considered non-operational.
• This state applies to all ports which are either manually shut down.
• All unplugged ports or interface also remain in Disabled state.
Type of STP:

Type of STP
Protocol Standard Resources Need Convergence Numbers of Trees

STP 802.1D Low Slow One


PVST+ CISCO High Slow One for Every VLAN
RSTP 802.1W Medium Fast One

Email us: 9 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Rapid PVST+ CISCO Very High Fast One for Every VLAN
MST 802.1S Medium or High Fast One for Multiple Vlans

PVST+:
• PVST+ stands for Per VLAN Spanning Tree Plus (PVST+).
• PVST+ is a CISCO Implementation of STP.
• Per-VLAN Spanning Tree+ (PVST+) is an extension of the PVST standard.
• PVST+ supports DOT1Q trucking encapsulation while PVST not support.
• PVST+ Provide each VLAN have its own Spanning Tree Protocol topology.
• PVST is usually the default spanning tree protocol on CISCO Switches.
• PVST+ takes 30 to 50 seconds to transit from blocking state to forwarding state.

Email us: 10 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

RPVST+:
• RPVST+ stands for Rapid Per-VLAN Spanning Tree Plus.
• Rapid PVST+ is an enhanced version of the PVST+ version.
• Rapid PVST+ allows for faster spanning Tree calculations and convergence.
• RSTP is typically able to respond less than 10 seconds of a physical link failure.
• Rapid PVST+ defines three port states Discarding, Learning and Forwarding.
• We can enable RSTP by using command: spanning-tree mode rapid-pvst

STP RSTP
Disabled Discarding
Blocking Discarding
Listening Discarding
Learning Learning
Forwarding Forwarding

Email us: 11 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

BPDU (Bridge Protocol Data Units):


• Bridge Protocol Data Units (BPDUs) are messages exchanged between the switches.
• BPDUs frames contain info about switch ID, originating switch port & MAC address.
• BPDUS frames also contain info regarding switch port priority, switch port cost etc.
• Bridge Protocol Data Units (BPDUs) frames are sent out as multicast messages regularly.
• BPDUS frames use the multicast destination MAC address which is 01:80:c2:00:00:00.
• When BPDUs are received, the Switch uses a mathematical formula called the STA.
• Spanning Tree Algorithm (STA) know when there is a Layer 2 Switch loop in network.
• Spanning Tree Algorithm determines which of redundant ports needs to be shut down.
• Three types of BPDUs are Configuration BPDU, Topology Change Notification (TCN)
BPDU and Topology Change Notification Acknowledgment (TCA).
• Basic purpose of BPDUs & Spanning Tree Algorithm is to avoid Layer 2 Switching loops.
• Basic purpose of BPDUs and Spanning Tree Algorithm to avoid Layer 2 Broadcast storms.
• Configuration BPDUs are used to elect the Root Bridges, root ports, and designated
ports.

Email us: 12 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

• When topology change occurs, Switch send TCN BPDU out its root port, destined for
Root.
• TCN contains no information about the change – it only indicates that a change
occurred.
• By responding with a TCN with the Topology Change Acknowledgement (TCA) flag set.
• Once Root Bridge receives the TCN, it will send out a configuration BPDU to all switches.

Spanning Tree Timers:


STP timers are hello timer, forward delay timer and max age timer.
Hello Time:
• Hello Time, defines interval Root Bridge send out configuration BPDUs.
• The Default Spanning Tree Protocol (STP) hello timer is 2 seconds.
• STP hello timer can be adjust to any value between 1 and 10 seconds.

Email us: 13 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Forward Delay:
• Forward delay timer is time interval spent in listening & learning state.
• The Forward Delay is the length of the Listening and the Learning states.
• Default Spanning Tree Protocol (STP) forward delay timer is 15 seconds.
• STP forward delay timer can be adjust to any value between 4 & 30 seconds.
Maximum Age:
• The Spanning Tree Maximum Age timer often referenced as MaxAge.
• If the port no longer receives the BPDUs after the Max Age time has elapsed.
• Switch assumes that topology change must have occurred & BPDU is aged out.
• By default, Spanning Tree Protocol Maximum Age timer is set to 20 seconds.
• The STP max age timer can be tune to any value between 6 and 40 seconds.

Commands Description
show spanning-tree vlan 1 Display STP details
spanning-tree vlan 1 hello-time 5 Changing STP Hello time
spanning-tree vlan 1 forward-time 20 Changing STP Forward Delay time
spanning-tree vlan 1 max-age 40 Changing STP Maximum Age time

Port Fast:
• By passing the listening & learning states, go to forwarding mode.
• STP PortFast feature causes a port to enter forwarding state immediately.
• Port Fast port normally connect to end devices such as server, printer or PC.
• Do not enable portfast on an interface to another device which is hub/switch.
• If Port Fast feature port connect to a cisco switches, it may cause a loop.
• PVST+, Rapid PVST+, or MSTP Spanning tree all support Port Fast feature.
• Port Fast can be enable on interface level or globally on Cisco switch.
• When running globally it enable Portfast on interface that is edge port.

Enable Portfast Feature We can check by debug


interface e0/0
spanning-tree portfast debug spanning-tree events
no shutdown

Email us: 14 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

Lab Time:

PC Configuraiton: Switch Configuration:


PC1> sh ip interface e0/0
spanning-tree portfast
NAME : PC1[1] no shutdown
IP/MASK : 0.0.0.0/0
GATEWAY : 0.0.0.0
DNS :
MAC : 00:50:79:66:68:00
LPORT : 10001
RHOST:PORT : 127.0.0.1:10002
MTU: : 1500

PC1> ip 192.168.1.2/24 192.168.1.1


Checking for duplicate address...
PC1 : 192.168.1.2 255.255.255.0 gateway
192.168.1.1

PC1> sh ip

NAME : PC1[1]
IP/MASK : 192.168.1.2/24
GATEWAY : 192.168.1.1
DNS :
MAC : 00:50:79:66:68:00
LPORT : 10001

Email us: 15 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

RHOST:PORT : 127.0.0.1:10002
MTU: : 1500

PC1> save
Saving startup configuration to startup.vpc
. done
Without Port Fast:

With Port Fast:

Email us: 16 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

MST:

• MST stands for Multiple Spanning Tree.


• IEEE 802.1s define multiple Spanning Tree implementations.
• Common Spanning Tree has a single instance for all VLANs.
• It is concept of mapping one or more VLANs to single STP instance.
• For Example, the 2000 VLANs can be mapped to two MST instances.
• Rather than to maintaining and running 2000 separate Spanning Trees.
• Each Cisco Switch needs to maintain only two Spanning Trees only.
• Reducing need for switch resources also converges faster than PVRST+.
• Multiple Spanning Tree (MST) works with the concept of the regions.
• A region is defined by the name given in MST configuration mode.
• Region is group of devices configured together to form logical region.
• It is similar to administration domain collection of VLANs have same config.
• Collection of VLANs managed under the same MST umbrella is regions.
• It has same attributes Configuration Name, Revision Number and Instance.
• MST configuration name identify MST region & revision number any number.
• MST revision number is locally significant number signify the MST configuration.
• MST name, instance and revision number must match to build MST topology.
Lab time MST:
((L2-ADVIPSERVICESK9-MS.HIGH_IRON_20160628.bin) -Switch Image which use in this Lab)

Email us: 17 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

SW1 Configuration
SW1(config)#interface range e0/0-1
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#switchport mode trunk
SW1(config-if-range)#no shutdown
SW1(config)#vlan 10,20,30,40,50,60

SW2 Configuration
SW2(config)#interface range e0/0-1
SW2(config-if-range)#switchport trunk encapsulation dot1q
SW2(config-if-range)#switchport mode trunk
SW2(config-if-range)#no shutdown
SW2(config-if-range)#vlan 10,20,30,40,50,60

SW1 MST Configuration


SW1(config)#spanning-tree mode mst
SW1(config)#spanning-tree mst configuration
SW1(config-mst)#name test
SW1(config-mst)#revision 1
SW1(config-mst)#instance 1 vlan 10,20,30
SW1(config-mst)#instance 2 vlan 40,50,60
SW1#show spanning-tree mst
SW1#show spanning-tree mst configuration
SW1# show spanning-tree bridge
SW1#show spanning-tree root
SW1(config)#spanning-tree mst 1 priority 4096
SW1(config)#spanning-tree mst 2 priority 0

SW2 MST Configuration


SW2(config)#spanning-tree mode mst
SW2(config)#spanning-tree mst configuration
SW2(config-mst)#name test
SW2(config-mst)#revision 1
SW2(config-mst)#instance 1 vlan 10,20,30

Email us: 18 of 19 WhatsApp Us : +966532984612


[email protected]
Networkforyou

SW2(config-mst)#instance 2 vlan 40,50,60


SW2#show spanning-tree mst
SW2#show spanning-tree mst configuration
SW2# show spanning-tree bridge
SW2#show spanning-tree root
SW2(config)#spanning-tree mst 1 priority 0
SW2(config)#spanning-tree mst 2 priority 4096

Email us: 19 of 19 WhatsApp Us : +966532984612


[email protected]

You might also like