logo svg
logo

December 24, 2025

Updated: November 5, 2026

What Is VLAN Tagging? 802.1Q Network Segmentation

A practical guide to IEEE 802.1Q VLAN tagging, trunking, security risks, and best practices.

Mohammed Khalil

Mohammed Khalil

Featured Image

VLAN tagging is the process of inserting a special 802.1Q header into an Ethernet frame to mark it with its VLAN membership. In plain terms, a 4-byte tag (with a TPID of 0x8100 by default) is added between the source MAC address and the EtherType/length field. This tag carries a 12-bit VLAN ID (VID) and priority bits. IEEE 802.1Q is the industry-standard encapsulation method for tagging VLAN information. On a trunk port (a link carrying multiple VLANs), switches add these tags to frames so that the receiving switch can keep traffic separate by VLAN. Without a VLAN tag, switches cannot distinguish which logical segment a frame belongs to, since standard Ethernet has no VLAN field.

VLAN tagging is central to modern networking because it enforces traffic isolation. Each VLAN acts as its own logical network, or broadcast domain. This is important for security (segmentation of sensitive systems), performance (reducing unnecessary broadcasts), and management (separating departments or tenants). For example, a company might put employees on VLAN 10 and guest Wi-Fi on VLAN 20; switches tag the traffic and a router or firewall controls what, if anything, may pass between the two groups. Misconfiguring VLAN tagging, for example a native VLAN mismatch between the two ends of a trunk, leaving user ports in dynamic trunking mode, or leaving the default native VLAN in use, can undermine this isolation. Attackers exploit these weaknesses in VLAN hopping techniques to bypass segmentation. In contrast, public cloud providers do not expose raw VLAN tags; they use Layer 3 constructs instead. For instance, an AWS VPC uses subnets in place of VLANs, with each subnet acting like a VLAN segment, and Microsoft states that Azure virtual networks are Layer 3 overlays that do not support Layer 2 semantics. Understanding VLAN tagging is therefore key for both on-premises network design and for mapping those concepts into cloud networking.

DeepStrike's Red Teaming Services can include scoped segmentation validation after an initial foothold, testing whether VLAN boundaries can be crossed in your environment.

How VLAN Tagging Works

802.1Q VLAN tagging works by inserting a 4 byte header into Ethernet frames on trunk ports. The mechanism involves these steps:

  1. Frame arrives untagged on access port: A host sends a normal Ethernet frame on a switch port. If that port is an access port assigned to VLAN X, the switch treats the frame as belonging to VLAN X.
  2. Tag insertion on trunk: When the switch forwards that frame out a trunk port, it inserts the 802.1Q tag just after the source MAC address. This tag has two parts:
    • TPID (16 bits): 0x8100 indicates the frame is VLAN tagged.
    • TCI (16 bits): Contains a 3-bit Priority Code Point (PCP, the 802.1p QoS value), a 1-bit Drop Eligible Indicator (DEI, formerly CFI, usually 0), and a 12-bit VLAN Identifier. The 12-bit field can hold 0-4095, but 0 (priority-tagged frame, no VLAN) and 4095 are reserved, leaving 1-4094 usable.
  3. Frame travels on trunk: The tagged frame, now 4 bytes longer (max 1,522 bytes total), traverses the trunk link. Each switch along the path reads the tag and uses the VLAN ID to decide which VLAN to associate the frame with.
  4. Tag removal at egress: When the frame leaves a switch on an access port, the 802.1Q tag is removed so the end host receives a normal untagged frame. On a trunk, frames belonging to the native VLAN (VLAN 1 by default on Cisco switches) are also sent untagged, while frames for every other allowed VLAN keep their tag as they cross to the next switch.

In summary, VLAN tagging adds a header that carries the VLAN ID. This tagging allows a single physical link trunk to transparently carry traffic for multiple VLANs, with each switch along the path using the tag to keep traffic segregated. Proper configuration of trunk and access ports is essential so that only the intended VLANs and tags flow on each link.

Real World Examples

