Home > STP Questions

STP Questions

November 21st, 2019 Go to comments

Question 1

Explanation

If we want to view the spanning-tree status of a specific VLAN, use the “spanning-tree vlan ” command. An example of the output of this command is shown below:

show_spanning-tree_vlan_30.jpg

Question 2

Explanation

SW3 needs to block one of its ports to SW2 to avoid a bridging loop between the two switches. But how does SW3 select its blocked port? Well, the answer is based on the BPDUs it receives from SW2. A BPDU is superior than another if it has:
1. A lower Root Bridge ID
2. A lower path cost to the Root
3. A lower Sending Bridge ID
4. A lower Sending Port ID

These four parameters are examined in order. In this specific case, all the BPDUs sent by SW2 have the same Root Bridge ID, the same path cost to the Root and the same Sending Bridge ID. The only parameter left to select the best one is the Sending Port ID (Port ID = port priority + port index). The lower value of port priority, the higher priority that port has. Therefore we must change the port-priority on F1/1 to a lower value than that of Fa1/0. Zero is the lowest value we can assign to a port so we can assign this value to SW2 F1/1 and configure a higher value on Fa1/0. This is the command to complete this task:

SW2(config)#interface f1/1
SW2(config-if)#spanning-tree vlan port-priority 0

Note: If we don’t change the port priority, SW3 will compare port index values, which are unique to each port on the switch, and because Fa1/0 is inferior to Fa1/1, SW3 will select Fa1/0 as its root port and block the other port.

Question 3

Explanation

After powered on, the switches start sending BPDUs to elect a root bridge. A BPDU is superior than another if it has:

1. A lower Root Bridge ID
2. A lower path cost to the Root
3. A lower Sending Bridge ID
4. A lower Sending Port ID

From the output above, we learn that SW1 is the root bridge for VLAN 1 (from “this bridge is the root” line). SW1 has the “Bridge ID Priority” of 1 because SW1 has been configured with switch priority value of 0, which is also the lowest priority value (highest priority). This value is then added with the VLAN ID (VLAN 1 in this case) so the final value is 1.

Question 4

Explanation

After receiving BPDUs from upstream bridges, the switch add the STP cost of that port and choose the lowest value as its root port -> the STP cost of Fa0/21 is smallest so it is chosen as root port.

Question 5

Explanation

Portfast is often configured on switch ports that connect to hosts. Interfaces with Portfast enabled will go to forwarding state immediately without passing the listening and learning state. Therefore it can save about 30 to 45 seconds to transition through these states. To enable this feature, configure this command under interface mode:

Switch(config-if)#spanning-tree portfast

Question 6

Explanation

Although RSTP was configured on all ports but only edge-ports allow to run RSTP. RSTP cannot work on a trunk port. If we try to configure RSTP on a trunk port (support Fa0/24) we will receive this message:

%Warning: portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc… to this interface when portfast is enabled, can cause temporary bridging loops. Use with CAUTION

%Portfast has been configured on FastEthernet0/24 but will only have effect when the interface is in a non-trunking mode.

Question 7

Explanation

UplinkFast is a Cisco specific feature that improves the convergence time of the Spanning-Tree Protocol (STP) in the event of the failure of an uplink. The UplinkFast feature is designed to run in a switched environment when the switch has at least one alternate/backup root port (port in blocking state), that is why Cisco recommends that UplinkFast be enabled only for switches with blocked ports, typically at the access-layer.

For example in the topology below:

STP_simple.jpg

Suppose S1 is the root bridge in the topology above. S3 is connected to S1 via two paths: one direct path and another goes through S2. Suppose the port directly connected to S1 is root port -> port connected to S2 will be in Blocking state. If the primary link goes down, the blocked port will need about 50 seconds to move from Blocking -> Listening -> Learning -> Forwarding to be used.

To shorten the downtime, a feature called Uplink Fast can be used. When the primary (root) link fails, another blocked link can be brought up immediately for use. When UplinkFast is enabled, it is enabled for the entire switch and all VLANs. It cannot be enabled for individual VLANs.

Reference: http://www.cisco.com/c/en/us/support/docs/lan-switching/spanning-tree-protocol/10575-51.html

Question 8

Explanation

Every non-root bridge needs to elect a root port. The election of root port is as follows:

1) Based on lowest cost path to the root bridge
2) Then based on lowest upstream Bridge ID (Bridge ID = Bridge Priority + MAC)
3) Then based on lowest upstream Port ID (Port ID = Port Priority + Port Index)

Therefore we can use STP cost and port-priority to select the root port.

Question 9

Explanation

Portfast is often configured on switch ports that connect to hosts. Interfaces with Portfast enabled will go to forwarding state immediately without passing the listening and learning state. Therefore it can save about 30 to 45 seconds to transition through these states. To enable this feature, configure this command under interface mode:

Switch(config-if)#spanning-tree portfast

Question 10

Question 11

Explanation

If there are more than one connection between two switches, STP will automatically block one of them to prevent a loop. In particular, STP will block the link with higher priority value. Therefore if we want to force traffic to the secondary link we can lower the priority of the secondary link. For example:

Switch(config-if)#spanning-tree port-priority 48

Remember for switch (Layer 2 device), lower value is preferred over higher value. For router (Layer 3 device), higher value is preferred over lower value.

Question 12

Explanation

Spanning Tree Protocol elects a root bridge based on the Bridge IDs. The root bridge is the bridge with the lowest bridge ID. And Bridge ID = Bridge Priority + MAC Address. Therefore to prevent a switch from becoming the root bridge we can adjust STP priority to the maximum value.

Comments
  1. suntzu
    February 22nd, 2020

    Q6

    (config-if)#spanning-tree portfast edge trunk

    Works on a trunk port while in trunk mode.

  1. No trackbacks yet.