Friday 21 December 2018

What is Spanning tree protocol (STP)? How STP works?


Spanning tree protocol (STP) is used to preventing network loops on layer 2 network switch. STP
Monitor the network to track all links and shut down the redundant links.  
Redundant links between switches provides us redundancy but it’s also possibility to create loops when switches do broadcasts.





Spanning tree prevent loops when you have multiple redundant links between switches. Spamming tree also help us to avoid broadcast storm, frame copies and instability database. Spanning is a open standard protocol (IEEE 802.1D). Spanning tree is enable by default on all Cisco catalyst switches.

Spanning-tree terms


Root Bridge is the bridge with the lowest best bridge ID. Bridge ID is priority + MAC address of the switch. The switches within the STP network elect a root bridge, and it’s become central point in the network and all the remaining switches will be considered as Non-root Bridge.

Non-root Bridge is the bridge which is not a Root Bridge. There is only one Root Bridge in each LAN and all the remaining bridge will be considered as Non-root Bridge. Non root bridge exchange BPDUs with all the other bridges and update the Spanning tree topology database.


BPDU all switches exchange information to use for the subsequent configuration of the network is called bridge protocol data units (BPDUs). BPDU are sent every 2 seconds and maximum age 20 seconds, inside the BPDU is the bridge ID , BPDU contains information regarding ports, switches, port priority and addresses.

Bridge ID is a combination of the bridge priority 32,768 by default on all Cisco switches and the MAC address. The bridge with the lowest bridge ID becomes the root bridge in the LAN.

Port cost is determine the best path when we are using multiple links between two switches, every bridge find the most efficient path to the root bridge.

Path cost is calculated for each unique path by adding the individual port cost encountered on the way to the root bridge.

Bridge port


Root port is the link with the lowest path cost to the root bridge.


Designating port is lowest cost to get on a given network segment. Designating port is a forwarding port and we can have only one forwarding port per network segment.

Non-designating port is one with a higher cost then the designating port. These ports are put in blocking or discarding mode.

Forwarding port is either a root port or a designating port. Its forwards frames.

Blocking port are not forward frames but its still listen to BPDU frames from its neighbors but never transmit frames.

Spanning-tree Port States.


Disable state is manually disable by administrator.

Blocking state the purpose of this state is preventing loops. When the switch powers up all the ports is in blocking state 20 seconds or no limits.

 Listening state the port in this state listen the BPDU just to ensure there is no loops occur on the network before passing data frames. It takes 15 seconds.


Learning state this state listens to BPDU and learns all the paths in the switch network its take 15 seconds.

Forwarding state sends and receives all the data frames on the bridge port.

lets see the CLI



 Topology:-

Goal:
  • first we will find which switch is root bridge , root port,  block port, and forwarding port.
  • second step we will change the root bridge and we will see changes to STP ports.





sw-1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C70C.320A
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00D0.BCC3.256A
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/4 Desg FWD 19 128.4 P2p
Fa0/1 Root FWD 19 128.1 P2p


sw-2#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C70C.320A
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0001.C70C.320A
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p



(switch 2 is root bridge in our topology)

sw-3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C70C.320A
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.2F17.343E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Root FWD 19 128.2 P2p

Fa0/3 Desg FWD 19 128.3 P2p


Switch#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.C70C.320A
Cost 38
Port 3(FastEthernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.7062.2A37
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3 Root FWD 19 128.3 P2p


Fa0/4 Altn BLK 19 128.4 P2p

let change the root bridge for vlan 1, we are going to configure switch 1 as a root bridge 

sw-1(config)#spanning-tree vlan 1 priority 0
sw-1(config)#end

sw-1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 1
Address 00D0.BCC3.256A
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 1 (priority 0 sys-id-ext 1)
Address 00D0.BCC3.256A
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/4 Desg FWD 19 128.4 P2p
Fa0/1 Desg FWD 19 128.1 P2p


sw-3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 1
Address 00D0.BCC3.256A
Cost 38
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.2F17.343E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Root FWD 19 128.2 P2p
Fa0/3 Altn BLK 19 128.3 P2p



now switch 3 fastethernet 0/3 become alternative block state.

 


 


Instagram

Facebook


Twitter



LINKEDIN








No comments:

What is Virtual Router Redundancy Protocol (VRRP)? How to configure Virtual Router Redundancy Protocol (VRRP)?

 Virtual Router Redundancy Protocol (VRRP) is a gateway redundancy networking protocol used to create a virtual gateway similar to HSRP . VR...