In an enterprise Cisco switching environment, IEEE 802.1Q trunk links carry traffic across multiple VLANs by appending a four-byte tag to standard Ethernet frames. However, 802.1Q also designates a single native VLAN per trunk link to handle frames that traverse the connection without a VLAN tag. By factory default, Cisco switches assign VLAN 1 as both the management VLAN and the native VLAN across all interfaces. Leaving this default intact introduces operational and security risks, particularly VLAN hopping attacks.
Reassigning the native VLAN to an isolated, non-default VLAN across all inter-switch links is a foundational hardening baseline. This guide covers the security rationale for migrating off VLAN 1, the official Cisco IOS command reference, step-by-step trunk interface configuration, verification commands, troubleshooting mismatch errors, and global native VLAN tagging.
Table of Contents
Understanding Native VLAN Security Risks and VLAN Hopping
Why is leaving the native VLAN set to default VLAN 1 considered a security risk?
Default VLAN 1 carries critical Layer 2 control traffic, including Cisco Discovery Protocol (CDP), Link Layer Discovery Protocol (LLDP), Port Aggregation Protocol (PAgP), and Spanning Tree Protocol (STP) Bridge Protocol Data Units (BPDUs). Because all unconfigured switchports default to VLAN 1, an unauthorized device connected to an unhardened port automatically gains access to this broadcast domain. If the native VLAN on trunk links remains set to VLAN 1, untagged traffic from unauthorized access ports can traverse trunk links without inspection or routing controls, exposing management and control planes to interception and spoofing.
How does a double-tagging VLAN hopping attack work?
Double-tagging exploits the switch’s native VLAN handling to inject traffic into a destination VLAN without traversing a router or firewall:
1. An attacker on an access port generates an Ethernet frame with two 802.1Q tags: an outer tag matching the trunk’s native VLAN (e.g., VLAN 1) and an inner tag targeting a restricted VLAN (e.g., VLAN 10).
2. The initial switch receives the frame, observes that the outer tag matches the trunk interface’s native VLAN, strips the outer tag, and forwards the frame across the trunk link untagged.
3. The downstream switch receives the frame. Because the outer tag was stripped, it reads the inner tag (VLAN 10), treats it as legitimate tagged traffic, and switches the packet directly into the target VLAN.
Because this attack relies on the first switch stripping the outer native VLAN tag, double-tagging is strictly unidirectional; return traffic cannot route back using the same mechanism. However, it allows attackers to bypass access control lists (ACLs) to execute blind packet injection, such as sending malicious TCP resets, UDP exploits, or ICMP floods to target subnets.
What is the recommended industry best practice for native VLAN assignment?
Network security benchmarks, including the CIS Cisco IOS Benchmarks and NSA network infrastructure guidelines, recommend establishing a dedicated dummy VLAN (such as VLAN 999 or VLAN 888) strictly for native VLAN transit across trunk links. This dedicated VLAN should:
* Have no active access ports assigned to it.
* Contain no active Switched Virtual Interfaces (SVIs) or default gateways.
* Be isolated from any user data, voice, or network management traffic.
Cisco IOS Command Reference: switchport trunk native vlan
Command Description
Configures the 802.1Q native VLAN for a Layer 2 interface operating in trunk mode. Frames associated with this VLAN ID traverse the trunk link without an 802.1Q encapsulation header unless native VLAN tagging is explicitly enabled.
Syntax
switchport trunk native vlan vlan-id
no switchport trunk native vlan
Syntax Description
vlan-id: The VLAN identifier to be used as the native VLAN. The valid range is 1 to 4094 (standard and extended VLAN ranges).no switchport trunk native vlan: Resets the native VLAN back to the switch default (VLAN 1).
Command Modes
- Interface configuration (
config-if) - Interface range configuration (
config-if-range)
Platform and Release Compatibility
Supported across all modern Cisco Catalyst and Industrial Ethernet switching platforms running Cisco IOS, Cisco IOS-XE (Catalyst 2960, 3560, 3650, 3850, 9200, 9300, 9400, 9500, and 9600 series), and Cisco Nexus running NX-OS (where the command syntax is identical within interface configuration mode).
Usage Guidelines
- The interface must be configured as a Layer 2 switchport (
switchport) operating in trunk mode (switchport mode trunk). - If the specified VLAN ID does not exist in the switch’s local VLAN database, traffic for that VLAN will not be forwarded until the VLAN is created.
- Both endpoints of the trunk link must be configured with an identical native VLAN ID. A mismatch triggers CDP alerts and causes Spanning Tree Protocol to place the link into an inconsistent blocking state.
Step-by-Step Guide: Changing the Native VLAN on a Trunk Port
To safely reassign the native VLAN on an active or newly provisioned trunk interface, follow this sequential sequence in Cisco IOS/IOS-XE.
Step 1: Create the Dedicated Native VLAN
Before assigning a new native VLAN to an interface, create it in the local VLAN database and provide a descriptive name to prevent administrative confusion.
Switch1# configure terminal
Switch1(config)# vlan 999
Switch1(config-vlan)# name UNUSED_NATIVE_VLAN
Switch1(config-vlan)# exit
Step 2: Access the Trunk Interface
Enter interface configuration mode for the physical interface or Port-Channel carrying the trunk link.
Switch1(config)# interface GigabitEthernet0/1
(Note: If configuring an EtherChannel/LACP bundle, apply these commands to the logical interface Port-channel <id> rather than the physical member ports).
Step 3: Apply the Native VLAN Assignment
Ensure the port is operating as an 802.1Q trunk, then execute the reassignment command.
Switch1(config-if)# switchport trunk encapsulation dot1q
Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk native vlan 999
(Note: On newer Catalyst platforms, such as the 9000 series, 802.1Q is the only supported encapsulation type, meaning the switchport trunk encapsulation dot1q command is deprecated and rejected as invalid).
Step 4: Configure the Opposing Switch
Immediately apply the same configuration to the remote peer switch on the other end of the link. Minimizing delay between configuring both sides prevents automated Spanning Tree Protocol blocks caused by temporary mismatches.
Switch2# configure terminal
Switch2(config)# vlan 999
Switch2(config-vlan)# name UNUSED_NATIVE_VLAN
Switch2(config-vlan)# interface GigabitEthernet0/1
Switch2(config-if)# switchport mode trunk
Switch2(config-if)# switchport trunk native vlan 999
Switch2(config-if)# end
Step 5: Save the Running Configuration
Commit the configuration to NVRAM on both switches to ensure settings persist through reboots.
Switch1# copy running-config startup-config
Switch2# copy running-config startup-config
How to Verify the Active Native VLAN Configuration
Once configured, verify that both the administrative settings and operational states reflect the newly assigned native VLAN ID.
Method 1: Global Trunk Inspection (show interfaces trunk)
The show interfaces trunk command provides a top-level summary of all operational trunk ports, showing operational mode, encapsulation, trunking status, and the assigned native VLAN.
Switch1# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 999
Port Vlans allowed on trunk
Gi0/1 1-4094
Port Vlans allowed and active in management domain
Gi0/1 1,10,20,30,999
Port Vlans in spanning tree forwarding state and not pruned
Gi0/1 1,10,20,30,999
Verification Checkpoint: Confirm that the column labeled Native vlan displays 999 and that VLAN 999 is listed under active VLANs.
Method 2: Granular Switchport State (show interfaces switchport)
For comprehensive diagnostic detail on a specific interface, use show interfaces <id> switchport.
Switch1# show interfaces GigabitEthernet0/1 switchport
Name: Gi0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 999 (UNUSED_NATIVE_VLAN)
Administrative Native VLAN tagging: disabled
Voice VLAN: none
Verification Checkpoint: Inspect the line reading Trunking Native Mode VLAN. It should report 999 (UNUSED_NATIVE_VLAN), confirming that the port’s trunking configuration is active.
Troubleshooting Native VLAN Mismatches and Spanning Tree Blocks
When opposing ends of a trunk link have different native VLANs configured, Cisco switches generate syslog warnings and automatically alter port states to prevent bridging loops.
Diagnosing the Symptoms
A native VLAN mismatch generates two primary syslog signatures:
- Cisco Discovery Protocol (CDP) Alert:
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (999), with Switch2 GigabitEthernet0/1 (1).
- Spanning Tree Protocol (STP) Type-Inconsistency Alarm:
%SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 1 on GigabitEthernet0/1 VLAN999.
%SPANTREE-2-BLOCK_PVID_LOCAL: Blocking GigabitEthernet0/1 on VLAN0999. Inconsistent local vlan.
Understanding the Network Impact
When CDP detects mismatched IDs, it logs a warning. More critically, Per-VLAN Spanning Tree Plus (PVST+) transmits BPDUs tagged with the PVID (Port VLAN ID) of the native VLAN. When a switch receives an untagged BPDU or a BPDU tagged with a different native VLAN ID than its local interface configuration, STP detects an inconsistency. To protect against Layer 2 forwarding loops and cross-VLAN leaking, STP transitions the native VLAN on that port into a PVID-inconsistent / Root-Inconsistent (blocking) state. Traffic on other trunked VLANs may continue passing, but the native VLAN remains down.
Remediation Workflow
Step 1: Check link status and identify peer native VLAN IDs
Switch1# show cdp neighbors GigabitEthernet0/1 detail
Step 2: Confirm local trunk settings
Switch1# show interfaces GigabitEthernet0/1 trunk
Step 3: Align configuration on the mismatched switchport
Switch2# configure terminal
Switch2(config)# interface GigabitEthernet0/1
Switch2(config-if)# switchport trunk native vlan 999
Switch2(config-if)# end
Step 4: Verify STP consistency restoration
Switch1# show spanning tree inconsistentports
Upon fixing the mismatch, the switch automatically restores the port to normal forwarding and logs a confirmation message:
%SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking GigabitEthernet0/1 on VLAN0999. Port consistency restored.
Advanced Hardening: Global Native VLAN Tagging Configuration Template
As covered in the security analysis above, double-tagging exploits rely on untagged frames traversing a trunk link via the native VLAN. To close this attack vector completely, Cisco IOS supports 802.1Q native VLAN tagging. When enabled, the switch appends explicit 802.1Q tags to native VLAN frames, forcing downstream switches to drop spoofed outer tags and preventing untagged frame processing.
Global Activation Template
Apply this configuration across all switches in the Layer 2 domain:
! Step 1: Enable global 802.1Q tagging for all native VLAN traffic
configure terminal
vlan dot1q tag native
! Step 2: Verify the operational status of native tagging
do show vlan dot1q tag native
end
! Step 3: Write configuration to memory
write memory
Verification Output
Switch1# show vlan dot1q tag native
vlan dot1q tag native is enabled
Deployment Caveats
- Network-Wide Consistency: Enabling
vlan dot1q tag nativeforces the switch to tag native VLAN frames on all 802.1Q trunks. Connected switches, firewalls, and hypervisors must also expect tagged traffic on that VLAN; otherwise, untagged communication will fail. - Control Traffic Exception: Certain switch-generated control frames (e.g., standard BPDUs and CDP packets) continue to transmit untagged or use proprietary encapsulation according to protocol specifications, regardless of this setting.
Summary
Migrating your network off default VLAN 1 is an essential security control. By creating an isolated native VLAN, applying switchport trunk native vlan <id> symmetrically across all inter-switch links, verifying configurations with show interfaces trunk, and implementing global native VLAN tagging (vlan dot1q tag native), you protect your network against VLAN hopping attacks and avoid Spanning Tree PVID inconsistencies.











Comments