Legitimate Uses: VLAN tagging is ubiquitous in enterprise networks. For example, an organization might have separate VLANs for VoIP phone systems, corporate PCs, Wi-Fi guests, and servers. A single fiber link between two core switches can carry all those VLANs if it is a trunk. Each switch adds tags to frames to ensure VLAN 100 traffic (e.g. a finance VLAN) does not mix with VLAN 200 (guest Wi-Fi). In data centers, physical servers or hypervisors often connect via VLAN trunks: a host's physical NIC might be on a trunk, and virtual machines on different VLANs are identified by tags. In service provider networks, Q-in-Q (IEEE 802.1ad) stacks VLAN tags, an outer service tag (S-tag, TPID 0x88A8) around the customer's own 802.1Q tag (C-tag, TPID 0x8100), so customers can bring their own VLANs over a shared backbone. Finally, in the cloud each subnet or security group plays a VLAN-like role: for example, AWS VPCs use subnets to segment traffic just as VLANs do on premises, even though raw 802.1Q tags are hidden from the user. These VLAN setups are seen daily in network diagrams and switch configs of medium to large networks, facilitating management and isolation.

Attack Scenarios: Misuses of VLAN tagging can also appear during security incidents. The classic example is a VLAN hopping attack. One method is double tagging: an attacker whose access port is in the same VLAN as a trunk's native VLAN crafts a frame with two 802.1Q tags. For instance, suppose VLAN 1 is native and VLAN 20 is a secure segment. The attacker sends a frame with an outer tag of VLAN 1 and an inner tag of VLAN 20. The first switch processes the outer tag, and because VLAN 1 is the trunk's native VLAN, it forwards the frame onto the trunk without that tag. The second switch sees only the remaining VLAN 20 tag and delivers the frame into VLAN 20 as if it originated there. The weakness is tracked as CVE-2005-4440. The attack is one-way: the attacker can inject frames into VLAN 20, but replies are not tagged back to the attacker, so it is mainly useful for sending traffic such as a denial-of-service or a single-packet trigger.

Put simply, the attacker on native VLAN 1 reaches a server on VLAN 20 because the first switch removes the outer tag and the inner tag steers the frame into VLAN 20. Another attack is switch spoofing: if DTP (Dynamic Trunking Protocol) is active on a user port, an attacker's device can pretend to be a switch, negotiate a trunk link, and then send and receive traffic for every VLAN allowed on that trunk. On current Cisco Catalyst switches the default switchport mode is dynamic auto, which will form a trunk if the connected device actively requests one. Both methods exploit default or misconfigured trunk settings. These attacks can still succeed on networks that keep default trunk and native VLAN settings, and they may be in scope for penetration tests and Red Team vs Blue Team engagements.

Where Observed: VLAN tags are seen on trunk ports and in network captures between switches. Under normal conditions, access ports should never receive tagged traffic from end hosts. If a host sends tagged frames or negotiates a trunk with a switch, it’s suspicious. Similarly, if an IDS or switch log shows negotiation of a new trunk port when none was intended, it could indicate a switch spoofing attempt. In cloud environments, one might see analogous misconfigurations at the VPC or subnet level, but actual 802.1Q frames do not appear in the cloud; the concerns are more about misassigned subnets or security groups.

Why VLAN Tagging Is Important

VLAN tagging is important because it enforces network isolation and efficient traffic management. By separating users, servers, and applications into different VLANs, organizations limit the scope of broadcast traffic and confine faults or attacks to a single segment. This segmentation is a key defense in depth measure. If an attacker cannot cross VLAN boundaries, a breach stays contained; if VLAN tagging fails, that isolation breaks down. For example, properly segmented VLANs allow a guest Wi Fi VLAN to be completely isolated from the corporate LAN, protecting sensitive data. They also make it easier to apply ACLs or firewalls at inter VLAN routers, because each VLAN is a defined zone.

From a security perspective, VLAN tags implement access controls at Layer 2. Misusing VLAN tags can lead to serious breaches: as Imperva's VLAN hopping overview notes, VLAN hopping "allows attackers to bypass network segmentation" and reach sensitive VLANs. For instance, if an attacker hops into a database VLAN, they might steal or alter data. Misconfigured VLAN tags can also disrupt services: for example, a native VLAN mismatch between two ends of a trunk can leak traffic between VLANs, drop traffic, or contribute to spanning tree loops.

