How Cisco Switches Forward Frames

Step 1. Determines the VLAN in which the frame should be forwarded

a.) If the frame comes into the switch from an access port use that interface's access VLAN
b.) If the frame arrives on a trunk port use the VLAN that is contained in the trunk header

Step 2. Add the source MAC to the Switch's MAC Address table with the incoming VLAN ID

Step 3. Locate the destination MAC address of the frame in the MAC address table, but only entries from the same VLAN as the source.

a.) If a match is found then forward the frame out the port that matches and only that port.
b.) If no match is found forward the frame out all interfaces within that VLAN and out all trunk ports that list the VLAN as fully supported and active.

It's important to know that the VLAN data is learned from the incoming interface not from the MAC table or the destination. It is learned at the same time the source MAC is entered into the MAC Address table.