VLAN hopping is a Layer 2 attack in which a host on one VLAN gains access to traffic on another VLAN that should be isolated from it. The two methods are switch spoofing, where the attacker uses Cisco's Dynamic Trunking Protocol to turn an access port into a trunk, and double tagging, where the attacker hides a second 802.1Q tag inside a frame so the next switch delivers it to the victim VLAN.
Key takeaways
- VLAN hopping uses switch spoofing (DTP trunk negotiation) or double tagging (a second 802.1Q tag) to cross VLAN boundaries at Layer 2.
- Double tagging is one-way only, and switch spoofing only works when ports are left in dynamic trunking mode.
- Fix both with explicit port modes, switchport nonegotiate, an unused native VLAN, and no hosts on VLAN 1.
VLANs are the standard way to split a network into isolated segments: staff on one VLAN, guests on another, servers on a third. VLAN hopping breaks that promise. An attacker plugged into one VLAN can reach traffic on another, without ever passing through a router or firewall.
What is VLAN hopping?
VLAN hopping is a Layer 2 attack in which a host on one virtual LAN gains access to traffic on another VLAN that should be isolated from it. The attacker abuses the way switches handle trunk links and VLAN tags, so frames cross a boundary that no router or firewall ever sees.
A VLAN (virtual local area network) is a logical grouping of switch ports that behaves like a separate physical network. Devices on different VLANs cannot talk to each other directly; traffic between them must go through a router or Layer 3 switch, where access rules can be applied. That isolation is the whole point of segmenting a network, as the VLAN hopping article on Wikipedia explains.
VLAN hopping defeats that isolation at Layer 2, below the level where firewalls and access lists operate. The attacker does not need to break any password or exploit any software bug. They only need a network port and a switch left in its default configuration.
There are two primary methods: switch spoofing and double tagging. Both are configuration problems, and both are fixed with a few lines of switch configuration.
How do VLANs and trunk links work?
A VLAN is a broadcast domain created in software on a switch. Each switch port belongs to one VLAN (an access port) or carries many VLANs at once (a trunk port). Trunk ports connect switches to each other and tag every frame with an 802.1Q header that identifies its VLAN.
The 802.1Q tag is a 4-byte field inserted into the Ethernet frame, between the source MAC address and the original EtherType field. Its 12-bit VLAN ID field allows VLAN IDs from 1 to 4094, with 0 and 4095 reserved. When a frame arrives on a trunk, the receiving switch reads the tag and forwards the frame only to ports in that VLAN.
One VLAN on a trunk is special: the native VLAN. Frames belonging to the native VLAN cross the trunk untagged, with no 802.1Q header at all. By default on Cisco switches, the native VLAN is VLAN 1, which is also the default VLAN for all ports. That default is at the heart of the double tagging attack.
Access ports, by contrast, carry a single VLAN and expect untagged frames from the connected device. A laptop plugged into an access port in VLAN 10 has no idea VLAN 20 exists — unless the attacker makes the switch believe otherwise.
How does switch spoofing work?
Switch spoofing tricks a switch into treating the attacker's computer as another switch. The attacker sends Dynamic Trunking Protocol (DTP) packets that propose forming a trunk, and if the port is in a dynamic mode, the switch agrees — handing the attacker tagged traffic for every VLAN allowed on that trunk.
DTP is a Cisco-proprietary protocol that automatically negotiates trunk links between switches. On many Catalyst switches, ports ship in dynamic auto mode, which forms a trunk if the other side asks, or dynamic desirable mode, which actively tries to form one. Neither mode authenticates the other side. The switch simply assumes anything speaking DTP is a legitimate switch.
The attack takes only a few steps:
- The attacker plugs a laptop into a wall jack or an unused switch port, often in a conference room or lobby.
- They run a tool such as Yersinia, which crafts DTP packets advertising
desirablemode. - The switch receives the DTP advertisement and transitions the port to trunk mode automatically.
- The attacker's laptop now receives 802.1Q-tagged frames for every VLAN on the trunk, and can send frames tagged for any VLAN.
Once the port is a trunk, the attacker can sniff traffic, send ARP spoofing attacks, or reach servers on VLANs that were meant to be unreachable. From the network's point of view, the attacker is simply another switch.
The fix is simple and absolute: never leave a port in a dynamic mode. Every port should be explicitly configured as either an access port or a trunk port, and DTP should be disabled with switchport nonegotiate.
How does double tagging work?
Double tagging exploits the native VLAN. The attacker sends a frame with two 802.1Q tags: an outer tag matching the trunk's native VLAN and an inner tag matching the target VLAN. The first switch strips the outer tag and forwards the frame; the second switch reads the inner tag and delivers it to the victim VLAN.
Here is the sequence in detail. The attacker sits on an access port in VLAN 1, which is also the native VLAN on the trunk between two switches. They craft a frame with an outer tag of VLAN 1 and an inner tag of VLAN 20, the victim's VLAN.
- The first switch receives the frame on an access port in VLAN 1. It sees the outer tag matches the native VLAN, so it strips that tag and forwards the frame onto the trunk — still carrying the inner VLAN 20 tag.
- The second switch receives the frame on its trunk port, reads the remaining VLAN 20 tag, and delivers the frame to a port in VLAN 20.
- The frame arrives at the target host as though it had been sent from another device on VLAN 20, bypassing any Layer 3 filtering that was supposed to protect that server.
Double tagging has two hard limits. First, it only works when the attacker's access VLAN is the same as the trunk's native VLAN — which is why moving the native VLAN to an unused VLAN kills it. Second, it is one-way: replies from the victim go back through the normal path and are never delivered to the attacker.
One-way does not mean harmless. The attack can be used for denial-of-service flooding, for sending spoofed packets to services that do not need a reply, and for exploiting servers that accept single-packet attacks. NetworkLessons tested double tagging against a Cisco Catalyst 3560 with Scapy and found the switch rejected the crafted frames in that test — but the attack remains a documented risk, and the mitigation costs nothing.
Switch spoofing vs double tagging: what is the difference?
Both attacks cross VLAN boundaries at Layer 2, but they work differently, need different conditions, and are stopped by different settings. Switch spoofing gives the attacker full two-way access to every VLAN; double tagging gives one-way access to one chosen VLAN.
| Switch spoofing | Double tagging | |
|---|---|---|
| Mechanism | DTP packets negotiate a trunk | Two 802.1Q tags on one frame |
| What it needs | Port in dynamic auto or dynamic desirable mode | Attacker's VLAN equals the trunk's native VLAN |
| Direction | Two-way: send and receive on any VLAN | One-way only: send into the victim VLAN |
| Scope | All VLANs allowed on the trunk | One target VLAN per crafted frame |
| Tools used | Yersinia and similar DTP tools | Scapy or any raw frame crafter |
| Main fix | Explicit port mode plus switchport nonegotiate | Move the native VLAN to an unused VLAN |
| Strongest fix | Disable DTP on every port | Tag the native VLAN with vlan dot1q tag native |
An attacker who can do switch spoofing will usually prefer it, because it gives complete access. Double tagging is the fallback when DTP is disabled but the native VLAN is still left on VLAN 1 with user devices. Both fail if the switch is configured correctly — which is why VLAN hopping is best understood as a misconfiguration problem, not a protocol flaw.
How do you prevent VLAN hopping?
Preventing VLAN hopping is a short configuration checklist, not a product purchase. Apply it to every access-layer switch, then verify it, because a single forgotten port can undo the whole effort.
Lock down access ports
Set every port that connects to a computer, printer, phone or access point to access mode explicitly, and disable DTP negotiation on it:
Switch(config-if)# switchport mode access
Switch(config-if)# switchport nonegotiate
The first command pins the port to access mode so it can never become a trunk. The second stops the port sending or responding to DTP frames at all. Apply this to every access port, including ports in meeting rooms and other public areas.
Harden trunk ports
Trunk ports between switches should be configured manually, never negotiated:
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport nonegotiate
Switch(config-if)# switchport trunk allowed vlan 10,20,30
Limiting the allowed VLAN list matters: a trunk that carries only the VLANs it needs gives a successful attacker far less to work with than the default, which allows every VLAN on the switch.
Move the native VLAN off VLAN 1
Change the native VLAN on every trunk to an unused VLAN ID that no access port belongs to, for example VLAN 999:
Switch(config-if)# switchport trunk native vlan 999
Also make sure no hosts sit on VLAN 1. Assign every access port to a real VLAN with switchport access vlan 2 or similar. With no user devices on the native VLAN, there is nobody in a position to launch a double tagging attack.
For the strongest protection, tag the native VLAN explicitly on all switches with the global command vlan dot1q tag native. This forces even native VLAN frames to carry an 802.1Q tag, which removes the double tagging vector entirely. It must be configured on every switch in the network to work.
Add the surrounding Layer 2 controls
VLAN hopping is one of several Layer 2 attacks that share the same root cause — trusting whatever is plugged into a port. The same hardening pass should include disabling unused ports and placing them in an unused VLAN.
It should also include port security to limit MAC addresses per port, and DHCP snooping and dynamic ARP inspection where your switches support them. Our guide to securing your Wi-Fi covers the wireless side of the same problem, where an attacker does not even need a cable.
How do you detect a VLAN hopping attempt?
Detection is harder than prevention, because a successful attack looks like ordinary switch traffic. Still, several signs are worth monitoring. Unexpected DTP frames on access ports are the clearest signal of switch spoofing — no legitimate end device should ever speak DTP. Log and alert on trunk negotiations that were not planned.
Watch for frames with double 802.1Q tags arriving on access ports, and for traffic on a VLAN from a MAC address that belongs to a different VLAN. Port security violations, unexpected MAC addresses appearing on server VLANs, and a sudden trunk coming up on a port that should be an access port are all worth investigating.
The most reliable check is configuration auditing rather than traffic monitoring. Run show interfaces switchport regularly and compare the output against your intended design: every port should be in the mode you set, with negotiation off, and the native VLAN should be the unused one you chose. A port that drifted back to dynamic mode is a finding, whether or not anyone attacked it yet.
What mistakes leave networks open to VLAN hopping?
The most common mistake is assuming VLANs are a security boundary by themselves. A VLAN is a segmentation tool, not a firewall. Without the hardening steps above, it is a polite suggestion that an attacker can ignore. Other frequent mistakes include leaving default settings in place after installation, forgetting the ports in public areas, and configuring one switch correctly while leaving the next one untouched.
Another mistake is treating the native VLAN as unimportant. Because native VLAN traffic is untagged, it is easy to forget it exists — but it is exactly the traffic double tagging abuses.
The same goes for VLAN 1: it is the default for every port, so any port an administrator forgot to assign is sitting on VLAN 1, which is usually also the native VLAN. That combination is the textbook double tagging setup.
Finally, many teams harden their switches once and never check again. Configuration drifts: someone enables a port for a temporary device, a replacement switch ships with defaults, a new site is built from an old template. Put the switchport checks into your regular audit routine, alongside the items in our small business cybersecurity checklist.
The bottom line
VLAN hopping is not an exotic exploit. It is what happens when switches are left in their default state: DTP enabled, ports negotiating, VLAN 1 everywhere. An attacker with a laptop and a wall jack can turn those defaults into access to your server VLAN.
The fix is a short, free configuration change — explicit port modes, switchport nonegotiate, an unused native VLAN, and no hosts on VLAN 1 — applied to every switch and verified regularly.
The same discipline applies at the router, so see our guide to setting up port forwarding for the Layer 3 side of your network. Do that, and VLAN hopping stops being an attack and goes back to being a textbook diagram.
Frequently asked questions
What is VLAN hopping in simple terms?
VLAN hopping is an attack that lets a computer on one VLAN reach devices on a different VLAN, even though the VLANs are supposed to be isolated. The attacker abuses how switches handle trunk links and VLAN tags, so traffic crosses a boundary that a router or firewall never gets a chance to inspect.
What are the two types of VLAN hopping?
Switch spoofing and double tagging. In switch spoofing, the attacker sends Dynamic Trunking Protocol (DTP) packets to convince a switch to turn an access port into a trunk, giving access to every VLAN on that trunk. In double tagging, the attacker sends a frame with two 802.1Q tags so the first switch strips the outer tag and the second switch delivers the frame to the target VLAN.
Can VLAN hopping be done remotely?
No, the attacker needs a foothold on the local network first, such as a plugged-in laptop, a compromised device on a wall jack, or a virtual machine on the same switch. VLAN hopping is a Layer 2 attack, so it cannot be launched from the internet directly. That is why physical port security and guest network isolation matter.
Is double tagging a two-way attack?
No. Double tagging is one-way only: the attacker can send frames into the victim VLAN, but replies are not forwarded back to the attacker. It is still dangerous because it can be used for denial-of-service attacks, spoofed traffic, and attacks against servers that accept one-way packets, such as flooding a target or exploiting a service that does not need a reply.
Does a firewall stop VLAN hopping?
Not on its own. VLAN hopping happens at Layer 2, below the level where a firewall or router inspects traffic, so the attack bypasses Layer 3 controls entirely. The fix is switch configuration: disable trunk negotiation, set explicit port modes, and move the native VLAN to an unused VLAN.
How do I know if my network is vulnerable to VLAN hopping?
Check your switch configuration. You are vulnerable if any access ports are in dynamic auto or dynamic desirable mode, if DTP is enabled, if hosts sit on VLAN 1, or if the native VLAN on a trunk matches a VLAN that has user devices. The command show interfaces switchport on Cisco switches shows the operational mode and negotiation state of each port.
Is VLAN hopping still a risk on modern switches?
Yes, because the risk comes from default settings, not old hardware. Many switches still ship with DTP enabled and VLAN 1 as the default native VLAN. Modern switches can also tag the native VLAN explicitly with vlan dot1q tag native, which removes the double tagging vector entirely, but only if that setting is actually configured.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the Wikipedia VLAN hopping article, NetworkLessons' hands-on switch testing, and the IEEE 802.1Q tagging standard.
How we write and fact-check →