This topic explains how Spanning Tree port priority and path cost settings determine which switch port is placed in the forwarding or blocking state when a loop occurs, and describes how these values influence interface selection.
Port priority and path cost help the STP determine the forwarding and blocking state of switch ports during a network loop.
-
Port priority: Determines the preference of an interface for forwarding state selection. Lower numerical values have higher priority.
-
Path cost: Represents the interface cost, usually based on media speed. Lower values are preferred for forwarding.
-
If all interfaces have the same priority or cost, Spanning Tree selects the interface with the lowest interface number for forwarding. The remaining interfaces are blocked.
Port priority, path cost, and Spanning Tree
Spanning tree uses port priority and path cost to control port states during network loops.
-
The spanning-tree port priority value shows where the port is in the network and whether it should pass traffic.
-
The path cost value is based on the interface’s media speed and affects which interface is chosen for forwarding.
-
Assign a higher port priority (lower value) to interfaces you want selected first.
-
Assign lower path cost values to interfaces you want selected first.
-
Port priority: Assigning higher priority (lower value) makes it more likely the interface will be selected for forwarding.
-
Path cost: Assigning lower cost values increases the likelihood of an interface being selected for forwarding.
| Attribute |
Port priority |
Path cost |
|---|---|---|
| Default value |
128 |
Based on media speed |
| Selection criteria |
Lower value preferred |
Lower value preferred |
The short path cost method is the default STP path cost method.
If your switch is a member of a switch stack, assign lower cost values to interfaces you want selected first. Avoid adjusting port priority in this situation.
By default, the switch sends keepalive messages only on interfaces without SFP modules. You can change this by entering the [no] keepalive interface configuration command.
Port priority and path cost selection
If two interfaces have the same port priority and path cost, the interface with the lowest interface number is placed in the forwarding state. The other interface is blocked.