Spanning Tree Protocol



To prevent bridging loops, the IEEE 802.1d committee defined a standard called the spanning tree algorithm (STA), or spanning tree protocol (STP). With this protocol, one bridge (or switch) for each route is assigned as the designated bridge. Only the designated bridge can forward packets. Redundant bridges (and switches) are assigned as backups. There can be only one spanning-tree instance per bridge, while switches can have many.


Bridge Protocol Data Unit (BPDU) Port cost determines the best path when multiple links are used between two switches
and none of the links is a root port.

Root port - shortest path to the root bridge.
It is possible to have several links connected to root bridge/switch.
If more than one link connects to the root bridge, then a port cost is determined by checking the bandwidth of each link.

Root Bridge/Switch elections by sending BPDUs every 2 sec out of every active port:
1 Bridge ID is used to elect the root (by default 32768) -- lowest wins
2 Mac address - lowest wins

Elections of a non-designated port on the same switch:
1 Port with the higher bandwidth wins, lower bandwidth will be shut down
2 Port number (lowest wins, higher port number will be shut down)

to change priority:
Switch B(config)#spanning-tree vlan 1 priority 4096


to check spanning tree status :
Switch B(config)#do show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 0005.74ae.aa40 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 0012.7f52.0280 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300
useful information from this example:
1 Switch B is running the IEEE 801.d
2 Switch B’s priority is 32,768—the default for every switch. You see it listed as 32769, but the actual VLAN ID is added,
so in this case it shows up as 32769 for VLAN 1.
802.1w - Rapid Spanning Tree Protocol - RSTP

spanning-tree mode rapid-pvst - to enable this modification

Core(config)#spanning-tree mode rapid-pvst




one can check version by looking at:
Core(config)#do show spanning-tree VLAN0001 Spanning tree enabled protocol rstp
show spanning-tree specifications:

Router# show spanning-tree interface fastethernet 0/1


Router# show spanning-tree summary




Port modes :blocking , listening, learning, forwarding, disabled.
Listening The port listens to BPDUs to make sure no loops occur on the network before passing data frames.
A port in listening state prepares to forward data frames without populating the MAC address table.

Learning The switch port listens to BPDUs and learns all the paths in the switched network.
A port in learning state populates the MAC address table but doesn’t forward data frames.

Forward delay - time it takes to transition a port from listening to learning mode (and also from learning to forwarding ?), which is set to 15 seconds by default and can be seen in the show spanning-tree output.

Convergence occurs when all ports on bridges and switches have transitioned to either forwarding or blocking modes. No data will be forwarded until convergence is complete.
And before data can begin being forwarded again, all devices must be updated.

Typical spanning-tree topology’s time to convergence from blocking to forwarding on a switch port is 50 seconds


Port Fast
it means the port won’t spend the usual 50 seconds to come up into forwarding mode while STP is converging. This Cisco 802.1d extension stops BPDU from being transmitted out a port. to set portFast mode: spanning-tree portfast - to set portFast mode:

Switch(config-if)#spanning-tree portfast




EtherChannel
Modifications:
  • Cisco’s version - Port Aggregation Protocol (PAgP) -
  • IEEE 802.3ad standard - Link Aggregation Control Protocol (LACP)


  • Dslam example: