A third cable for a three-switch office
An office has three switches, connected in a line: SW2 – SW1 – SW3. If one cable breaks, part of the office is cut off. So the designer adds a third cable, SW2 – SW3. Now the switches form a triangle. Any one cable can break, and every switch can still reach every other switch.
This is called redundancy: a spare path that takes over when the main one fails. For example, each access switch has two uplinks, and there are two core switches. But redundancy causes a big problem for Ethernet.
Learn more: LAN Switching with Redundant Links
What the switches normally learn
PC A connects to SW2 and PC B connects to SW3. For this lesson both PCs are in VLAN 10, one logical Layer 2 network carried across the switch links. PC A is 192.168.10.10/24 and PC B is 192.168.10.20/24. They are in the same IP subnet, so the exchange does not need a router or a default gateway.
An Ethernet frame carries a source and destination MAC address, the link-layer addresses used by switches. When SW2 receives a frame from PC A, it learns PC A's source MAC on the receiving port in VLAN 10. This entry goes into the MAC address table. Learning uses the source address; the destination address determines where the frame goes next.
If the destination MAC is known, the switch can choose its learned port. An unknown unicast is addressed to one device whose port has not been learned. The switch floods it to the other eligible forwarding ports in the same VLAN. A broadcast is intended for all devices in that VLAN and is flooded too.
One ARP request, flooded round the triangle
PC A needs PC B's MAC address before sending its local IPv4 packet. ARP (Address Resolution Protocol) asks which MAC belongs to 192.168.10.20. The request is an Ethernet broadcast to ff:ff:ff:ff:ff:ff. The animation deliberately shows the faulty case: all three sides forward for VLAN 10, with no effective spanning-tree protection.
Device key: SW1, SW2, SW3 (switch) · PC A, PC B (computer)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
- 1. One frame. PC A sends one broadcast.
- 2. Flooded. SW2 copies the broadcast to its other forwarding ports in VLAN 10: one copy to SW1 and one to SW3.
- 3. Flooded again. SW1 sends its copy on to SW3. SW3 sends its copy on to SW1 (and to PC B).
- 4. Back where it started. Copies return to SW2 on different links and are flooded again. Ethernet has no hop counter to end this loop.
No TTL in an Ethernet frame
An IP packet has a TTL (time to live) number. Every router lowers it by one. When it reaches zero, the packet is thrown away. So a packet stuck in a routing loop dies after a while. An Ethernet frame has no TTL. Switches pass it on without reducing the IP TTL inside it. A looping copy may eventually be lost because of congestion or an error, but Ethernet supplies no hop limit to make the loop safe.
Storms, MAC flapping and duplicate frames
| Problem | What you see | Why |
|---|---|---|
| Broadcast storm | High link use, discarded frames, slow services and possibly loss of management access | Every switch copies every broadcast again and again. New broadcasts keep adding more. |
| MAC table instability | The same MAC address keeps jumping between ports ("MAC flapping"), and the switch logs it | Copies of PC A's frame arrive on different ports, so the switch keeps changing its mind about where PC A is |
| Duplicate frames | Hosts receive the same unicast frame several times | A frame for an unknown MAC address is flooded around the loop and arrives more than once |
Warning: a broadcast storm can stop a whole network within seconds. It can happen very easily: for example, someone plugs both ends of one cable into the same switch, or connects two wall sockets together.
In practice, MAC flapping messages in the switch log (%SW_MATM-4-MACFLAP_NOTIF on many Cisco switches) are often the first clue that a loop exists.
The switch relearns a source MAC whenever a frame with that source arrives on a different port in the VLAN. If returning copies arrive through both uplinks, the source appears to move even though PC A is still at its desk. MAC flapping describes that repeated movement. It is evidence to investigate, not proof by itself: legitimate mobility and some multihoming faults can also move an address.
Keeping the spare links without the loops
You want the spare links, so the network survives a broken cable. You also want no loops, so the network stays stable. Spanning Tree Protocol (STP) gives you both. All the cables stay connected, but STP prevents selected ports from forwarding user frames for the relevant tree. It does not administratively shut those interfaces. The next lesson follows the protected triangle.
Short lab: observe protection without creating a storm
Use an isolated three-switch Cisco IOS/IOS XE lab with spanning tree enabled and VLAN 10 already carried on all three links. Keep its protection enabled throughout. Verify the mode rather than assuming a factory default; PVST+, Rapid PVST+ and MST are different supported designs.
The root bridge is the reference switch elected for this tree. A root port leads towards it. An RSTP alternate port offers another path towards it but does not currently forward user frames. The next two lessons show how those choices are made.
show spanning-tree summary
show spanning-tree vlan 10
show mac address-table dynamic vlan 10Privileged EXEC on each lab switch. Check the active mode, VLAN 10's forwarding/non-forwarding ports and the learned source MAC addresses.
SW3#show spanning-tree vlan 10 Interface Role Sts Cost Prio.Nbr Type Gi1/0/1 Root FWD 4 128.1 P2p Gi1/0/2 Altn BLK 4 128.2 P2p
Send a few pings from PC A to PC B. Inspect the MAC table again and identify PC A on the expected port. If you cannot identify a protected, non-forwarding side of the triangle for VLAN 10, stop the traffic and verify the lab configuration before adding more traffic. Do not disable STP or BPDU processing to reproduce the animation.
Test yourself on switching loops
Why does a packet caught in a routing loop eventually die, while a frame in a switching loop doesn't?
PC A's ARP broadcast arrives on SW2 in VLAN 10. Where is it normally flooded?
A switch logs that PC A's MAC address keeps moving between Gi1/0/1 and Gi1/0/2. What's the most likely cause?
Sources: Cisco spanning-tree behaviour and verification; IEEE MAC bridging background. The deliberately unprotected animation is an explanation, not an instruction to disable loop protection.