I have found some information about switch MAC table here: How does a switch learn a switch table? . There is explained how switch learns MAC addresses but what happens when I manipulate cables? What happens when I disconnect one cable? What happens when I disconnect one cable and I will connect it to another port?
Asked
Active
Viewed 4,797 times
1 Answers
2
The entry in the switch mac table has a timestamp and all records have a lifetime. (300 seconds is a common value but it can be another value, and it may be configurable, depending on the switch vendor / model / software version).
So when you disconnect a device, the entry will be removed after some times.
Additionally some switches will immediately remove all entries listing a port if this port goes down.
A switch will keep a single entry for a given mac address, and if needed update it. So if you move a device from one port to another, when the device will sent a frame, the switch will update the mac table with the new port.
Things become more complex when you have many switches interconnected.

JFL
- 19,649
- 1
- 32
- 64
switch -- hub -- PC
and you disconnect the hub from the switch, and reconnect it to a different port, then the PC does not see a link-down/link-up, so there will be no DHCP or GARP and so there is indeed a potential for that host to be unreachable until the mac aging timer on the switch expires (if there also is no other traffic like NTP or mDNS, or ...) – hertitu Sep 29 '16 at 13:11