Sub topic 10
How Spanning Tree Sees a Port Channel
This chapter assumes you know what a Layer 2 loop is, why Spanning Tree Protocol (STP) blocks redundant paths, and how VLANs and trunks work. It also assumes you have seen the basic port channel configuration from earlier chapters.
The core idea: one logical port
STP prevents loops by blocking redundant links. If two switches were connected by two ordinary parallel cables, STP would see a loop. It would put one cable in the blocking state, and you would get the bandwidth of only one link.
A port channel avoids this. STP does not run on each physical member. It runs on the logical port-channel interface. The bundle looks like one link, so there is no loop between the two switches, and all members can forward at once.
This has several consequences:
- STP sends and receives Bridge Protocol Data Units (BPDUs) on the logical interface. On most platforms the BPDU leaves through one member link, chosen by the same hashing mechanism as data frames.
- The port channel has one STP state per VLAN (or per instance). Members do not have their own states. They are either bundled and forwarding as part of the channel, or not bundled.
- The port channel has one port role (root, designated, alternate, or backup) and one cost.
- The bundle is as reliable as its logical port. If one member fails, STP does not see a topology change, as long as the bundle stays up.
Path cost of a port channel
STP chooses the root path and the forwarding topology by comparing path costs. The cost of a port channel depends on the platform and on the STP version.
With the classic short cost method, a single 1 Gbps link has a cost of 4. A 2 Gbps bundle has a cost of 3 on some platforms that compute cost from the combined bandwidth. Other platforms keep the cost of a single member. Check what your platform does before you rely on it.
The common IEEE 802.1D-1998 cost values are:
| Link speed | Short (802.1D-1998) cost | Long (802.1t) cost |
|---|---|---|
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps | 19 | 200,000 |
| 1 Gbps | 4 | 20,000 |
| 10 Gbps | 2 | 2,000 |
The short method cannot tell a 10 Gbps link from a 40 Gbps or 100 Gbps one. If you use port channels with many fast members, use the long cost method (on Cisco IOS, spanning-tree pathcost method long) so the costs differentiate the speeds.
On Cisco switches, the port channel cost is also affected by the number of active members. When a member fails, the bundle's bandwidth falls and its cost can rise. This can change the STP result. Another path might become better than the degraded bundle, which triggers a reconvergence. Setting an explicit cost on the Port-channel interface removes that surprise:
interface Port-channel1
spanning-tree cost 1000What STP settings belong where
Configure STP settings on the Port-channel interface, not on the members. The switch copies the logical interface's configuration to the members. Settings applied only to a member can cause a mismatch and keep it from bundling.
Settings you commonly place on the port channel include:
spanning-tree portfastorspanning-tree portfast trunkfor a channel to a server.spanning-tree guard rootorspanning-tree bpduguard enable, where appropriate.spanning-tree costandspanning-tree vlan N port-priority.
Keep the STP mode and the allowed VLAN list the same on both sides. Mismatched trunk settings are covered in the chapter on member requirements. They matter here because a mismatch can silently shrink the set of VLANs that STP sees on the bundle.
Why a bundle state change matters to STP
Link aggregation protects against a single link failure in two ways.
- If the bundle has several members and one fails, the port channel stays up. STP does not recompute. Traffic that was hashed onto the failed member moves to the surviving members.
- If the last member fails, or the number of active members falls below the configured minimum, the port channel goes down. STP then sees a link failure and reconverges.
Because of the first case, you can lose a physical link without STP noticing at all. Monitoring must therefore track member state, not just the port channel state. A bundle that has quietly dropped from four members to one still shows up.
The danger of a member that is not bundled
STP protects you only when the logical port is a single, consistent object. Problems appear when the two sides disagree about whether a link is bundled.
Consider static (mode on) bundling. Switch A treats two ports as a bundle. Switch B treats them as separate ports. B's STP runs on each port separately. A sends BPDUs from the logical port out of one member, and B sees them on only one of its ports. B then believes the second link carries no BPDUs from the root. B can put that port in forwarding. Traffic from B arrives at A on both links, and frames can loop. This is a real loop, and STP did not catch it.
With LACP, the mismatch is detected. A member that does not receive LACP from its partner is not added to the bundle. It becomes an individual port, or it is suspended, depending on the platform and the lacp suspend-individual behavior. This is the main safety advantage of LACP over static bundling for STP.
Individual and suspended ports
On Cisco IOS, a port that cannot negotiate with its partner might go into the individual state (I in show etherchannel summary). It then works as an ordinary port with its own STP state. This is fine for servers that boot with a single active NIC, because it lets the server reach the network before the LACP agent starts. For switch-to-switch links it can be dangerous, because two individual ports toward the same neighbor look like a loop to STP.
The suspend-individual behavior addresses this. When it is on, a port that receives no LACPDUs is put in the suspended state (s) and does not forward. For server-facing ports, where you want a link to work before LACP starts, use no lacp suspend-individual. This is the common setting for server-facing ports when a server needs PXE boot. Switch-to-switch ports should keep the default.
Verifying what STP sees
Use these commands to check what STP is doing with the bundle:
show spanning-tree interface Port-channel1
show spanning-tree vlan 10
show etherchannel summaryIn show spanning-tree vlan 10 you should see Po1 in the list of ports with a role and a state. You should not see Gi0/1 or Gi0/2 there, because those are bundled. If you see the physical members listed, they are not part of the channel.
Look at these fields:
- Role and Status: the role (Root, Desg, Altn) and the state (FWD, BLK) of Po1.
- Cost: confirm it matches the value you expect after a member failure.
- Type:
P2pindicates the port channel runs in full duplex, which Rapid STP needs for fast transitions.
Common mistakes
- Configuring STP on members. The setting is ignored or causes a mismatch. Configure the Port-channel interface.
- Short path cost with fast bundles. Costs do not differentiate speeds. Use the long method on all switches in the domain.
- Cost changes on member loss. A degraded bundle can lose the root path to a different link. Fix the cost explicitly.
- Static bundling on one side only. This can create a loop that STP cannot see.
- Treating
upas healthy. A port channel with one remaining member is up but has lost redundancy and capacity.
Exercise
Switch A and switch B are connected by two cables. Switch A is configured with channel-group 1 mode on. Switch B has no channel group on those ports. Explain what STP on each switch sees, and why moving both sides to LACP would be safer.
Show answer
Switch A runs STP on one logical port and sends its BPDUs out of only one member. Switch B runs STP on each physical port separately and receives BPDUs on only one of them, so it does not see a loop between the two cables and may forward on both. Frames can then circulate between the two switches. With LACP, A sends LACPDUs and B does not answer, so A does not bundle the members (they stay individual or suspended). With LACP on both sides, the members bundle only when both sides agree, so STP sees one consistent logical link.
Exercise
A four-member port channel to the root switch loses two members. The port channel stays up, but users report that some VLANs now take a different path. Give one likely STP-related cause and one way to prevent it.
Show answer
The bundle's STP cost rose when its bandwidth dropped, so another path became cheaper and STP reconverged to it. To prevent this, set an explicit cost on the Port-channel interface with spanning-tree cost, and set a minimum number of active links so the bundle goes down in a controlled way instead of lingering in a degraded state.