Operationally and for the business, VLAN tagging offers cost and management benefits. It lets one physical network handle many logical VLANs without extra routers or cables. Quality of service (QoS) can be applied using the priority bits in the tag, ensuring voice or video traffic gets higher priority. It also simplifies network changes: administrators can add a new VLAN on switches without rewiring. Conversely, a tagging failure can have a big impact. If a trunk link suddenly carries wrong VLANs or none, many systems could lose connectivity. In regulated industries (e.g. finance, healthcare), VLANs are often used to meet compliance requirements (e.g. isolating cardholder data on its own VLAN). Thus maintaining correct VLAN tagging is essential for security, reliability, and meeting business objectives.

Common Abuse or Misuse If Applicable

When VLAN tagging is abused, it is usually due to legacy defaults or mistakes. The main abuses are forms of VLAN hopping as described above. Double tagging works because the network trusts the native VLAN and silently strips the outer tag; this is purely a logical trick without any special exploit code. It is possible when an attacker's access port sits in the same VLAN as a trunk's native VLAN, which is why leaving users on VLAN 1 (the default native VLAN on many switches) makes it trivial unless changed. Switch spoofing works because Cisco switch ports run DTP by default: older platforms defaulted to dynamic desirable and current ones default to dynamic auto, and either mode will form a trunk with a device that speaks DTP and asks for one. DTP is a Cisco proprietary protocol, so this specific attack applies to Cisco and DTP-compatible switches. In practice, these attacks are effective when networks are poorly locked down: e.g. if an unused port is left in dynamic mode, or if native VLANs are not hardened.

These methods can still succeed on networks that keep default trunk and native VLAN settings. They are stealthy: a double tagged frame looks like a normal frame to the first switch, and a spoofed switch joins the network legitimately. Imperva notes double tagging “is stealthy because the packet appears legitimate to network devices, making detection challenging”. Since standard switches don’t log the inner tag or block it, the attack can go unnoticed on the wire. Similarly, a rogue trunk created via DTP may not raise immediate alarms unless one is watching switch port changes. In summary, VLAN tagging itself is not insecure but its misconfiguration is. Attackers rely on admins not disabling auto trunking, not changing the native VLAN from its defaults, or on access ports erroneously receiving VLAN tagged traffic.

Detection & Monitoring

Detecting improper VLAN tagging or hopping is challenging because most monitoring tools operate at Layer 3 or higher, while VLAN tags exist at Layer 2. However, defenders can watch for indirect signs. Switch logs or SNMP traps may report port configuration changes such as a port entering trunk mode. IDS systems typically don’t analyze VLAN tags by default, but you can use network visibility tools or SPAN ports to capture Ethernet frames and look for anomalies e.g. unexpected double tagged frames on an access port. Imperva recommends close monitoring of “unusual traffic between VLANs” or any irregular cross VLAN flows. For instance, if a PC on VLAN 10 suddenly starts receiving or sending packets on VLAN 20, that’s a red flag.

Another approach is to audit switch configurations regularly. Check that all user-facing ports are in access mode (not trunking), that DTP is disabled (switchport nonegotiate), and that native VLANs are consistent on both ends of every trunk; Cisco CDP, for example, logs a native VLAN mismatch warning when the two sides disagree. Many network management systems can periodically pull VLAN and trunk settings via SNMP or NETCONF to look for changes. Alerting on interface mode changes, unexpected trunk formation, or BPDU Guard violations on access ports can surface rogue switch or trunk attempts. Overall, detection relies on vigilant configuration management and anomaly detection: without explicit logging of 802.1Q frames, defenders look for misbehaving devices or unexpected VLAN crossings.

Mitigation & Prevention

Securing VLAN tagging is largely a matter of correct configuration and controls. Key steps include:

These controls, when combined, prevent or limit VLAN tagging abuses. They do not rely on any proprietary tools and are standard best practices for any switch. Proper VLAN design and discipline go a long way in preventing tagging misuses.

Related Concepts

