Watch on Instagram

Network Bytes · Episode 102 · CCNA 1.13

"MAC address aging"

A switch writes each MAC address it learns into its MAC address table with the port it came in on. Every dynamic entry has an aging timer that resets with each frame from that device; if the device stays quiet longer than the aging time (300 seconds by default on Cisco switches), the entry is deleted and frames to it are flooded until it talks again.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

What the switch writes down

A switch learns by listening. Whenever a frame arrives, the switch reads its source MAC address and writes a row into its MAC address table: this address lives on this port. Later, when a frame is addressed to that MAC, the switch sends it out only that one port instead of every port (EP28 covers learning and flooding).

Why entries can't last forever

Networks change. Laptops get unplugged, move to another desk or port, or just shut down. If the switch kept every row forever, old entries could point to the wrong port, and the table would fill up with devices that aren't there any more. So the switch needs a way to forget.

The sticky note with a timer

Think of each row as a sticky note that falls off if nobody touches it. Every dynamic entry has a timer:

  • Each time the device sends a frame, the switch sees its source MAC again and resets the timer to full.
  • If the device stays quiet for longer than the aging time, the entry is deleted.

That forgetting is called MAC address aging. A device that keeps talking never ages out; a device that goes silent eventually disappears from the table.

The Cisco default and the command to check it

On Cisco Catalyst switches the default aging time is 300 seconds. You can change it in global configuration mode with mac address-table aging-time <seconds>, and check it with show mac address-table aging-time.

To see the table itself:

`` Switch# show mac address-table Vlan Mac Address Type Ports 1 0011.22aa.0001 DYNAMIC Gi0/1 ``

DYNAMIC means the switch learned the entry from traffic, so it ages out. Entries you configure by hand show as STATIC and never age out.

What happens after an entry is deleted

Once the entry is gone, the switch no longer knows where that MAC lives. A frame addressed to it is now an unknown unicast, so the switch floods it out every other port in the VLAN. As soon as the device sends a frame again, the switch learns it afresh and its new entry starts with a full timer.

Try it yourself

In Cisco Packet Tracer (free with a Cisco Networking Academy account), connect two PCs to a switch and ping between them. On the switch's CLI run show mac address-table to see both entries appear as DYNAMIC, then run show mac address-table aging-time to see the timer setting. Stop pinging, check the table again now and then, and watch the entries disappear on their own.

Good to know

  • CCNA 1.13 covers switching concepts: MAC learning and aging, frame switching, frame flooding and the MAC address table.
  • Switches learn source MAC addresses; each dynamic entry's timer is refreshed whenever a frame from that source arrives.
  • Entries not refreshed within the aging time are removed.
  • The default aging time on Cisco Catalyst switches is 300 seconds; it is set with mac address-table aging-time <seconds>.
  • Static entries do not age out.
  • When a device moves to another port, the switch also updates its entry as soon as it hears a frame from the new port, so aging matters most for devices that go silent (the video simplifies this).
  • After removal, frames to that MAC are unknown unicast and are flooded in the VLAN until the device sends again.
  • Some platforms remove aged entries in periodic sweeps, so removal can lag the timer slightly.
  • "Sticky note" is the analogy.

For CCNA learners

CCNA exam topic 1.13 lists MAC learning and aging, frame switching, frame flooding and the MAC address table. Know that a switch learns from source addresses, that each frame refreshes the entry's timer, that the Cisco default aging time is 300 seconds, that static entries don't age, and that a frame to an unknown MAC is flooded.

Answer to the comment question

About 10:07. The default aging time is 300 seconds, which is 5 minutes. If the laptop's last frame is at 10:02 and it sends nothing more, its timer runs out about 5 minutes later, so the entry is removed at about 10:07 (some switches sweep the table periodically, which is why it's "about").

Test your knowledge

Quick quiz: "MAC address aging"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1What does a switch write into its MAC address table?
2What resets the aging timer of a dynamic entry?
3What happens to frames for a device after its entry has aged out?
4Which kind of MAC address table entry never ages out?

Sources

Video transcript

How long does a switch remember where your laptop is?

A switch writes each MAC address it learns into its table: this address, this port.

But devices move and unplug, so old entries could point to the wrong port.

So each entry has a timer, like a sticky note that falls off if nobody touches it. That's aging.

Each time the laptop sends a frame, its timer resets. If it stays quiet too long, the entry is deleted.

On Cisco switches, the default aging time is three hundred seconds. Check the table with show mac address-table.

Then frames to it get flooded until it talks again.

A laptop's last frame is at ten oh two. With the default timer, about when is it removed? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons