A VLAN (virtual LAN) splits one physical switch into several separate logical networks. Devices in different VLANs can’t talk directly to each other, even when they plug into the same switch.
Why use VLANs
- Security: keep guest devices away from finance or server traffic.
- Performance: smaller broadcast domains mean less unnecessary traffic.
- Organization: group devices by department instead of by cable location.
Access ports and trunk ports
An access port belongs to one VLAN and connects an end device such as a PC. A trunk port carries several VLANs between switches, using 802.1Q tags to mark which VLAN each frame belongs to.
Basic Cisco configuration
Switch(config)# vlan 10
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# exit
Switch(config)# interface gigabitethernet0/1
Switch(config-if)# switchport mode trunk
Verify it
Use show vlan brief to see which ports belong to each VLAN and show interfaces trunk to check your trunk links
Communication between VLANs
Devices in different VLANs need a router or a layer 3 switch to exchange traffic. This is called inter-VLAN routing, and it is a core CCNA topic.