02-25-2023 11:32 AM
I understand VLAN creates a broadcast domain and L2 switch only fwd within the VLAN without an L3 device. However, how does the L2 switch knows which VLAN the frame needs to go without a dot1q Header?
For eg. I did a pcap and I don't see any VLAN ID or info on the ethernet header for access ports so when access ports send a broadcast or unicast how does the switch know which VLAN it's coming from and the other host is on the same VLAN?
02-27-2023 08:21 AM
Lastly, the other posters, and myself, have (correctly, I believe) provided the information to answer you original questions.
If still a bit unclear, perhaps if we discuss, for a moment, pre-VLAN capable switches.
To such pre-VLAN capable switches, all switch ports and all frames transiting the switch were part of the same LAN.
If you wanted multiple LANs, you would have multiple switches that DID NOT DIRECTLY INTERCONNECT. Those separate LAN switches, could be indirectly connected by routers, but the moment you connected one pre-VLAN switch to another, they joined the same L2 LAN.
VLANs were created as a nice way to share the same physical switch but still preserve separate L2 domains (as huge L2 domains have scaling problems).
A VLAN switch creates separate logical (or virtual) LANs by attaching a VLAN ID to distinguish between different L2 domains.
Externally, on shared (multiple L2 domains) media links, VLAN headers were added to the basic L2 frame, and the VLAN header has a VLAN ID.
On the switch itself, for links without using VLAN headers, we "somehow" inform the switch what VLAN such frames should be considered in or member of. The latter is often done by explicitly configurating a VLAN ID to assume, for untagged frames on a particular port.
Within the "innards" of the switch, "somehow" the switch has to associate what VLAN every frame is associated with or a member of. Again, how the "somehow" is actually accomplished, is dependent upon actual switch architecture. (Unless you're designing such hardware, we really don't know how the "how" is accomplished, just that it is.)
For a curve ball, I don't recall Cisco supporting what I also recall some other vendors can provide, such as traffic type VLANs. E.g. untagged traffic on a port, that looks like VoIP traffic, might be considered as a member of a different VLAN from other untagged traffic on the same port. (I.e. this would allow a VoIP phone and PC to share a port, in different VLANs, without the VoIP phone tagging frames. It also implies, the switch is examining the frame's contents beyond L2. [Which isn't unknown of for Cisco "L2" smart/enhanced switches, for example, analyzing L3 fields.])
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide