This question already has an answer here:
I've wondered how Ethernet packets sent from Laptop-A to Laptop-B on the local network segment are delivered, when multiple switches are in-between.
For hubs, that just replicates the packet on all outgoing network ports, the packet sent from Laptop-A will eventually reach Laptop-B. The same holds for ARP requests (broadcast), when multiple switches are in-between.
However, switches only send packets on a single outgoing network port, depending on the destination MAC address and its CAM table. But, Switch-A's CAM table only knows about devices connected directly to it, so it doesn't know anything about Laptop-B?
So, how does Switch-A know where to send traffic destined for the MAC address of Laptop-B?