Skip to content

CCNA course / Connect devices with switches ยท Step 1 of 11

Step: Learn how VLANs workSwitch
New to networking? Start with the fundamentals

VLANs explained: one switch, many networks

Follow a frame from an access port, across an 802.1Q trunk, and into the right broadcast domain.

LabFabric team11 min read
A switch connecting staff, guest wireless and security cameras in separate VLANs, with a trunk to a router

The cabling is physical. The network boundaries are logical.

A VLAN is a logical Layer 2 network. It lets one physical switch behave as if it were several separate switches, each with its own broadcast domain.

The core idea

Without VLANs, every port on a basic switch belongs to the same broadcast domain. An ARP request sent by one host is flooded toward every other active port in that domain.

Create VLAN 10 for staff, VLAN 20 for guests and VLAN 30 for cameras, and the switch keeps those floods separate. A staff broadcast never reaches a guest phone simply because both devices plug into the same switch.

A VLAN is not a subnet, but in a clean design each VLAN normally maps to one IP subnet.

VLAN 10

Staff

10.10.10.0/24

VLAN 20

Guest

10.10.20.0/24

VLAN 30

Cameras

10.10.30.0/24

Choosing those subnets is its own skill. Subnetting explained walks through the method with worked examples.

Access ports give devices a VLAN

An access port carries traffic for one VLAN. The connected laptop, printer or camera normally sends ordinary untagged Ethernet frames. The switch associates those frames with the configured access VLAN when they arrive.

interface GigabitEthernet1/0/12
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast

The device does not need to know that VLAN 10 exists. VLAN membership is a property of the switch port.

Trunks carry several VLANs at once

Without trunking, every VLAN would need its own cable between switches. An 802.1Q trunk avoids that by inserting a four-byte tag into Ethernet frames crossing the link. The tag includes the VLAN identifier, so the receiving switch knows which logical network owns the frame.

Follow one Ethernet frame across two switches

Choose a VLAN and watch where the 802.1Q tag exists.

Staff device

untagged

SW1

802.1Q trunk

SW2

Destination

untagged

Frame on the wire

DestinationSource802.1Q ยท VLAN 10Payload

1 ยท ENTER

The access port assigns the untagged frame to VLAN 10.

2 ยท CROSS

The trunk adds an 802.1Q tag (unless this is the trunk's native VLAN) so the next switch keeps the identity.

3 ยท LEAVE

The egress access port removes the tag before delivery.

interface GigabitEthernet1/0/48
 switchport mode trunk
 switchport trunk allowed vlan 10,20,30
 switchport trunk native vlan 99

Restricting the allowed list does not create the VLANs. It only controls which existing VLANs may cross that trunk.

The native VLAN handles untagged trunk traffic

On a standard 802.1Q trunk, frames in the native VLAN are untagged by default. Both ends must therefore agree on which VLAN an untagged frame belongs to.

ALIGNED

Native VLANs must agree

An untagged frame has no VLAN ID. Each switch assigns one when it arrives.

Switch A ยท native VLAN

99

Sends the frame untagged

Across the trunk

Untagged frame

Switch B ยท classifies as

99

Same broadcast domain

Both switches classify the frame into VLAN 99.

Untagged traffic stays in one broadcast domain across the trunk.

A mismatch can leak untagged traffic between broadcast domains and produces confusing connectivity faults. Cisco Discovery Protocol commonly reports the disagreement directly.

Different VLANs need a router

A switch forwards frames inside a VLAN. Traffic from VLAN 10 to VLAN 20 must cross a Layer 3 boundary, even when both devices connect to the same physical switch.

PACKET PATH

  1. Staff host: sends the packet to its default gateway because the guest address is remote.
  2. Router or SVI: applies Layer 3 policy and routes toward the guest subnet.
  3. Guest VLAN: receives a new Ethernet frame carrying the routed packet.

This is where firewalls and ACLs can decide whether staff may reach cameras, whether guests may reach anything internal, and which services remain available.

Controllers automate this design at scale; for a real controller deployment, follow the Catalyst Center installation guide for ESXi.

A practical branch-office design

VLANPurposeSubnetPolicy
10Staff10.10.10.0/24Internal services and internet
20Guest Wi-Fi10.10.20.0/24Internet only
30Cameras10.10.30.0/24Recorder and management only
99Native / unusedNo user subnetNo access ports

The VLAN creates separation at Layer 2. The router, firewall or multilayer switch enforces what may cross between those segments.

Troubleshoot in this order

  1. 1

    Confirm access membership

    show vlan brief proves that the VLAN exists and that the host port belongs to it.

  2. 2

    Inspect the port

    show interfaces switchport reveals operational mode, access VLAN and native VLAN.

  3. 3

    Check the trunk

    show interfaces trunk shows which VLANs are allowed, active and forwarding.

  4. 4

    Verify Layer 3

    show ip interface brief confirms that the SVI or router subinterface providing the gateway is up.

Break and repair a real trunk

Diagnose a native VLAN mismatch, read the switch evidence, align both ends and verify that hosts can communicate again.

Open the VLAN lab

Check your understanding

VLANs and trunking

All 7 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.