CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Modern enterprise networks rely on segmentation to maintain security, optimize performance, and simplify traffic management. By default, a network switch operates as a single broadcast domain: any broadcast frame generated by one endpoint is forwarded out every other active port. Without segmentation, broadcast storms, unconstrained multicast streams, and lateral security risks can quickly degrade network stability.

A Virtual Local Area Network (VLAN) breaks a physical local area network into multiple logical networks at Layer 2. By isolating broadcast domains within dedicated logical partitions, network administrators can enforce departmental security boundaries, prioritize mission-critical voice and video traffic, and streamline addressing schemes. Configuring VLANs on Cisco Catalyst and enterprise switches running Cisco IOS or IOS XE is a core networking competency. This comprehensive guide walks through VLAN fundamentals, step-by-step Command Line Interface (CLI) configuration for access and trunk links, inter-VLAN routing architectures, troubleshooting techniques, and production-ready configuration templates.


Table of Contents

Understanding VLAN Classifications: Operational Roles and Purpose

Before entering commands into the switch terminal, establishing a structured VLAN design is critical. In Cisco switch architectures, VLANs are classified into specific operational categories based on the nature of the traffic they carry and how switchports process those frames.

1. Default VLAN

When a Cisco switch boots out of the box with factory settings, all physical ports belong to VLAN 1. VLAN 1 cannot be deleted, renamed, or modified. By default, untagged control plane traffic—such as Cisco Discovery Protocol (CDP), Link Layer Discovery Protocol (LLDP), Port Aggregation Protocol (PAgP), and Spanning Tree Protocol (STP) frames—is handled across VLAN 1. Network security best practices advise against using VLAN 1 for standard user data or management endpoints.

2. Data (User) VLANs

A data VLAN is designed exclusively for user-generated endpoint traffic, such as workstations, printers, laptops, and application servers. Isolating users into distinct data VLANs (for example, VLAN 10 for Human Resources and VLAN 20 for Engineering) ensures that broadcast traffic remains confined to its originating group and prevents unauthorized peer-to-peer traffic across departmental subnets.

3. Voice VLANs

Enterprise environments commonly deploy Voice over IP (VoIP) phones alongside desktop computers, sharing a single physical drop to the desk. Cisco switches address this via an auxiliary Voice VLAN. Using CDP or LLDP-MED, the switch instructs the IP phone to tag its own voice packets with a specific Voice VLAN ID and Layer 2 Quality of Service (802.1p CoS) bits, while passing the connected PC’s data traffic through untagged into the standard Access/Data VLAN. This segregation protects voice packets from data transmission latency and jitter.

4. Management VLAN

The management VLAN hosts the switch’s in-band management IP address via a Switch Virtual Interface (SVI). This logical interface allows network administrators to manage the switch remotely through secure protocols like SSH and SNMP. Best security practices dictate isolating management SVIs in an out-of-band or dedicated administrative VLAN (e.g., VLAN 99 or VLAN 999) that is unreachable by standard end-user access networks.

5. Native VLAN

The native VLAN is a concept specific to IEEE 802.1Q trunk links. When an 802.1Q trunk receives an untagged frame (a packet lacking an IEEE 802.1Q header), the switch assigns that frame to its configured native VLAN. Conversely, any traffic leaving a trunk port destined for the native VLAN is transmitted without an 802.1Q tag. By default, Cisco switches assign VLAN 1 as the native VLAN on all trunks. To prevent Layer 2 security vulnerabilities, such as double-tagging VLAN hopping attacks, the native VLAN should be changed to an unused, non-default VLAN ID across all interconnecting trunks.


Step-by-Step CLI Walkthrough: Creating and Assigning Access VLANs

Assigning an endpoint to a VLAN requires two actions: creating the VLAN database entry and placing the target switchport into access mode for that VLAN. The following walkthrough demonstrates the standard Cisco IOS/IOS XE configuration workflow.

Step 1: Enter Global Configuration Mode

Log in to the switch through the console or an active SSH session, navigate to Privileged EXEC mode, and enter Global Configuration mode:

Switch> enable
Switch# configure terminal
Switch(config)#

Step 2: Create the VLAN and Assign a Name

Define the VLAN ID (ranging from 1 to 4094) and assign an explicit alphanumeric name to facilitate monitoring and operational clarity:

Switch(config)# vlan 10
Switch(config-vlan)# name CORPORATE_DATA
Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name VOIP_TELEPHONY
Switch(config-vlan)# exit

Note: Entering the vlan <id> command automatically generates the VLAN in the local vlan.dat database.