VLAN tagging is one piece of the broader network segmentation puzzle. For an overview of migration approaches, see how to change ipv4 to ipv6 explained. During a dual-stack transition, teams should review access controls for both protocols to preserve the intended boundaries between network segments. It is closely related to other concepts:

Understanding these related concepts helps see VLAN tagging as part of a layered defense. VLANs alone do not solve all security problems, but they interlock with higher level controls to segment and protect network traffic.

FAQs

A VLAN tag is a 4-byte header added to an Ethernet frame according to the IEEE 802.1Q standard. It consists of a 16-bit TPID (0x8100 for a standard 802.1Q customer tag) and a 16-bit Tag Control Information field (3 bits of priority, 1 DEI bit, and a 12-bit VLAN ID). The VLAN ID (usable values 1-4094; 0 and 4095 are reserved) tells switches which VLAN the frame belongs to.

Access ports send and receive untagged frames and are assigned to a single VLAN. Trunk ports carry multiple VLANs: they tag outgoing frames for all VLANs except the native VLAN. On a trunk, switches add or remove 802.1Q tags as needed to keep traffic separated.

The native VLAN on a trunk is the VLAN whose frames are sent untagged. By default, many switches use VLAN 1 as native. This matters because double tagging attacks depend on the native VLAN’s traffic being untagged. Attackers often exploit VLAN 1 as the native VLAN to insert malicious inner tags. Changing the native VLAN to an unused ID and tagging it is a common mitigation.

In a double tagging attack, an attacker on VLAN A sends a frame with two 802.1Q tags: the outer tag is VLAN A and the inner tag is VLAN B the target. The switch strips the outer tag because VLAN A is the native VLAN of the trunk and forwards the frame based on the inner VLAN B tag, delivering it into VLAN B. This effectively bypasses the normal isolation between VLANs.

Switch spoofing or DTP abuse is an attack where the attacker’s device pretends to be a switch, speaks Cisco’s DTP, and negotiates a trunk port with a switch. Once a trunk is established, the attacker can see and inject traffic into all VLANs carried on that trunk. Disabling DTP and forcing ports to static modes thwarts this.

The key defenses are strict switch port configs: disable DTP and set ports explicitly to access or trunk (no auto-negotiation), avoid using the default VLAN 1 by moving hosts off it and changing the native VLAN on trunks to an unused ID (and tagging it where supported), shut down unused ports, and enable port security or 802.1X so only authorized devices connect. Also limit the allowed VLANs on each trunk to only what is needed. These steps prevent most VLAN tagging exploits.

Not directly. Public clouds (AWS, Azure, etc.) use higher-level segmentation and do not give customers Layer 2 VLAN tagging inside their virtual networks. AWS VPCs rely on subnets, route tables, and security groups to isolate traffic. Microsoft states that Azure virtual networks are Layer 3 overlays and do not support any Layer 2 semantics, so you cannot bring your VLANs into a VNet. In effect, a subnet in the cloud plays a similar role to a VLAN on premises. So while the cloud abstracts away tagging, the logical need for segmentation remains.

VLAN tagging (802.1Q) is the standard way switches carry multiple isolated networks over the same physical links. By adding a small header to Ethernet frames, switches know which logical VLAN each packet belongs to. This is crucial for network segmentation, security, and efficient traffic management. However, it requires careful configuration: default behaviors (native VLANs, DTP) can be abused by VLAN hopping attacks, so administrators must follow best practices: disable auto trunk, change native VLANs, use port security. In modern networks, understanding VLAN tags is fundamental for designing secure multi VLAN architectures on premises to translating those concepts into cloud subnets. Properly used, VLAN tagging enhances security by enforcing logical barriers; improperly handled, it can become an attack vector.

About the Author

Mohammed Khalil is a Cybersecurity Architect at DeepStrike, specializing in advanced penetration testing and offensive security operations. With certifications including CISSP, OSCP, and OSWE, he has led numerous red team engagements, focusing on cloud security, application vulnerabilities, and adversary emulation. His work involves dissecting complex attack chains and developing resilient defense strategies for clients in the finance, healthcare, and technology sectors.

background
Let's hack you before real hackers do

Stay secure with DeepStrike penetration testing services. Reach out for a quote or customized technical proposal today

Contact Us