Sub topic 7
The native VLAN
This chapter assumes you know how access and trunk ports work, what an 802.1Q tag contains, and how a switch forwards frames by MAC address. It covers how a trunk handles frames that carry no tag, and why a mismatch causes trouble.
What the native VLAN is
An 802.1Q trunk normally tags every frame with its VLAN ID. The native VLAN is the one exception. Frames that belong to the native VLAN are sent across the trunk without a tag. The default native VLAN on most switches is VLAN 1.
The native VLAN exists for backward compatibility. Devices that do not understand tags, such as an old hub or an unmanaged switch on a trunk segment, can still take part in one VLAN. Today it mostly matters because of the mistakes it allows.
How the switch handles untagged frames
The rules on a trunk port are simple:
- Sending: a frame in the native VLAN leaves the port with no tag. All other frames leave with a tag.
- Receiving: an untagged frame that arrives is assigned to the native VLAN of the receiving port. A tagged frame is assigned to the VLAN named in its tag.
The receiving switch decides the VLAN from its own native VLAN setting. The frame itself carries no VLAN information. Both ends must therefore agree on which VLAN is native.
Configuring the native VLAN
Best practice is to move the native VLAN to an unused VLAN and set the same value on both ends of the trunk.
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 10,20
switchport nonegotiateOn switches that support both ISL and 802.1Q, enter switchport trunk encapsulation dot1q before switchport mode trunk. VLAN 999 here carries no hosts, so no real traffic travels untagged on this trunk.
What goes wrong with a mismatch
If the two ends of a trunk disagree, untagged frames land in the wrong VLAN. A frame from VLAN 1 on one switch appears in VLAN 99 on the other. Two separate broadcast domains merge, and hosts may receive traffic they should never see.
Cisco switches running CDP report this fault. A log message such as %CDP-4-NATIVE_VLAN_MISMATCH names the port and both VLAN IDs. Spanning Tree can also block the port, because it sees BPDUs from an unexpected VLAN.
Check the setting on each end:
show interfaces trunk
show interfaces GigabitEthernet0/24 switchportThe show interfaces trunk output lists the native VLAN for each trunk port. Compare the value on both switches.
Security considerations
Untagged traffic is also the basis of the double-tagging attack. If an attacker's access port sits in the native VLAN, the attacker can add two tags. The first switch removes the outer tag, because it matches the native VLAN, and forwards the frame with the inner tag still in place. The next switch then delivers it into a different VLAN. Using an unused native VLAN, and never assigning hosts to it, closes this path. A later chapter covers the attack in full.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| CDP native VLAN mismatch log message | Different native VLAN on each end | Set the same value on both ports |
| Hosts in the wrong VLAN see each other's broadcasts | Native VLAN mismatch merging two VLANs | Correct the mismatch, then check `show interfaces trunk` |
| Host in the native VLAN loses connectivity | Native VLAN missing from the allowed list | Add it to `switchport trunk allowed vlan`, or move hosts out of it |
Exercise
Switch A has native VLAN 1 on a trunk, and Switch B has native VLAN 99 on the other end. A host in VLAN 1 on Switch A sends a broadcast. Which VLAN does Switch B place it in, and why?
Show answer
VLAN 99. Frames in the native VLAN cross the trunk untagged, so Switch B sees no tag and assigns the frame to its own native VLAN, which is 99.