Route My World!

A CCNA/CCNP Blog

Archive for May 26th, 2009

BCMSN: Spanning Tree Protocol

Posted by Aragoen Celtdra on 26th May 2009

Transparent Bridge’s Basic Function

  • A bridge starts out without knowledge of devices in the network. It listens for frames that come into each of its ports.
    • A frame that arrives on individual ports carries the source MAC address of the device that sent it. The bridge then assumes that the device that sent this frame is located behind this port.
    • All other ports will be listening to other frames and the bridge builds a table that matches the MAC addresses with port numbers that these frames came in from.
    • The bridge constantly updates its MAC address table as new frames are received or as frames change locations frmo one port to another.
  • The bridge forwards frames by comparing the destination address with the information in the bridge table and forwarding the frame out the port that the bridge table has recorded.
    • Frames with a broadcast destination address is forwarded out all available ports, except the port the intially received the frame.
      • This is process of forwarding to all ports is called flooding
      • A bridge does not segent broadcast domains; only collision domains.
      • Frames whose destination address is unknown (unknown unicast) is treated as broadcast frame, therefore it’s flooded out all ports. When a reply to the unknown frame is heard back, it is learned by the bridge and added to the MAC address table.
  • Frames that are forwarded across the bridge is not modified by that bridge. This is the property that makes it transparent

Spanning Tree Protocol (802.1D)

  • Identifies and prevents bridging loops.
  • Enables switches to be aware fo each other and allow redundantly connected switches to negotiate a loop-free path through the network.
  • Discovers loops before they become available for use. Redundant links are effectively shut down to prevent the loops from forming.
  • STP  is communicated among all connected swithces on a network.

Bridge Identifier

  • Each switch is assigned a unique identifier called a bridge id.
  • A bridge id is made up of:
    • Priority value (2-bytes/16-bits)
      • Tthis is the priority or weight of a switch in relation to all other swiches.
      • It can have a value of 0 through 65,535.
      • The default value is 32,768 (or 0×8000 in hex/1000 0000 0000 0000 in binary).
    • MAC address (6-bytes)
      • The MAC adddress used by a switch can come from the Supervisor module, the backplane, or a pool of 1,024 addresses that are assigned to every supervisor or backplane, depending on the switch model.
      • This address is hard-coded and unique, and cannot be changed be the user.

Bridge Protocol Data Units (BPDUs)

  • BPDUs are sent by switches running STP to relay LAN topology information to other switches.
  • Initially, switches are not aware of other switches in the network, therefore frames are sent with a destination addrss of the the well-known STP mulitcast address 01-80-c2-00-00-00.
  • A switch uses the unique MAC address of the port where the BPDU frame is sent out off as its source address.
  • Switches running STP use BPDUs to:
    • Elect a root bridge
    • Determine the location of redundant paths
    • Block certain ports to prevent loops
    • Notify the network of topology changes
    • Monitor the state of spanning tree

 BPDU Types

  • Configuration BPDU
    • Originated by the root bridge and used for spanning-tree computation.
      • By generating the BPDU only at the root bridge, the STP bridges are guaranteed to have no mismatch in the timers.
    • Used to elect the root bridge.
    • Sent out all ports of the root bridge every 2 seconds.

BPDU Frame
bpdu-frame

BPDU Frame Format

 

Field (Bytes)

Description
Protocol ID (2) Always contains value of zero (0)
Version (1) STP version (802.1D version is 0)
Message Type (1) Type of BPDU

  • Configuration BPDU = 0×00
  • TCN BPDU = 0×80
Flags (1)
  • Least Significant Bit (LSB) = TC flag or Topology Change Notification (00000001).
  • Most Significant Bit (MSB) = TCA or Acknowledgment (10000000).
Root ID (8) Bridge ID of the root bridge
Root Path Cost (4) Contains the cost of the path from the bridge sending the configuration message to the root bridge.
Bridge ID (8) Priority and ID of the bridge sending the message.
Port ID (2) Identifies the port from which the configuration message was sent. This field allows loops created by multiple attached bridges to be detected and handled.
Message Age (2) Amount of time elapsed since root sent the BPDU. Each bridge increases the count by 1 – essentially a hop count to the root bridge.
Maximum Time (2)
  • The maximum time a bridge retains the root bridge ID before considering the root bridge as unavailable.
  • Indicates when the current configuration message should be deleted.

 

Hello Time (2) Time interval for subsequent BPDUs being sent from the root bridge.
Forward Delay (2) Time interval the bridge spends in each of the listening and learning STP states.
  • Topology Change Notification (TCN) BPDU
    • Generated by any switch when it detects a topolgy change.

 Topology Change Notification BPDU 
tcn-bpdu

STP Operation

I. Root Bridge Election

  • The root bridge is a point of reference that all switches use to determine loops in the network and agree on a loop-free topology.
  • When a switch powers up initially, it thinks of itself as the Root Bridge. All other switches make the same assumption of themselves on initial boot up.
  • The election process:
    • Every switch begins sending out BPDUs with a Root Bridge ID equal to its own Bridge ID and a Sender Bridge ID equal to its own Bridge ID as well
      • The Sender Bridge ID simply tells other switches who is the actual sender of the BPDU message.
    • Switches receive BPDUs sent by other switches and compare who has the better Bridge ID (bridge priority + MAC address) value. The lower the Bridge ID, the better.
      • If two Bridge Priorities are equal, the lower MAC address wins.
    • If a switch hears of a better bridge ID, its replaces its own Root Bridge ID with the better Root Bridge ID.
      • This bridge advertises the new (better) Root Bridge ID in its BPDU while still using its own Sender Bridge ID.
    • When the election converges, the switch with the best Bridge ID becomes the Root Bridge.
    • All ports on the Root Bridge act as designated ports.
      • Designated ports send and receive traffic as well as configuration messages (BPDUs).
    •  If a new switch is powered up on the network and it advertises a superior (lower) Bridge ID than the rest, it immediately takes over as the Root Bridge.

