STP(Spanning Tree Protocol)

 

Overview of STP

Spanning Tree Protocol (STP) is a network protocol designed to prevent Layer 2 loops in Ethernet networks. It ensures a loop-free topology by blocking redundant paths that could cause broadcast storms and MAC table instability. STP is standardized as IEEE 802.1D

.

Key Concepts

  1. Bridge Protocol Data Units (BPDUs):

    • Purpose: BPDUs are messages exchanged between switches to maintain the spanning tree topology.
    • Content: BPDUs contain information about bridge IDs, root path costs, and port roles.
  2. Bridge ID:

    • Structure: An 8-byte value consisting of a 2-byte priority and a 6-byte MAC address.
    • Role: Used to elect the root bridge.
  3. Root Bridge:

    • Selection: The switch with the lowest bridge ID becomes the root bridge.
    • Function: Acts as the central point in the spanning tree topology.
  4. Port Roles:

    • Root Port: The port on a non-root switch with the lowest path cost to the root bridge.
    • Designated Port: The port on each network segment that has the best path to the root bridge.
    • Blocked Port: Ports that are not part of the active spanning tree and do not forward frames.
  5. Port States:

    • Disabled: The port is administratively shut down.
    • Blocking: The port does not forward frames but listens for BPDUs.
    • Listening: The port listens for BPDUs and prepares to transition to the learning state.
    • Learning: The port learns MAC addresses but does not forward frames.
    • Forwarding: The port forwards frames and participates in the active topology.

STP Operation

  1. Root Bridge Election:

    • All switches initially consider themselves as the root bridge.
    • BPDUs are exchanged, and the switch with the lowest bridge ID is elected as the root bridge.
  2. Path Cost Calculation:

    • Each switch calculates the path cost to the root bridge based on the speed of the links.
    • The path cost is used to determine the roles of the ports.
  3. Port Role Assignment:

    • Root Port: The port with the lowest path cost to the root bridge.
    • Designated Port: The port with the best path to the root bridge on each segment.
    • Blocked Port: Ports that are not part of the active topology.
  4. Topology Changes:

    • When a link fails or a new link is added, STP recalculates the spanning tree to maintain a loop-free topology.

STP Configuration Example

Here is a basic STP configuration for a Cisco switch:

switch# configure terminal
switch(config)# spanning-tree mode stp
switch(config)# spanning-tree vlan 1 priority 4096
switch(config)# interface GigabitEthernet0/1
switch(config-if)# spanning-tree portfast
switch(config-if)# spanning-tree bpduguard enable

Variants of STP

  1. Rapid Spanning Tree Protocol (RSTP):

    • Standard: IEEE 802.1w.
    • Improvement: Provides faster convergence compared to STP.
    • Compatibility: Backward compatible with STP.
  2. Multiple Spanning Tree Protocol (MSTP):

    • Standard: IEEE 802.1s.
    • Improvement: Allows multiple spanning trees for different VLANs.
    • Use Case: Optimizes network performance by reducing the number of spanning tree instances.

Summary Table

FeatureSTPRSTPMSTP
StandardIEEE 802.1DIEEE 802.1wIEEE 802.1s
Convergence TimeSlowFastFast
Port RolesRoot, Designated, BlockedRoot, Designated, Alternate, BackupRoot, Designated, Alternate, Backup
Port StatesDisabled, Blocking, Listening, Learning, ForwardingDiscarding, Learning, ForwardingDiscarding, Learning, Forwarding
VLAN SupportSingle instanceSingle instanceMultiple instances

Comments

Popular posts from this blog

TCL Interview Programs

Python Interview Programs

-: Networking interview questions :-