Virtual Local Area Networks (VLANs)
1. Concept and Motivation of VLANs
A Virtual Local Area Network (VLAN) is a logical subnetwork that groups together a collection of devices from different physical LAN segments into a single broadcast domain, regardless of their physical location.
Key Motivations:
- Broadcast Containment: Broadcast traffic from one department (e.g., ARP, DHCP) does not flood users in other departments.
- Security: Logical isolation prevents unauthorized eavesdropping between sensitive subnets (e.g., Finance isolated from Guest Wi-Fi).
- Cost Reduction & Flexibility: Eliminates the need to run separate physical switches and cables when teams relocate within a building.
2. VLAN Membership Types
Switches assign switch ports to VLANs using several mechanisms:
- Port-Based (Static VLAN):
- Network administrator manually assigns physical ports to a specific VLAN ID (e.g., Ports 1–8 = VLAN 10, Ports 9–16 = VLAN 20).
- Most common, secure, and easiest to manage.
- MAC Address-Based (Dynamic VLAN):
- Membership is based on the 48-bit MAC address of the connected host. If a user moves their laptop to a different desk/port, the switch automatically assigns that port to the user's VLAN.
- Protocol-Based:
- Packets are segregated into VLANs based on the protocol carried in the Layer 3 header (e.g., IPv4 vs IPv6 vs IPX).
- IP Subnet-Based:
- Frames are assigned to VLANs based on the sender's Layer 3 IP subnet.
3. Trunking and IEEE 802.1Q Frame Tagging
When VLAN traffic must traverse across multiple interconnected switches, a Trunk Link is used.
- Access Port: Carries traffic for only one specific VLAN. Frames sent to end-user workstations are standard Ethernet frames (untagged).
- Trunk Port: Carries traffic for multiple VLANs simultaneously between switches or between a switch and a router.
IEEE 802.1Q Frame Format:
The IEEE 802.1Q standard inserts a 4-byte VLAN Tag into the standard Ethernet frame between the Source MAC Address and the Length/Type field:
- TPID (Tag Protocol Identifier - 2 bytes): Fixed value
0x8100identifying the frame as 802.1Q-tagged. - TCI (Tag Control Information - 2 bytes):
- Priority (3 bits): Quality of Service (QoS / 802.1p) marking 8 priority levels (0 to 7) for voice/video.
- DEI (Drop Eligible Indicator - 1 bit): May be dropped during network congestion.
- VID (VLAN Identifier - 12 bits): Identifies the VLAN ( possible VLANs, values usable).
4. Inter-VLAN Routing
Because each VLAN is an independent Layer 2 broadcast domain and logical subnet, devices in different VLANs cannot communicate without a Layer 3 routing device.
- Router-on-a-Stick:
- A single physical trunk cable connects the switch to a router interface.
- The router configures logical sub-interfaces (e.g.,
Gig0/0.10andGig0/0.20), routing traffic between VLANs across the trunk.
- Layer 3 Switch (Multilayer Switch):
- Modern enterprise solution that performs Inter-VLAN routing at internal backplane wire speed using SVIs (Switch Virtual Interfaces) without an external router.
Frequently Asked Questions
QWhat is the difference between an Access Port and a Trunk Port?
- An Access port belongs to a single VLAN and sends untagged standard frames to end hosts.
- A Trunk port interconnects switches or routers, carrying multiplexed traffic for multiple VLANs tagged with IEEE 802.1Q headers.
QHow many VLANs can be identified in IEEE 802.1Q and why?
Up to () VLANs, because the VLAN Identifier (VID) field in the 802.1Q tag is 12 bits wide (VLAN 0 and 4095 are reserved).
QCan hosts in different VLANs communicate without a router?
No. VLANs provide strict Layer 2 broadcast isolation. Passing packets between different VLANs requires a Layer 3 device (Router or Multilayer Switch).
QWhat is router-on-a-stick?
A single trunk link connects a switch to one router interface. The router uses logical sub-interfaces (e.g., Gig0/0.10, Gig0/0.20), one per VLAN, to route traffic between VLANs.