Hone

Lessons · Network switches · MAC ageing

The table forgets on purpose

A MAC address table entry is erased after a few minutes of silence from that address -- 300 seconds by default on a Cisco switch -- and learned again the instant the device speaks.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

Forgetting sounds like a flaw and is the feature. A laptop unplugged from one desk and plugged in at another would otherwise have its traffic sent to the port it left, for ever, until somebody cleared the table by hand.

How to think about it

Read an entry as 'this address was heard here recently', never as 'this device lives here'. The table is a record of what has been said lately, which is why it is right about a building that changes and would be wrong about one that does not.

Worked example

enable
The # prompt.
show mac address-table
Empty, on a switch with nothing plugged in, and that is the lesson in one screen: the table holds what has been HEARD, so silence means no entry rather than no device.
configure terminal
Switch(config)#.
interface gi0/5
Switch(config-if)#.
shutdown
The port goes down. On a real switch this is the moment the addresses learned there stop being true.
no shutdown
And back up. Nothing is relearned until something on the far end speaks, which is exactly what ageing does on a slower clock.
end
Switch#.
show mac address-table
Still what has been heard, not what is connected. A device that has said nothing since it was last aged out is simply not here yet.

Your turn

Show every address this switch has learned.

show  address-table

The trap

Reading an empty table as a broken switch. A port with nothing plugged in, or a device that has not spoken since it aged out, is simply not in it. Make the device talk and look again.

Next in Network switches

Every Network switches lesson on one page

Practise MAC ageing on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.