Step 3: Select the Target Physical Interface

Select the individual interface connecting to your end device, or specify a continuous range of ports using the range keyword:

Switch(config)# interface GigabitEthernet1/0/5

To configure ports 1 through 12 simultaneously:

Switch(config)# interface range GigabitEthernet1/0/1 - 12

Step 4: Configure the Port as an Access Link

Force the port mode to access, which prevents it from forming dynamic trunk links via Dynamic Trunking Protocol (DTP), and assign it to the desired data VLAN:

Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10

Step 5: (Optional) Apply Auxiliary Voice VLAN and Spanning Tree PortFast

When deploying an IP phone with an integrated switch port connected to a PC, add the voice VLAN and enable Spanning Tree PortFast to bypass listening and learning states:

Switch(config-if)# switchport voice vlan 20
Switch(config-if)# spanning-tree portfast
Switch(config-if)# exit

Step 6: Commit Changes to Non-Volatile Storage

Return to Privileged EXEC mode and write the running configuration to the startup configuration:

Switch(config)# end
Switch# copy running-config startup-config

Configuring 802.1Q Trunk Ports and Managing Allowed VLANs

When traffic from multiple VLANs must traverse a single physical cable between two switches or between a switch and a router, access mode is insufficient. An 802.1Q Trunk Link must be configured to tag frames with their originating VLAN identifier as they cross the boundary.

+--------------------+                       +--------------------+
|   Cisco Switch A   |  [Trunk Link: 802.1Q] |   Cisco Switch B   |
|   VLAN 10, 20, 99  |=======================|   VLAN 10, 20, 99  |
|  Gi1/0/24 (Trunk)  |                       |  Gi1/0/24 (Trunk)  |
+--------------------+                       +--------------------+

Step 1: Select the Uplink Interface

Identify the interconnecting physical port (for example, GigabitEthernet1/0/24):

Switch# configure terminal
Switch(config)# interface GigabitEthernet1/0/24
Switch(config-if)# description UPLINK_TO_DISTRIBUTION_SWITCH

Step 2: Set Trunk Encapsulation (Platform Dependent)

Legacy Cisco Catalyst switches (such as the 3560 or 3750) support both Cisco Inter-Switch Link (ISL) and IEEE 802.1Q encapsulation. On these devices, you must define 802.1Q encapsulation before setting the trunk mode. Modern switches (including the Catalyst 2960, 9200, and 9300 series) run 802.1Q natively and skip this requirement:

Switch(config-if)# switchport trunk encapsulation dot1q

Step 3: Force the Interface into Permanent Trunk Mode

Set the port mode explicitly to trunk, and disable Dynamic Trunking Protocol (DTP) negotiation frames to harden the link against unauthorized trunk negotiation:

Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport nonegotiate

Step 4: Redefine the Native VLAN

Move the native VLAN away from default VLAN 1 to a dedicated, unrouted native VLAN ID (e.g., VLAN 999):

Switch(config-if)# switchport trunk native vlan 999

Crucial: Ensure the identical native VLAN ID is configured on the opposing switch interface to prevent native VLAN mismatch alerts.

Step 5: Prune Unused VLANs with the Allowed List

By default, a Cisco trunk forwards traffic for all active VLANs (1–4094). To conserve bandwidth and prevent unnecessary broadcast propagation across switches, restrict the trunk to only active, authorized VLANs:

Switch(config-if)# switchport trunk allowed vlan 10,20,99

Tip: When adding future VLANs, always use switchport trunk allowed vlan add <id>. Running the base command without add overwrites the existing list with the newly specified ID.

Switch(config-if)# end

Inter-VLAN Routing Architectures: Router-on-a-Stick vs. Layer 3 Switch

Because VLANs isolate traffic at Layer 2, devices in different VLANs cannot communicate without a Layer 3 routing mechanism. Two primary architectural models handle inter-VLAN routing in enterprise networks: Router-on-a-Stick (ROAS) and Layer 3 Switch Multi-Layer Routing using Switch Virtual Interfaces (SVIs).

Architectural Comparison

Architecture FeatureRouter-on-a-Stick (ROAS)Layer 3 Switch (SVI / Multi-Layer Routing)
Primary Hardware DeviceLayer 2 Switch paired with an external RouterLayer 3 Multi-Layer Switch (e.g., Catalyst 9300)
Forwarding PlaneSoftware/ASIC router subinterfacesDedicated Application-Specific Integrated Circuits (ASICs)
Throughput & BandwidthBottlenecked by the single physical link to the routerLine-rate hardware switching across backplane
LatencyHigher (traffic leaves switch, hits router, re-enters switch)Ultra-low (routed inside the switch chassis)
Configuration ModelSubinterfaces with 802.1Q encapsulation tagsRouted ports or Switched Virtual Interfaces (interface Vlan <id>)
ScalabilityLimited; practical for small branches and labsEnterprise-grade; supports thousands of endpoints
Physical Cabling ComplexitySingle physical trunk link (“stick”)No external loopback cable required; internal routing
CostLow (reuses existing branch router)Higher (requires Layer 3 capable switch hardware)

