Sub topic 10
Topology changes and MAC table aging
This chapter assumes you know how a switch learns MAC addresses into its MAC table, how unknown-unicast frames are flooded, and how STP port states and roles work. It explains what happens to the MAC table when the spanning tree changes.
Why a topology change breaks the MAC table
A switch learns that a MAC address lives behind a port. The entry stays for the aging time, which is 300 seconds by default on Cisco IOS and on Linux bridges.
When a link fails and a blocked port starts forwarding, the path to many hosts changes. The old entries now point at the wrong ports. Frames sent to those hosts go into a dead path until the entries age out, which can take up to five minutes. Spanning tree has to shorten that delay.
Topology Change Notifications
Classic 802.1D handles this with a Topology Change Notification (TCN).
- A switch detects a topology change. In 802.1D this means a port moved to forwarding, or from forwarding or learning to blocking.
- It sends a TCN BPDU out its root port, repeating it every hello interval until acknowledged.
- The upstream designated bridge acknowledges it with the Topology Change Acknowledgment flag, and sends its own TCN toward the root.
- The root bridge sets the Topology Change (TC) flag in its configuration BPDUs for max age plus forward delay, which is 35 seconds with default timers.
- Every switch that receives these BPDUs reduces its MAC aging time to the forward delay, 15 seconds. Stale entries then expire quickly and are relearned.
Rapid STP behavior
Rapid STP (802.1w) changes the mechanism. Only a non-edge port that moves to forwarding counts as a topology change. A link going down does not. The switch that detects the change sends BPDUs with the TC flag out its other ports and its root port. It also flushes the MAC entries learned on its other ports right away. Neighbors that receive the flag do the same. This is faster than waiting 15 seconds, but it floods traffic briefly while the entries are relearned.
Edge ports never generate topology changes. This is why PortFast matters on host-facing ports. A host that reboots must not make every switch flush its table.
Checking for topology changes
show spanning-tree vlan 10 detail
show spanning-tree vlan 10 detail | include ieee|from|occurred|changesThe detail output shows the number of topology changes, the time since the last one, and the interface it came from. Run the command again on the switch named as the source until you reach the port that is flapping.
Common errors
- Raising the aging time to hide flooding. This leaves stale entries in place after real changes.
- Leaving PortFast off host ports, so every device that powers on triggers a change.
- Looking only at the local switch. The counter shows the change was received, so follow the "from" interface toward the source.
Exercise
A user's PC moved from one access port to another on a different switch. The old switch still holds the PC's MAC address on its old port, and no topology change occurred. How long can traffic to the PC fail, with default settings?
Show answer
Up to the default aging time of 300 seconds, unless the PC sends a frame that lets switches relearn its address sooner. A normal access-port link change on a PortFast port does not trigger a topology change, so the aging time is not shortened.