II. Root Port Election

  • This process elects one root port on each non-root bridge on the network.
  • The root port always points toward the current Root Bridge.
  • Root ports send and receive traffic.
  • The root port is the lowest-cost path from the non-root bridge to the root bridge.

Path Cost vs. Root Path Cost

  • Path Cost
    • A 1-byte value associated with a particular switch link speed.
      • For example: a 100 Mbps link has a Path cost of 19.
      • See chart below for STP Path Cost values.
    • It is not contained in the BPDU
    • It is known only to the local switch where the port resides.
  • Root Path Cost
    • This is the cumulative cost of all the links leading to the Root Bridge.
    • Only the root path cost is contained in the BPDU (remember: path cost is stays and known only the local switch).
    • The root path cost is determined as follows:
      1. The root bridge sends out a BPDU with a root path cost of 0 because its ports sit directly on the Root Bridge.
      2. When the next-closest neighbor receives the BPDU, it adds the path cost of its own port where the BPDU arrived. (This is done as the BPDU is received.)
      3. The neigbor sends out BPDUs with new cumulative value as the root path cost.
      4. The root path cost is incremented by the ingress port’s path cost as the BPDU is received at each switch along the way.
      5. Be aware that the root path cost is incremented only as BPDUs are received, not as they go out. Take this into account when computing the Spanning Tree Algorithm manually and computing a new root path cost.
    •  A switch stores the value of the root path cost in its memory. If a BPDU with a lower root path coast than its recorded value is received in another port, that port becomes the new root port.

STP Path Cost

Link Bandwidth

STP Cost

4 Mbps 250
10 Mbps 100          
16 Mbps 62
45 Mbps 39
100 Mbps 19
155 Mbps 14
622 Mbps 6
1 Gbps 4
10 Gbps 2

III. Designated Port Election

  •  On each segment where two or more switches have ports connected to a single common network link, only one of the links on that segment should forward traffic to and from that segment. That port is the Designated Port.
  • The designated port has the lowest path cost to the root bridge.
    • Switches choose a designated port based on the lowest cumulative rootp path cost to the root bridge.
  • In case of identical root path cost, resulting in a tie, the following criteria is used in the decision-making process (in order):
    1. Lowest root bridge ID
    2. Lowest root path cost to root bridge
    3. Lowest sender bridge ID
    4. Lowest port priority
    5. Lowest port ID

 

Electing a Designated Port
stp-bridging

  • In the diagram above, LAN segment V has 3 ports on that same link from each of the bridges: Bridge 5, 3, and 4. 
  • Immediately, we can assume that Bridge 3’s LAN V port cannot be the designated port because it has a higher cost (20)  than the other two.
  • Because Bridge 4 and Bridge 5 can reach the root bridge with a path cost of 10, they are considered a tie. In this case the Sender Bridge ID is used to determine which port becomes the designated port. Bridge 4 just happens to have the lower Bridge ID.
  • Bridge 4 is also the Designated Bridge of the LAN V segment. The designated switch is simply the one closest to the root switch through which frames are forwarded to the root.
  • The resulting outcome is that the segment V ports of Bridges 5 and 3 are blocked, and Bridge 4’s LAN V port is the only port allowed to forward frames.

STP States

The following describes the different states that switch ports go through during STP operation:

  • Disabled
    • This is not part of the STP operation, but it is a special state that a port could be in when the following conditions are true:
      • The port is administratively shut down.
      • The system puts it in the state due to a fault condition.
  • Blocking
    • When a port initializes, it remains in a blocking state so no loops can form.
    • In this state, a port cannot receive nor transmit frames.
    • It cannot learn MAC addresses
    • It can receive BPDUs.
    • Additionaly, ports that are put into standby mode to remove a bridging loop enter this state.
  • Listening
    • Duration: 15 seconds (forward delay period)
    • Still cannot receive or send data.
    • It can receive or send BPDUs. This allows the port to become either Root Port of Designated Port.
    • If it doesn’t stay on root port or designated port status, it goes to blocking state.
  • Learning
    • Duration: 15 seconds (forward delay period
    • After the Forward Delay period in the listening state, the port goes into learning state where it can start learning MAC addresses to add to the MAC address table.
    • Can send and receive BPDUs
    • Cannot yet send any data.
  • Forwarding
    • Fully functioning state.
    • Can now send and receive data.
    • Continues to collect MAC addresses in its address table.
    • Sends and receives BPDUs.

References:

  1. Internetworking Technology Handbook – Transparent Bridging
  2. Spanning-Tree Algorithm Frame Format
  3. Bridge Protocol Data Unit – Hill2dot0

This entry is not an authoritative guide. These are merely notes and rehash of the primary text materials and resources that I use. For a thorough guide of the BCMSN course, consider purchasing Building Cisco Multilayer Switched Networks (BCMSN) (Authorized Self-Study Guide) (4th Edition) by Richard Froom, Balaji Sivasubramanian, and Erum Frahim and CCNP BCMSN Official Exam Certification Guide (4th Edition) by Dave Hucaby ; as well as following the links on the reference section of this entry.

Posted in BCMSN Prep, CCNP, Spanning Tree | 2 Comments » | Print This Post

 

Route My World! is Digg proof thanks to caching by WP Super Cache