Calculation example

The following topology is used to illustrate an STP calculation. The priority values of Device A, Device B, and Device C are 0, 1, and 2, respectively. The path costs of links among the three devices are 5, 10, and 4.

Each configuration BPDU contains the following fields: root bridge ID, root path cost, designated bridge ID, and designated port ID.

  1. The initial state of the BPDUs on each device is:
    Device Port name Configuration BPDU on the port
    Device A Port A1 {0, 0, 0, Port A1}
    Port A2 {0, 0, 0, Port A2}
    Device B Port B1 {1, 0, 1, Port B1}
    Port B2 {1, 0, 1, Port B2}
    Device C Port C1 {2, 0, 2, Port C1}
    Port C2 {2, 0, 2, Port C2}
  2. BPDU comparison on each device occurs as follows:
    Device Comparison process Configuration BPDU on ports after comparison
    Device A

    Port A1 performs the following tasks:

    1. Receives the configuration BPDU of Port B1 {1, 0, 1, Port B1}.

    2. Determines that its existing configuration BPDU {0, 0, 0, Port A1} is superior to the received configuration BPDU.

    3. Discards the received one.

    Port A2 performs the following tasks:

    1. Receives the configuration BPDU of Port C1 {2, 0, 2, Port C1}.

    2. Determines that its existing configuration BPDU {0, 0, 0, Port A2} is superior to the received configuration BPDU.

    3. Discards the received one.

    Device A determines that it is both the root bridge and designated bridge in the configuration BPDUs of all its ports. It considers itself as the root bridge. It does not change the configuration BPDU of any port and starts to periodically send configuration BPDUs.

    • Port A1: {0, 0, 0, Port A1}
    • Port A2: {0, 0, 0, Port A2}
    Device B

    Port B1 performs the following tasks:

    1. Receives the configuration BPDU of Port A1 {0, 0, 0, Port A1}.

    2. Determines that the received configuration BPDU is superior to its existing configuration BPDU {1, 0, 1, Port B1}.

    3. Updates its configuration BPDU.

    Port B2 performs the following tasks:

    1. Receives the configuration BPDU of Port C2 {2, 0, 2, Port C2}.

    2. Determines that its existing configuration BPDU {1, 0, 1,Port B2} is superior to the received configuration BPDU.

    3. Discards the received BPDU.

    • Port B1: {0, 0, 0, Port A1}
    • Port B2: {1, 0, 1, Port B2}

    Device B performs the following tasks:

    1. Compares the configuration BPDUs of all its ports.

    2. Decides that the configuration BPDU of Port B1 is the optimum.

    3. Selects Port B1 as the root port with the configuration BPDU unchanged.

    Based on the configuration BPDU and path cost of the root port, Device B calculates a designated port configuration BPDU for Port B2 {0, 5, 1, Port B2}. Device B compares it with the existing configuration BPDU of Port B2 {1, 0, 1, Port B2}.

    Device B determines that the calculated one is superior, and determines that Port B2 is the designated port. It replaces the configuration BPDU on Port B2 with the calculated one, and periodically sends the calculated configuration BPDU.

    • Root port (Port B1): {0, 0, 0, Port A1}
    • Designated port (Port B2): {0, 5, 1, Port B2}
    Device C

    Port C1 performs the following tasks:

    1. Receives the configuration BPDU of Port A2 {0, 0, 0, Port A2}.

    2. Determines that the received configuration BPDU is superior to its existing configuration BPDU {2, 0, 2, Port C1}.

    3. Updates its configuration BPDU.

    Port C2 performs the following tasks:

    1. Receives the original configuration BPDU of Port B2 {1, 0,1, Port B2}.

    2. Determines that the received configuration BPDU is superior to the existing configuration BPDU {2, 0, 2, Port C2}.

    3. Updates its configuration BPDU.

    • Port C1: {0, 0, 0, Port A2}
    • Port C2: {1, 0, 1, Port B2}

    Device C performs the following tasks:

    1. Compares the configuration BPDUs of all its ports.

    2. Decides that the configuration BPDU of Port C1 is the optimum.

    3. Selects Port C1 as the root port with the configuration BPDU unchanged.

    Based on the configuration BPDU and path cost of the root port, Device C calculates the configuration BPDU of Port C2 {0, 10, 2, Port C2}. Device C compares it with the existing configuration BPDU of Port C2 {1, 0, 1, Port B2}.

    Device C determines that the calculated configuration BPDU is superior to the existing one, selects Port C2 as the designated port, and replaces the configuration BPDU of Port C2 with the calculated one.

    • Root port (Port C1): {0, 0, 0, Port A2}
    • Designated port (Port C2): {0, 10, 2, Port C2}

    Port C2 performs the following tasks:

    1. Receives the configuration BPDU of Port B2 {0, 5, 1, Port B2}.

    2. Determines that the received configuration BPDU is superior to its existing configuration BPDU {0, 10, 2, Port C2}.

    3. Updates its configuration BPDU.

    Port C1 performs the following tasks:

    1. Receives a periodic configuration BPDU {0, 0, 0, Port A2} from Port A2.

    2. Determines that it is the same as the existing configuration BPDU.

    3. Discards the received BPDU.

    • Port C1: {0, 0, 0, Port A2}
    • Port C2: {0, 5, 1, Port B2}

    Device C determines that the root path cost of Port C1 (10) (root path cost of the received configuration BPDU (0) plus path cost of Port C1 (10)) is larger than that of Port C2 (9) (root path cost of the received configuration BPDU (5) plus path cost of Port C2 (4)). Device C determines that the configuration BPDU of Port C2 is the optimum, and selects Port C2 as the root port with the configuration BPDU unchanged.

    Based on the configuration BPDU and path cost of the root port, Device C performs the following tasks:

    1. Calculates a designated port configuration BPDU for Port C1 {0, 9, 2, Port C1}.
    2. Compares it with the existing configuration BPDU of Port C1 {0, 0, 0, Port A2}.

    3. Determines that the existing configuration BPDU is superior to the calculated one and blocks Port C1 with the configuration BPDU unchanged.

    Port C1 does not forward data until a new event triggers a spanning tree calculation process: for example, the link between Device B and Device C is down.

    • Blocked port (Port C1): {0, 0, 0, Port A2}
    • Root port (Port C2): {0, 5, 1, Port B2}
  3. After the comparison, a spanning tree with Device A as the root bridge is established as shown: