Frame Tagging Explained
To identify the VLAN a packet is belonging to, switches use tagging to assign a numerical value to each frame in a network with multiple VLANs. This is done to ensure that switches know out which ports to forward frames.
For example, consider the following network topology.
![frame tagging](https://ozkanburgac.com/wp-content/uploads/2023/02/frame_tagging.webp)
There are two VLANs in the toplogy pictured above, namely VLAN 3 and VLAN 4. Host A sends a broadcast packet to switch SW1. Switch SW1 receives the packet, tags the packet with the VLAN ID of 3 and sends it to SW2. SW2 receives the packet, looks up at the VLAN ID, and forwards the packet only out the port Fa0/1, since only that port is in VLAN 3. Host B and host C will not receive the packet because they are in different VLAN than host A.
NOTE
When forwarding a tagged frame to a host device a switch will remove the VLAN tag, since host devices don’t understand tagging and would drop the packet.