Free tech learning for everyone, from basics to pro

Routing & SwitchingNetworking SecurityIntermediate

802.1Q trunking in depth: tags, native VLAN, DTP, troubleshooting and Q-in-Q

In short: A trunk carries many VLANs over one link by adding a 4-byte 802.1Q tag to each frame, except frames in the native VLAN. Configure trunks statically, list only the VLANs they need, keep the native VLAN the same at both ends and disable DTP. Q-in-Q adds a second tag so a provider can carry a customer's VLANs across its own network.

What the 802.1Q tag does

An access port belongs to one VLAN and sends ordinary, untagged frames. A trunk carries frames for many VLANs, so each frame must say which VLAN it belongs to. IEEE 802.1Q does this by inserting a 4-byte tag after the source MAC address. The older Cisco ISL method wrapped the whole frame instead; it is obsolete and most current switches no longer support it.

Inside an 802.1Q tag (4 bytes)TPID16 bits, 0x8100PCP3 bits, priorityDEI1 bit, dropeligibleVLAN ID12 bits, 1-4094
Figure 1. The tag sits between the source MAC address and the EtherType. Most of it is the 12-bit VLAN ID.

The 12-bit VLAN ID allows 4096 values, of which 0 and 4095 are reserved, leaving 1 to 4094. The 3-bit priority field (PCP) carries the class of service used by QoS (see QoS). Because the tag changes the frame, the switch recalculates the frame check sequence, and the largest standard frame grows from 1518 to 1522 bytes.

Configuring a trunk properly

interface GigabitEthernet1/0/48
 description Uplink to DIST-1
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport nonegotiate
 switchport trunk native vlan 999
 switchport trunk allowed vlan 10,20,30,99
show interfaces trunk

The encapsulation line is only needed on older switches that also supported ISL. Allowed VLAN lists matter: by default a trunk carries every VLAN, so broadcasts from all of them cross every link. Be careful when editing the list: switchport trunk allowed vlan 40 replaces the list, while switchport trunk allowed vlan add 40 adds to it. Typing the first by mistake is a classic way to cut off a building.

The native VLAN

Frames in the native VLAN cross the trunk without a tag. A switch that receives an untagged frame on a trunk places it in its own native VLAN. If the two ends disagree, traffic leaks from one VLAN into another. Cisco switches detect this through CDP ("native VLAN mismatch" messages), and per-VLAN spanning tree blocks the inconsistent VLANs.

Good practice is to choose an unused VLAN as the native VLAN on every trunk, never put devices in it, and, where the platform supports it, tag the native VLAN as well with vlan dot1q tag native. This also defeats the double-tagging form of VLAN hopping described in Layer 2 attacks and defences.

DTP: negotiating trunks

The Cisco Dynamic Trunking Protocol (DTP) lets two ports agree whether to become a trunk.

Local modeOther end: dynamic autoOther end: dynamic desirableOther end: trunkOther end: access
dynamic autoAccessTrunkTrunkAccess
dynamic desirableTrunkTrunkTrunkAccess
trunkTrunkTrunkTrunkMismatch, avoid

Two ports left in dynamic auto never form a trunk, which surprises many beginners. Worse, a port that negotiates can be talked into trunking by any device that speaks DTP. Set every port explicitly to switchport mode access or switchport mode trunk and add switchport nonegotiate. Some low-cost small business switches set VLANs through a web page and use the words "tagged" and "untagged" instead: a tagged member is a trunk member, and the untagged VLAN is the access or native VLAN.

Troubleshooting VLANs and trunks

  1. show vlan brief: does the VLAN exist and is the port in it? A port assigned to a VLAN that does not exist is inactive.
  2. show interfaces trunk: is the link trunking, which VLANs are allowed, and which are "allowed and active" and "forwarding"? A VLAN missing from the last column is pruned or blocked by spanning tree.
  3. show interfaces g1/0/48 switchport: compare the administrative and operational modes and the native VLAN on both ends.
  4. Check the logs for native VLAN mismatch or err-disabled messages, then test with ping between hosts in the same VLAN before testing routing.

802.1Q tunnelling (Q-in-Q)

A service provider connecting several sites for one customer cannot reuse the customer's own VLAN numbers, because many customers use VLAN 10. Q-in-Q (IEEE 802.1ad, provider bridging) solves this by adding an outer "service" tag on top of the customer's tag. The provider's switches look only at the outer tag; the customer's tags travel through untouched.

system mtu 1504
interface GigabitEthernet1/0/10
 description Customer A site link
 switchport access vlan 3001
 switchport mode dot1q-tunnel
 l2protocol-tunnel cdp
 l2protocol-tunnel stp
 l2protocol-tunnel point-to-point lacp

The extra tag needs 4 more bytes of MTU. Layer 2 protocol tunnelling (L2PT) carries the customer's CDP, STP, VTP and even LACP or PAgP messages across the provider network, which allows a customer to build an EtherChannel between two of its sites over a Q-in-Q service.

Real-world example: a regional fibre provider links a hospital's three buildings across a town. The hospital uses VLANs 10 to 60 internally. The provider gives the hospital outer VLAN 3001 on its network, so the hospital can keep its own numbering, while another customer using the same VLAN numbers gets outer VLAN 3002. Neither can see the other's traffic.

Practice

Two switch ports are both left in dynamic auto mode. Will they form a trunk?
No. Both wait for the other side to ask, so the link stays an access link.
What is the difference between "switchport trunk allowed vlan 40" and "switchport trunk allowed vlan add 40"?
The first replaces the whole allowed list with VLAN 40 only; the second adds VLAN 40 to the existing list.
Why does a Q-in-Q network need a larger MTU?
Each frame carries an extra 4-byte outer tag, so frames with full-size payloads would otherwise be too big.

Key takeaways

  • 802.1Q inserts a 4-byte tag with a 12-bit VLAN ID (1 to 4094) and a 3-bit priority.
  • Configure trunks statically, disable DTP and allow only the VLANs each trunk needs.
  • Keep the native VLAN identical at both ends and use an unused VLAN for it.
  • Troubleshoot with show vlan brief, show interfaces trunk and show interfaces switchport.
  • Q-in-Q adds a provider tag so customer VLANs cross a shared network unchanged.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.