← Module 02 · Layer 2: Data Link

VLANs & 802.1Q Trunking

One physical switch, split into several logical networks that can't hear each other's broadcasts, without running separate cabling for each one.

Why split one switch into several networks

An earlier topic (Collision Domain vs Broadcast Domain) covered why keeping broadcast domains small matters. The obvious way to get multiple broadcast domains is multiple physical switches, one per department. That's expensive and inflexible: move someone to a new team and you're re-cabling a desk.

A VLAN (Virtual LAN) gets the same isolation in software. It's like one office building where every floor has its own badge-access elevator bank: everyone shares the same building and wiring, but Finance's badge doesn't open Engineering's floor, and an announcement made on one floor doesn't play on another. A switch can have VLAN 10 on some ports and VLAN 20 on others, and traffic between them stays fully separated unless something at Layer 3 deliberately connects them.

Access ports vs. trunk ports

The 802.1Q tag

802.1Q defines a 4-byte tag inserted into the Ethernet frame right after the source MAC (Media Access Control) address. It carries a 12-bit VLAN ID, giving room for VLANs 1 through 4094.

Dest / Src MAC 802.1Q Tag TPID 0x8100 · PCP · VLAN ID Type Payload + FCS 12 bits of that tag are the VLAN ID: 1 to 4094 Access ports strip this tag off before it reaches the end device
The 802.1Q tag rides between the MAC addresses and the rest of the frame. End devices on access ports never see it.
Access PortTrunk Port
VLANs carriedExactly oneMultiple, distinguished by 802.1Q tag
Typical useEnd device (PC, phone, printer)Switch-to-switch or switch-to-router link
Frames sentUntaggedTagged (except the native VLAN)
A COMMON DEFAULT WORTH CHANGING

Every switch ships with all ports in VLAN 1 by default. Leaving management and user traffic sitting on VLAN 1 unmodified is a common early misconfiguration. Most real deployments move active traffic onto explicitly created VLANs and treat VLAN 1 as unused. The next topic, native VLANs, explains one specific reason why.