The Solution to the Layer 2 Loop

STP, or 802.1D, was developed to identify parallel Layer 2 paths and block on one of the redundant paths so that a Layer 2 loop would not occur. A single switch with the lowest bridge ID becomes the root bridge, and then all the other nonroot switches determine whether they have parallel paths to the root and block on all but one of those paths. STP communicates using bridge protocol data units (BPDU), and that is how negotiation and loop detection are accomplished.

Example 9-4, which contains annotations, allows you to both review how STP operates and see the commands to verify it at the same time; it uses the topology from the beginning of this chapter.

Example 9-4 STP Verification and Annotations


SW1# show spanning-tree vlan 10

VLAN0010
! This top part indicates the Bridge ID of the root bridge, which is a combination
! of the Bridge Priority and Base MAC address. The switch with the lowest overall
! Bridge ID of all switches in the network becomes the Root Bridge.
! NOTE: If all switches in a network are enabled with default spanning-tree settings
! (default bridge priority is 32768), the switch with the lowest MAC
! address becomes the Root Bridge.
! This switch is claiming victory over the other switch (SW2)
! This is due to this switch having a lower bridge ID

  Spanning tree enabled protocol ieee
  Root ID    Priority    32778
             Address     0019.060c.9080
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

! This is the output about the local switch.  Because this is the root
! switch,
! this information will be identical to the information above regarding the
! bridge ID, which is a combination of the Priority and Base MAC address
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     0019.060c.9080
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

! This specifies the state of each interface, and the default costs associated
! with each interface if trying to reach the root switch. Because this
! switch
! is the root bridge/switch, the local costs are not relevant.
! This also shows the forwarding or blocking state.   All ports on the root
! switch
! will be forwarding, every time, for the VLAN for which it is the root bridge.
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- ---------------------------
Fa0/1               Desg FWD 19        128.3    P2p
Fa0/3               Desg FWD 19        128.5    P2p
Fa0/23              Desg FWD 19        128.25   P2p
Fa0/24              Desg FWD 19        128.26   P2p

! Road trip over to SW2, who didn't win the STP election
SW2# show spanning-tree vlan 10

! This first part identifies who the root is, and the cost for this switch to get
! to the root switch.   SW1 advertised BPDUs that said the cost to reach me (SW1)
! is 0, and then this switch SW2, added that advertised cost to its only local
! interface cost to get to 19 as the cost for this switch to reach the root
! bridge.
VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    32778
             Address     0019.060c.9080
             Cost        19
             Port        25 (FastEthernet0/23)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

! This part identifies the local switch STP information. If you compare the
! bridge ID of this switch, to the bridge ID of SW1 (the root switch), you
! will notice that the priority values are the same, but SW1's MAC address
! is slightly lower (".060c" is lower than ".0617"), and as a result has a lower
! Bridge ID, which caused
! SW1 to win the election for root bridge of the spanning tree for VLAN 10
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     0019.0617.6600
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

! This is the port forwarding/blocking information for SW2.   SW2 received
! BPDUs from root bridge on both 23 and 24, and so it knew there was a
! loop. It decided to block on port 24.   The cost was the same on both
! ports, and STP used the advertised port priority of the sending switch,
! and chose the lower value. In STP lower is always preferred.   By
! default, lower numbered physical ports, have lower numbered port
! priorities.
Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- ---------------------------
Fa0/2               Desg FWD 19        128.4    P2p
Fa0/23              Root FWD 19        128.25   P2p
Fa0/24              Altn BLK 19        128.26   P2p

! The blocking on port 24 is also reflected in the output of the show
! commands for trunking.   Notice that port 23 is forwarding for both
! VLAN 1 and 10, while port 24 is not forwarding for either VLAN.
SW2# show interfaces trunk

Port        Mode             Encapsulation  Status        Native vlan
Fa0/23      on               802.1Q         trunking      1
Fa0/24      on               802.1Q         trunking      1

Port        Vlans allowed on trunk
Fa0/23      1-4094
Fa0/24      1-4094

Port        Vlans allowed and active in management domain
Fa0/23      1,10
Fa0/24      1,10

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/23      1,10
Fa0/24      none


STP is on by default, and will have a separate instance for each VLAN. So, if you have five VLANs, you have five instances of STP. Cisco calls this default implementation Per-VLAN Spanning Tree Plus (PVST+).

STP consists of the following port states:

Image Root Port: The switch port that is closest to the root bridge in terms of STP path cost (that is, it receives the best BPDU on a switch) is considered the root port. All switches, other than the root bridge, contain one root port.

Image Designated: The switch port that can send the best BPDU for a particular VLAN on a switch is considered the designated port.

Image Nondesignated: These are switch ports that do not forward packets, so as to prevent the existence of loops within the networks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset