Virtual Local Area Network (VLAN)
A Virtual Local Area Network (VLAN) is a method to logically segment a single physical network switch into multiple independent networks. Operating at Layer 2 of the OSI model, VLANs improve network performance, security, and cost-efficiency by isolating devices into separate broadcast domains without requiring additional hardware.
Key Points
- VLANs create logical network segments on a single physical switch
- Each VLAN operates as an independent broadcast domain at Layer 2
- Devices in different VLANs cannot communicate directly without a Layer 3 device
- VLANs use MAC addresses to control traffic flow within the Data Link Layer
- IEEE 802.1Q is the industry standard for VLAN tagging
How VLANs Work
Logical Segmentation
VLANs divide a physical switch into multiple isolated networks. Even though devices share the same hardware, they behave as if connected to separate switches.
Example Configuration:
Physical Switch:
┌──────────────────┐
│ SWITCH │
└──────────────────┘
| | | |
PC1 PC2 PC3 PC4
Logical Equivalent:
VLAN 10 VLAN 20
┌───────────┐ ┌───────────┐
│ Switch A │ │ Switch B │
└───────────┘ └───────────┘
| | | |
PC1 PC2 PC3 PC4
In this setup:
- PC1 and PC2 (VLAN 10) can communicate directly
- PC3 and PC4 (VLAN 20) can communicate directly
- PC1 cannot communicate with PC3 without Layer 3 routing
Broadcast Domain Isolation
Without VLANs: A broadcast from any device floods the entire switch, reaching all connected devices.
With VLANs: Broadcasts are confined to the originating VLAN only.
Example: If PC1 sends a broadcast in VLAN 10, only PC2 receives it. PC3 and PC4 in VLAN 20 remain unaffected.
Essential VLAN Terminology
| Term | Definition |
|---|---|
| Access Port | Switch port assigned to a single VLAN, typically connected to end devices |
| Trunk Port | Switch port carrying traffic for multiple VLANs between switches or routers |
| Default VLAN | VLAN 1 on most switches; all ports belong here unless reconfigured |
| VLAN Tagging | Adding a VLAN ID to Ethernet frames using IEEE 802.1Q standard |
| Inter-VLAN Routing | Communication between VLANs requiring a Layer 3 device (router or Layer 3 switch) |
Why Use VLANs?
Performance Benefits
Reduced Broadcast Traffic: VLANs limit broadcast propagation to devices within the same VLAN.
- Without VLANs: 100 devices = 100 devices receive every broadcast
- With VLANs: 100 devices split into 5 VLANs = only 20 devices per broadcast
Improved Network Efficiency: Less unnecessary traffic reduces network congestion and improves overall performance.
Security Advantages
Logical Isolation: Devices in different VLANs cannot communicate at Layer 2 without explicit routing.
Use Case Example:
- Accounting department (VLAN 10)
- IT department (VLAN 20)
- Guest network (VLAN 30)
Without Layer 3 routing configured, accounting users cannot access IT resources, and guests remain isolated from internal networks.
Important: VLANs provide network segmentation but are not a substitute for firewalls. They do not enforce advanced security policies or inspect traffic content.
Cost and Scalability
Hardware Efficiency: One physical switch can host multiple logical networks.
- Traditional approach: Each subnet requires a separate physical switch
- VLAN approach: One switch serves multiple subnets
Reduced Complexity: Fewer switches mean less cabling, lower power consumption, and simplified management.
VLAN Communication Rules
Intra-VLAN Communication
Devices within the same VLAN communicate directly at Layer 2:
- No additional hardware required
- Standard switching based on MAC addresses
- Requires proper IP addressing within the same subnet
Inter-VLAN Communication
Devices in different VLANs cannot communicate at Layer 2:
- Requires a Layer 3 device (router or Layer 3 switch)
- Implemented through Inter-VLAN routing
- Common methods:
- Router with sub-interfaces (Router-on-a-Stick)
- Layer 3 switch with SVIs (Switched Virtual Interfaces)
VLAN Configuration Essentials
Default VLAN Behavior
Most switches (including Cisco) assign all ports to VLAN 1 by default:
- All devices share the same broadcast domain initially
- Creates a flat network without segmentation
- Security risk: Should be reconfigured for proper isolation
Best Practice: Reassign ports to appropriate VLANs and avoid using VLAN 1 for production traffic.
VLAN Tagging (IEEE 802.1Q)
Access Ports:
- Carry untagged traffic
- Assigned to a single VLAN
- Connected to end devices (PCs, printers, phones)
Trunk Ports:
- Carry tagged traffic for multiple VLANs
- Use 4-byte VLAN ID header
- Connect switches to switches or switches to routers
Practical Use Cases
Enterprise Network Segmentation
Departmental Isolation:
- HR: VLAN 10
- Finance: VLAN 20
- IT: VLAN 30
- Marketing: VLAN 40
Infrastructure Segmentation:
- Database servers: VLAN 50
- Web servers: VLAN 60
- VoIP phones: VLAN 70
Small Office/Home Office (SOHO)
Three-tier approach:
- VLAN 10: Employee devices (trusted)
- VLAN 20: Guest network (isolated from internal resources)
- VLAN 30: IoT devices (cameras, smart devices with limited access)
VLAN vs. No VLAN Comparison
| Feature | Without VLAN | With VLAN |
|---|---|---|
| Broadcast Scope | Entire switch | Per VLAN only |
| Network Isolation | None (flat network) | Logical segmentation |
| Hardware Requirements | One switch per subnet | One switch for multiple subnets |
| Inter-network Communication | Direct (same Layer 2) | Requires Layer 3 device |
| Security Posture | Low (no segmentation) | Improved (isolated domains) |
| Scalability | Limited by hardware | Highly scalable |
Common Mistakes to Avoid
Layer Confusion: VLANs operate at Layer 2 (Data Link), not Layer 3 (Network). They use MAC addresses, not IP addresses, for segmentation.
Security Overestimation: VLANs provide segmentation but do not replace firewalls, encryption, or access control lists.
Default VLAN Oversight: Forgetting that all ports start in VLAN 1 creates unintended connectivity and security vulnerabilities.
Inter-VLAN Assumptions: Devices in different VLANs cannot communicate without explicit Layer 3 routing configuration.
VLAN vs. Subnet Confusion: VLANs (Layer 2) and subnets (Layer 3) are different concepts. They often align in network design but serve different purposes.
Quick Reference
Key Takeaways
- VLANs logically segment physical switches into multiple Layer 2 networks
- Each VLAN is a separate broadcast domain, reducing network congestion
- Same VLAN = direct communication; Different VLANs = requires Layer 3 routing
- Benefits include improved performance