When to Select Each Model

  • Router-on-a-Stick: Ideal for small branch offices, retail locations, or lab networks where inter-VLAN traffic volume is low, and budget constraints prevent deploying multi-layer switches.
  • Layer 3 Switch (SVI): The enterprise standard for campus cores, distribution layers, and data centers. High-volume, east-west inter-VLAN communication is processed at multi-gigabit line rates without traversing external router uplinks.

Verification and Troubleshooting: Frequently Asked Questions

After completing VLAN and trunk configurations, verify operational state and diagnose any discrepancies using the following troubleshooting guidelines.

How do I verify active VLANs and assigned ports on a Cisco switch?

Execute show vlan brief from Privileged EXEC mode. This display lists all created VLANs, their administrative status (active or act/unsup), and every physical port assigned to each VLAN in access mode.

Switch# show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi1/0/13, Gi1/0/14
10   CORPORATE_DATA                   active    Gi1/0/1, Gi1/0/2, Gi1/0/3, Gi1/0/4
20   VOIP_TELEPHONY                   active    Gi1/0/1, Gi1/0/2
99   MANAGEMENT                       active    

To view trunk ports (which do not appear under show vlan brief), run:

Switch# show interfaces trunk

This confirms trunking encapsulation, operational status, native VLAN mapping, and the list of allowed VLANs.

Why is an access port showing an “inactive” VLAN state?

A port shows an inactive state when it has been assigned to a VLAN ID that does not exist in the switch’s local VLAN database (vlan.dat). If an interface has switchport access vlan 50 configured, but VLAN 50 was never created in global configuration mode, the switch suspends Layer 2 forwarding on that port.

Resolution: Create the missing VLAN entry:

Switch# configure terminal
Switch(config)# vlan 50
Switch(config-vlan)# name GUEST_WIFI
Switch(config-vlan)# end

The access port will immediately transition to the active state.

How do I identify and resolve a Native VLAN Mismatch error?

When two connected switches have different native VLANs configured on opposite sides of an 802.1Q trunk, Cisco Discovery Protocol detects the condition and logs repeated error messages:

%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet1/0/24 (999), with Switch_B GigabitEthernet1/0/24 (1).

A native VLAN mismatch creates spanning-tree loops and causes traffic from one VLAN to leak into another.

Resolution: Inspect both endpoints using show interfaces <port> trunk. Align both sides to the same native VLAN:

Switch_B(config)# interface GigabitEthernet1/0/24
Switch_B(config-if)# switchport trunk native vlan 999
Switch_B(config-if)# end

Why is a Switch Virtual Interface (SVI) showing “down/down” or “up/down”?

Unlike a physical interface, an SVI (interface Vlan <id>) relies on the Cisco Autostate algorithm. An SVI will remain down/down or up/down until three conditions are met:
1. The VLAN exists in the switch’s local database.
2. The VLAN is not administratively shut down.
3. At least one physical port associated with that VLAN (either an access port in that VLAN or an 802.1Q trunk allowing that VLAN) is in an operational up/up state and in a Spanning Tree forwarding state.

Resolution: Verify that a live network device is plugged into an access port assigned to that VLAN, or verify that an active trunk uplink allows the VLAN across the link.


Production CLI Templates: Copy-and-Paste VLAN Deployment Scripts

Use these standardized templates to accelerate configuration on Cisco Catalyst and Cisco IOS/IOS XE switching platforms. Replace all bracketed values (<VALUE>) with your environment’s specific addressing and IDs.

Template 1: Basic Access Layer VLAN Setup (Data + Voice)

! --- ENTER CONFIGURATION MODE ---
configure terminal

! --- STEP 1: DEFINE VLANS ---
vlan <DATA_VLAN_ID>
 name <DATA_VLAN_NAME>
exit

vlan <VOICE_VLAN_ID>
 name <VOICE_VLAN_NAME>
exit

vlan <MGMT_VLAN_ID>
 name MANAGEMENT_SVI
exit

