STP - Spanning Tree Protocol Detail and Configuration

STP (Spanning Tree Protocol)

STP (Spanning Tree Protocol) is used to prevent any network for looping of frames by keeping some ports or interfaces of device in forward state and some ports or interfaces in blocked mode.
When two or more than two switches are connected with each other to create redundant links then it may cause loop occurrence. STP is layer 2 protocol and it enabled on switches by default. STP is used to stop loop occurrence.

STP - Spanning Tree Protocol
  • STP - IEEE 802.1D (Open Standard)
  • RSTP - IEEE 802.1W
  • MST (Multiple Spanning Tree) - IEEE 802.1S
  • PVST (Per VLAN Spanning Tree) - CISCO Proprietary
  • PVST+ - CISCO Proprietary
  • RPVST - CISCO Proprietary
  • CST (Common Spanning Tree) - All VLANs will participate in single number of instance
  • IST (Inter Spanning Tree) - Different - Different VLANs Different - Different number of instance
Problems which occur if STP is not used
  • Storm of Broadcast
  • High Process Utilization
  • Instability of MAC Table
  • Transmission of Multiple Frames
Tasks performed by STP
  • Root Bridge Elect
  • Designated Port Elect
  • Root Port Elect

Root Bridge Elect

A switch having lowest best bridge ID which is the combination of switch priority and MAC addresses. This ID is consist of 8 bytes. 2 bytes for priority and 6 bytes for MAC address.
By default priority of switches is 32768.
Priority can be changed and set between 0 - 65535.

STP - Root Bridge

Designated Port Elect

Ports which advertise BPDUs having lowest cost are know as designated ports. BPDUs are sent by designated ports towards Non Root Bridge.

Root Port Elect

Port that receives the BPDUs of lowest cost is know as root port. It is the shortest path to the root bridge.
COST - Cost is an integer value which is used to perform Designated Port (DP) and Root Port (RP) elections.

Ethernet StandardsCost
10 Mbps100
100 Mbps19
1 Gbps4
10 Gbps2

BPDU (Bridge Protocol Data Unit)

Each switch send hello packet to other switch in every 2 sec and that hello packet is known as hello BPDU.
There are two types of BPDU
  1. Configuration BPDU - Sent from Root to Non-Root
  2. TCN (Topology Change Notification) BPDU - Sent from Non-Root to Root

Contents of Configuration BPDU

  1. Protocol ID is always 0
  2. Version is always 0
  3. Type of Message
  4. Flag
  5. ID of Root Bridge
  6. Cost of Root
  7. ID of Sender Bridge
  8. Priority of Sender Port
  9. Maximum Age
  10. Age of Message
  11. Hello
  12. Forward Delay

Content of TCN BPDU

  1. ID of Protocol
  2. Version
  3. Type of Message
  • Root Bridge sends configuration BPDU after every 2 seconds.
  • Cost of BPDU send by root bridge is always 0.

Root Bridge Requirements

  1. Low Bridge Priority
  2. Low MAC Address
(NOTE: COST OF BPDU GENERATED BY ROOT BRIDGE IS ALWAYS 0)

DP and RP Requirements

  1. Lower Bridge ID which is only for DP and between Root and Non Root
  2. Low Cost for DP and RP
  3. Lower Sender ID between Root to Non Root
  4. Lower Sender Port Priority between Non Root to Non Root
  5. Lower Sender Port ID

Configurations of STP

As we have learnt above that STP is enabled by default on all the switches, so here we will see that how the cost and priority of any interface can be changed or how to make any switch as root bridge.

If we want to make switch as root bridge for one vlan
Switch(config)# spanning-tree vlan 1 priority 0

If we want to make switch as root bridge for all vlans
Switch(config)# spanning-tree vlan 1 - 4094 priority 0

To remove switch from root bridge
Switch(config)# no spanning -tree vlan 1 - 4094 priority 0

If one switch goes down then other switch becomes root bridge
Switch(config)# spanning-tree vlan 1 - 5 root primary
Switch(config)# spanning-tree vlan 6 - 10 root secondary

On other switch issue the reverse commands
Switch(config)# spanning-tree vlan 1 - 5 root secondary
Switch(config)# spanning-tree vlan 6 - 10 root primary

To change the cost of any interface
Switch(config)# interface fa 0/1
Switch(config-if)# spanning-tree vlan 1 cost 20
Switch(config-if)# exit

To change the priority of any port
Switch(config)# interface fa 0/1
Switch(config-if)# spanning-tree vlan 1 port priority 100
Switch(config-if)# exit

To configure port fast
Switch(config)# interface fa 0/1
Switch(config-if)# spanning-tree portfast

We can also configure range to configure port fast
Switch(config)# interface range fa 0/1 - 24
Switch(config-if-range)# spanning-tree portfast
Switch(config-if-range)# exit

To stop or disable spanning tree protocol
Switch(config)# no spanning-tree vlan 1

Set timer for Hello Packet
Switch(config)# spanning-tree vlan 1 hello time <select form 1 to 10 sec>

Change Maximum age
Switch(config)# spanning-tree vlan 1 max-age <select from 6 to 40 sec>

Change forward delay time
Switch(config)# spanning-tree vlan 1 forward-time <select form 4 to 30 sec>

No comments:

Post a Comment