VLAN Basics
- User
VLAN Basics
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
VLAN Basics
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Virtual LANs (VLANs) slice one physical network into many logical networks. Think of them as “invisible walls” inside a switch that keep traffic separated, just like separate Wi-Fi networks running on the same access point.
| Layer | Standards | Key Point |
|---|---|---|
| OSI Layer 2 (Data-Link) | IEEE 802.1Q (tagging) | A VLAN creates an independent broadcast domain by adding a 12-bit ID (0-4095) into the Ethernet frame. |
➜ Without VLANs, every device plugged into the same switch hears every broadcast. A VLAN limits that chatter to its own members.
| Term | Meaning |
|---|---|
| VLAN ID (VID) | 1-4094 (0 & 4095 reserved) |
| Access Port | Belongs to ONE VLAN, sends/receives UNTAGGED frames. |
| Trunk Port | Carries MULTIPLE VLANs between switches; frames are TAGGED with 802.1Q headers. |
| Native VLAN | VLAN that a trunk sends UNTAGGED. (Default = 1 on Cisco) |
| Inter-VLAN Routing | Layer-3 device (router or L3 switch) required for traffic BETWEEN VLANs. |
| VTP / GVRP | Protocols that distribute VLAN info to multiple switches (Cisco VTP, IEEE GVRP). |
| Dest MAC | Src MAC | 802.1Q Tag | Ethertype | Payload | FCS |
^12-bit VID^
• Adds 4 bytes, so MTU grows from 1518 → 1522 bytes.
• Only visible over trunks; access ports strip/insert tags automatically.
╔══════════════════╗ Trunk (VLAN 10,20,30)
║ Core L3 Switch ║==============================╗
╚══════════════════╝ ║
▲ ▲ ║
SVIs │ │ ║
(VLAN 10│ │ VLAN 20) ║
│ │ ║
┌──────┴──┴────────┐ ┌───────────────────╨────────────┐
│ Access Switch │ │ Access Switch │
│ Port 1 VLAN 10 │ │ Port 5 VLAN 20 │
│ Port 2 VLAN 10 │ │ Port 6 VLAN 30 (Guest Wi-Fi) │
└──────────────────┘ └───────────────────────────────┘
• VLAN 10: Office PCs
• VLAN 20: VoIP phones
• VLAN 30: Guest Wi-Fi
Router-on-a-Stick or L3 switch does inter-VLAN routing.
# Create VLANs
switch(config)# vlan 10
switch(config-vlan)# name Office
switch(config)# vlan 20
switch(config-vlan)# name Voice
# Access port (PC)
switch(config)# interface fast0/1
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan 10
# Trunk port (uplink)
switch(config)# interface gig0/1
switch(config-if)# switchport mode trunk
switch(config-if)# switchport trunk native vlan 1
switch(config-if)# switchport trunk allowed vlan 10,20
Router-on-a-Stick example:
router(config)# interface gig0/0.10
router(config-subif)# encapsulation dot1Q 10
router(config-subif)# ip address 192.168.10.1 255.255.255.0
flowchart TD
A[Need traffic separation?] -->|Yes| B[Security / Compliance?]
A -->|No| Z[Stay on single VLAN]
B -->|Yes| C[Create dedicated VLAN(s)]
B -->|No| D[Performance issues?]
D -->|Yes| C
D -->|No| Z
✔ Use non-default VLANs (avoid 1) for user ports.
✔ Reserve a unique native VLAN on each trunk to mitigate VLAN-hopping attacks.
✔ Prune unused VLANs from trunks.
✔ Disable unused switch ports (shutdown).
✔ Implement DHCP snooping & dynamic ARP inspection per VLAN.
⚠ VLAN ≠ security silver-bullet; once a device is in the VLAN it has layer-2 freedom.
⚠ Spanning-Tree must still run across trunks—misconfig > broadcast storms.
VLANs are fundamental building blocks for modern networks, enabling clean segmentation with minimal hardware. Master these basics and you’re well on your way to more advanced topics like voice VLANs, private VLANs, and network virtualization! 🎉