1

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?

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.

  • Thank you for your answer. Now I think that I understand it but imagine this situation: I move device from one port to another, old record is still in table because it hadn't reached lifetime yet and new record was not created because device hadn't sent anything yet. If now switch receives massage for this device it will be forwarded to a wrong port. Am I wrong? – John R. Sep 29 '16 at 12:14
  • @JohnR. Usually when a link comes up the device will send some traffic almost immediately, e.g. DHCP or gratuitous ARP, so "device hadn't sent anything yet" is unlikely to occur. Unlikely but not impossible; e.g. if you have 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
  • Mac-address table and arp-cache are located on the RAM, so, once switch is turned off, all info disappear. – Orlando Gaetano Sep 29 '16 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.