This guide explains how to create a VLAN on a Cisco switch, assign access ports, configure a trunk, and verify the result. The examples use current global configuration commands rather than the obsolete VLAN database workflow.
Create and Name VLANs
Switch> enable
Switch# configure terminal
Switch(config)# vlan 10
Switch(config-vlan)# name IT
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name HR
Switch(config-vlan)# exit
Assign an Access Port
Switch(config)# interface gigabitethernet 0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# spanning-tree portfast
Switch(config-if)# exit
Use PortFast only on appropriate edge ports connected to end devices. Apply the organization’s edge-port security standards.
Assign a Range of Ports
Switch(config)# interface range gigabitethernet 0/2 - 8
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Configure an 802.1Q Trunk
Switch(config)# interface gigabitethernet 0/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Match the trunk and native VLAN settings with the device on the other end. Permit only required VLANs.
Verify the VLAN Configuration
show vlan briefshow interfaces switchportshow interfaces trunkshow spanning-tree vlan 10
Important Routing Note
Hosts in different VLANs require inter-VLAN routing through a router or multilayer switch. Creating VLANs alone does not provide communication between them.
Continue Your CCNA Preparation
Try our CCNA switching practice questions. For structured practice, see the CCNA 200-301 Premium PDF with the latest available questions and answers.
CiscoForAll provides independent study and practice material. Always use official Cisco documentation as a primary preparation source.