! --- STEP 2: CONFIGURE ACCESS PORTS ---
interface range <INTERFACE_TYPE/RANGE>
 description ENDPOINT_USER_ACCESS
 switchport mode access
 switchport access vlan <DATA_VLAN_ID>
 switchport voice vlan <VOICE_VLAN_ID>
 spanning-tree portfast
 spanning-tree bpduguard enable
 no shutdown
exit

! --- STEP 3: CONFIGURE IN-BAND MANAGEMENT SVI ---
interface Vlan<MGMT_VLAN_ID>
 description SWITCH_MANAGEMENT_INTERFACE
 ip address <SWITCH_IP_ADDRESS> <SUBNET_MASK>
 no shutdown
exit

ip default-gateway <GATEWAY_IP_ADDRESS>

end
write memory

Template 2: Inter-Switch 802.1Q Trunk Link (Hardened)

! --- ENTER CONFIGURATION MODE ---
configure terminal

! --- DEFINE UNUSED NATIVE VLAN ---
vlan <UNUSED_NATIVE_VLAN_ID>
 name UNTAGGED_NATIVE_DRAIN
exit

! --- CONFIGURE TRUNK INTERFACE ---
interface <UPLINK_INTERFACE_ID>
 description UPLINK_TRUNK_TO_REMOTE_DEVICE
 ! Run encapsulation command only on platforms that require it:
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
 switchport trunk native vlan <UNUSED_NATIVE_VLAN_ID>
 switchport trunk allowed vlan <ALLOWED_VLAN_LIST>
 spanning-tree guard root
 no shutdown
exit

end
write memory

Template 3: Multi-Layer Core/Distribution SVI Inter-VLAN Routing

! --- ENTER CONFIGURATION MODE ---
configure terminal

! --- ENABLE LAYER 3 ROUTING ENGINE ---
ip routing

! --- CREATE LAYER 3 ROUTING INTERFACES ---
interface Vlan<DATA_VLAN_ID>
 description GATEWAY_FOR_CORPORATE_DATA
 ip address <DATA_GATEWAY_IP> <DATA_SUBNET_MASK>
 no shutdown
exit

interface Vlan<VOICE_VLAN_ID>
 description GATEWAY_FOR_VOIP_TELEPHONY
 ip address <VOICE_GATEWAY_IP> <VOICE_SUBNET_MASK>
 ! Forward DHCP broadcast requests to central server:
 ip helper-address <DHCP_SERVER_IP>
 no shutdown
exit

end
write memory

Official Cisco Documentation and Command Reference Guide

For enterprise network deployments, adhere to standards established in official Cisco technical software documentation.

Architectural Standards and Specifications

  • IEEE 802.1Q Encapsulation: Inserts a 4-byte header into standard Ethernet frames. The header includes a 12-bit VLAN Identifier (VID), accommodating up to 4,096 distinct VLANs.
  • VLAN Numbering Ranges:
  • Normal Range (1–1005): Stored in non-volatile flash memory inside the vlan.dat file. IDs 1002 through 1005 are reserved for legacy Token Ring and FDDI systems.
  • Extended Range (1006–4094): Intended for service providers and high-density campus fabrics. Extended VLANs are saved directly to the running configuration and startup configuration files on switches operating in VTP Transparent or Off mode (VTP versions 1 and 2) or VTP version 3.

Cisco Configuration Documentation Pathways

To cross-reference command syntax across specific hardware generations, refer to official Cisco configuration manuals on Cisco.com:
* Cisco Catalyst 9000 Series Switches: Navigate to Products > Switches > Catalyst 9000 Series Switches > Layer 2 Configuration Guides > Configuring VLANs.
* Cisco IOS XE Enterprise Routing & Switching Command References: Consult the VLAN Command Reference for platform-level syntax rules regarding parameters like switchport trunk allowed vlan, vtp mode, and interface vlan.
* Hardware Sizing and TCAM Allocation: Consult platform release notes for Ternary Content-Addressable Memory (TCAM) capacity. SVI scaling limits and maximum active VLAN rules vary depending on the active Cisco SDM (Switch Database Management) template template selected on the chassis.


Configuring VLANs on Cisco switches forms the foundation of enterprise network isolation and performance management. By establishing clear VLAN classifications, configuring access ports to isolate endpoint traffic, securing 802.1Q trunk uplinks, and implementing the appropriate inter-VLAN routing model, you protect your Layer 2 switching fabric from broadcast degradation and unauthorized lateral movement. Validating operational states with disciplined CLI commands and leveraging standardized deployment templates ensures scalable, predictable, and robust network operation across your enterprise campus.

Please follow and like us:
Last modified: November 3, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.