Sub topic 3
When a Host Moves: Updates and MAC Flapping
Assume you know what a MAC address, Ethernet frame, VLAN, and switch port are. This chapter focuses on how a switch reacts when its learned information changes.
Host moves and MAC flapping
A switch learns a source MAC address from the port where a frame arrives. If the same address later arrives on another port, the switch updates the entry immediately.
For example, if 00:00:00:00:00:0a moves from port 1 to port 3, the table changes from:
| MAC address | Port |
|---|---|
| 00:00:00:00:00:0a | 1 |
to:
| MAC address | Port |
|---|---|
| 00:00:00:00:00:0a | 3 |
This is normal when a device moves. MAC flapping occurs when the same address repeatedly appears on different ports. Common causes include a switching loop, incorrect cabling, a bridged wireless device, or a host connected through two paths.
Inspecting the table
Cisco IOS-style switches display the VLAN, address, entry type, and port:
Switch# show mac address-table
Switch# show mac address-table aging-timeOn a Linux bridge, inspect the forwarding database:
bridge fdb show br br0Look for entries that change ports unexpectedly, or entries marked as permanent instead of dynamically learned.
VLANs and multiple switches
Learning is normally per VLAN. The same MAC address can appear once in VLAN 10 and once in VLAN 20 because those are separate Layer 2 networks.
An uplink or trunk can have many remote MAC addresses behind one local port. The switch therefore records each remote address against the same uplink port. It does not need to know the final physical port until the next switch makes its own forwarding decision.
Table limits and protection
A switch has finite memory for dynamic MAC entries. An attacker can send frames with many false source addresses, filling this memory. The switch may then flood unknown destinations, increasing traffic exposure. This is called a MAC flooding attack.
Static MAC entries do not age out. Port security can also limit the number of learned addresses on an access port and reject or restrict unexpected addresses.
Topology changes
When spanning tree detects a topology change, a switch may flush dynamic entries or reduce their aging time. The switch then relearns addresses along the new paths. Temporary flooding is expected while this relearning occurs.
Exercise
A switch learns Host A on port 2. Later, frames from A arrive alternately on ports 2 and 5. What does this indicate?
Show answer
The switch updates the entry each time, causing MAC flapping. Investigate a loop, duplicate connection, or another Layer 2 path.