Let us say I have switch S with 4 ports, PA, PB, PC, and PD, to which I have connected 4 hosts, A, B, C and D with the MAC addresses AA:AA:AA:AA:AA:AA, BB:BB:BB:BB:BB:BB, CC:CC:CC:CC:CC:CC and DD:DD:DD:DD:DD:DD respectively, in the same order. Now let us say switch, S has got the MAC address table created after packets been transmitted between the host.
The MAC address table would look somewhat like this-
AA:AA:AA:AA:AA:AA -----> PA BB:BB:BB:BB:BB:BB -----> PB CC:CC:CC:CC:CC:CC -----> PC DD:DD:DD:DD:DD:DD -----> PD
Now let us say, i swap the hosts C and D. So after swapping, host C connects to port PD and host D connects to port PC. But the MAC address table with the switch remains the same; (assumption: there are no frames transmitted from either hosts, C and D to rebuild the MAC address table)
Now, if host A wants to send data to host C, then data transmitted by host A would reach the switch, S and then switch looks up its MAC address table and figures out that the destination MAC address in the frame is CC:CC:CC:CC:CC:CC (of host C) is connected to port PC and forwards the frame on its PC port. But once the frame reaches the host connected to port PC, which is host D (since we had swapped) would reject the frame. Since its NIC card compares its own MAC address DD:DD:DD:DD:DD:DD with that of the destination MAC address CC:CC:CC:CC:CC:CC. And packet would get dropped.
Please confirm me if my understanding of this scenario is correct.
Secondly, if the packet was reached to a wrong host and got dropped. And the source host things that i had sent the data to the intended host. How does this problem be addressed in networking.