白

White Belt: VLANs: Virtual LANs

VLANs let you partition a physical switch into multiple logical networks. They reduce broadcast domains, isolate traffic, and make networks easier to manage and secure.

What Is a VLAN?

A VLAN is a logical grouping of network devices on the same physical switch or across multiple switches. Devices in the same VLAN can communicate directly; devices in different VLANs need a router.

Why VLANs matter: They reduce broadcast domains, improve security by isolating departments, and make networks simpler to manage.

VLAN Types

TypePurpose
Data VLANUser traffic (workgroups, departments)
Management VLANSwitch/router administration
Native VLANUntagged traffic on trunks

Access Ports vs. Trunks

Access port: Belongs to one VLAN. Used for end devices (PCs, printers). Traffic is untagged.

Trunk port: Carries multiple VLANs. Used between switches. Frames are tagged with VLAN ID.

Configure VLANs on Catalyst 9000

Switch# configure terminal
Switch(config)# vlan 10
Switch(config-vlan)# name Engineering
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit
Switch(config)# interface Gi0/0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# exit
Switch(config)# interface Gi0/0/2
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# end
Switch# write memory

Explanation: Create VLANs 10 and 20, then assign ports to them. Each port carries untagged traffic from its VLAN.

Create a Trunk for Multiple VLANs

Switch(config)# interface Gi0/0/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# switchport trunk native vlan 1
Switch(config-if)# no shutdown
Switch(config-if)# exit

Explanation: switchport mode trunk allows multiple VLANs on this port. Only VLANs 10 and 20 can cross this link.

Verify VLANs

Switch# show vlan brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -----
1    default                          active    Gi0/0/3,Gi0/0/4
10   Engineering                      active    Gi0/0/1
20   Sales                            active    Gi0/0/2

Switch# show interfaces Gi0/0/24 trunk
Port        Mode             Status        Native vlan
Gi0/0/24    on               trunking      1

Port        Vlans allowed on trunk
Gi0/0/24    10,20

Common Mistake: Forgetting Allowed VLANs on Trunk

If you create VLAN 30 but don't add it to the trunk's allowed list, traffic won't cross to the other switch. Always verify both sides of a trunk with show interfaces trunk.

Try it: create a VLAN and assign a port

A simulated Catalyst 9300 with the dojo's VLANs already on it. Create VLAN 40, name it Guest, and move Gi1/0/6 into it — then check your work with show vlan brief.

Summary

  • VLANs logically partition switches into multiple networks.
  • Access ports carry one VLAN; trunk ports carry many.
  • Create VLANs with vlan <id>, assign ports with switchport access vlan <id>.
  • Verify with show vlan brief and show interfaces trunk.