CCNA · Lesson 12 of 13

VLAN Hopping Attacks and How to Prevent Them

VLANs separate traffic… unless the switch is misconfigured. This is how an attacker "hops" from one VLAN to another.

By topologia.appUpdated: Nov 13, 2026⏱ 5 min❓ 4 questions📶 Level beginner

In a nutshell

VLAN hopping means jumping into a VLAN you do not belong to. It is done by tricking the switch into forming a trunk (switch spoofing) or with a double-tagged frame. Prevent it with fixed configuration and a native VLAN with no users.

In this lesson
  1. Attack 1: switch spoofing
  2. Attack 2: double tagging
  3. Port protection checklist
  4. What you must remember
  5. Exam-style questions

Attack 1: switch spoofing

The attacker connects a PC to a port in dynamic auto or dynamic desirable mode and sends DTP messages pretending to be a switch. The port forms a trunk with it and the attacker now receives traffic from every VLAN.

How to prevent it

Configure user ports as switchport mode access and disable DTP with switchport nonegotiate on trunks.

Attack 2: double tagging

  1. The attacker is on an access port in the same VLAN as the native VLAN of the trunk (for example VLAN 1).
  2. They send a frame with two 802.1Q tags: the outer one is the native VLAN and the inner one is the target VLAN (for example 20).
  3. The first switch removes the outer tag (it is the native VLAN, so it leaves the trunk without it).
  4. The second switch sees the inner tag (20) and delivers the frame into VLAN 20.

It is a one-way attack: the attacker can send to the victim, but the reply does not come back.

How to prevent it

Use a VLAN with no users as native (e.g. 999). Some switches can also tag the native VLAN with vlan dot1q tag native.

Port protection checklist

  ← User ports
SW1(config)# interface range fa0/1 - 20
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport nonegotiate

  ← Unused ports: separate VLAN and shut down
SW1(config)# vlan 998
SW1(config-vlan)# name UNUSED
SW1(config)# interface range fa0/21 - 24
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 998
SW1(config-if-range)# shutdown

  ← Trunks
SW1(config)# interface g0/1
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport nonegotiate
SW1(config-if)# switchport trunk native vlan 999
SW1(config-if)# switchport trunk allowed vlan 10,20,99

Other Layer 2 security features that are also on the CCNA (port security, DHCP snooping, DAI) protect against other attacks and are covered in the security topic.

What you must remember

  • Switch spoofing: the attacker forms a trunk using DTP.
  • Prevent it: switchport mode access + switchport nonegotiate.
  • Double tagging: requires being in the native VLAN; it is one-way.
  • Prevent it: native VLAN with no users and unused ports shut down.

Check what you learned

4 exam-style questions. Some have one answer and others ask you to choose several. Answer them all to complete the lesson.

Question 1 of 4 · One answerWhich attack abuses DTP so that a switch port forms a trunk with the attacker device?
Question 2 of 4 · Choose twoWhich two measures prevent a switch spoofing attack on user ports? (Choose two.)
Question 3 of 4 · One answerWhich condition does an attacker need to perform a double-tagging attack?
Question 4 of 4 · One answerWhich command makes a Cisco switch also tag native VLAN frames on trunks?