All lessons
Intermediate·25 minute read

VLANs: access ports vs trunks

Short answer

An access port carries one VLAN and sends its frames untagged, so the host never sees a VLAN. A trunk port carries many VLANs over one cable and marks each frame with a 4-byte 802.1Q tag naming its VLAN. Hosts in different VLANs need a router or a Layer 3 switch to talk.

A VLAN (Virtual LAN) lets a single physical switch behave like several independent switches, separating broadcast domains without any additional hardware. This lesson explains access ports, trunk ports, and the 802.1Q tagging that lets multiple VLANs cross a single cable.

Open this lab

Why VLANs exist

Every port on a switch belongs to exactly one broadcast domain. By default, that is VLAN 1 — every port. A broadcast frame received on any port floods to every other port.

VLANs let you group ports into separate broadcast domains. Ports in VLAN 10 are isolated from ports in VLAN 20 even though both groups share the same physical switch. Hosts in different VLANs cannot communicate directly — they need a router (or an L3 switch) to forward between them.

Access vs trunk

An access port carries traffic for exactly one VLAN — the access VLAN. Frames enter and leave untagged, so the connected host is unaware that VLANs exist.

A trunk port carries traffic for many VLANs over a single cable. Frames are tagged with a 4-byte 802.1Q header that names their VLAN. The receiving switch reads the tag, strips it, and delivers the frame to the right VLAN's broadcast domain.

Configure access ports in the lab

In NetForge-AI, every switch port defaults to access mode in VLAN 1. Click a switch on the canvas, find the interface row, and you can edit the VLAN number directly. Or drop into the CLI:

Switch> enable
Switch# configure terminal
Switch(config)# interface Fa0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# end

When you absolutely need a router

Two PCs in VLAN 10 ping each other through a switch — works. Move PC2 to VLAN 20 — the ping fails. Even though they're plugged into the same switch, they are now in different broadcast domains. Adding a router with two interfaces (or one trunked router-on-a-stick interface) restores reachability via inter-VLAN routing.

Note: VLAN segmentation is a security and scalability tool — it limits broadcast scope and prevents accidental cross-talk between organizational groups.

Common questions

What is the difference between an access port and a trunk port?
An access port belongs to one VLAN and its frames are untagged. A trunk carries several VLANs and tags each frame with an 802.1Q header so the far switch knows which VLAN it belongs to.
Why can't two PCs on the same switch ping each other?
If their ports are in different VLANs they are in different broadcast domains. Put both ports in the same VLAN, or route between the VLANs.
What is a native VLAN?
The one VLAN a trunk carries untagged. Both ends of the trunk must agree on it, or frames leak between VLANs.
How do VLANs talk to each other?
Through a router — one interface per VLAN, or one trunked interface with a subinterface per VLAN (router on a stick) — or through a Layer 3 switch with a VLAN interface per VLAN.

Practice this in the lab

Reading helps. Wiring it up yourself and breaking it makes it stick.

Open the lab