Course contents

Chapter 4: VLANs and TrunksLesson 1 of 14

Why VLANs exist and VLAN roles

Can employees, visitors and cameras share a switch without sharing every broadcast? Let's separate their local traffic and see what still needs a router or firewall.

Beginner · 6 min read

Why not leave every port in one network?

Situation: an office has employees, guests and security cameras, all plugged into the same switches. Employees need company servers, guests should only reach the internet, and cameras should only talk to their recorder.

Without VLANs they'd all share one broadcast domain: broadcasts spread across the shared Layer 2 network. With VLANs (Virtual LANs), each group becomes its own logical network on the same hardware:

A VLAN (Virtual Local Area Network) groups traffic within a Layer 2 boundary. Layer 2 means Ethernet frame forwarding using MAC addresses. A broadcast is a frame addressed to all devices in its local group; that group is its broadcast domain.

A VLAN separates local Ethernet traffic; an access rule or firewall decides what routed traffic may pass between VLANs. Creating a guest VLAN does not itself configure internet access or block every path to employee servers.

GroupVLANSubnetGateway
Employees10192.168.10.0/24192.168.10.1
Guests20192.168.20.0/24192.168.20.1
Cameras30192.168.30.0/24192.168.30.1

A VLAN separates Layer 2 traffic; a subnet is the IP addressing plan for it. They come in pairs in this design, but they're different things: one is a switch setting, the other is IP addressing. Changing a PC's subnet mask does not move its switchport to another VLAN.

Each VLAN is a separate broadcast domain

Situation: the employee laptop needs the printer's MAC address, so it sends an ARP (Address Resolution Protocol) broadcast asking which local interface owns 192.168.10.20. The MAC identifies an Ethernet receiver; it is different from the printer's IP address.

SW1VLAN 10EmployeeGi1/0/1VLAN 10PrinterGi1/0/2VLAN 20GuestGi1/0/3VLAN 30CameraGi1/0/4

Device key: SW1 (switch) · Employee, Guest (laptop) · Camera (computer)

Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

  1. 1. Broadcast arrives. It enters Gi1/0/1, an access port in VLAN 10, so the switch treats it as VLAN 10 traffic.
  2. 2. Flooded within VLAN 10 only. The switch sends it out every other VLAN 10 port (the printer) and nowhere else.
  3. 3. Other VLANs are separate. A guest broadcast stays in VLAN 20 the same way; the employee and camera never see it.
One switch, three VLANs: the employee request reaches the VLAN 10 printer, not the guest or camera. No routed path is shown.

Why: a switch only floods a frame to ports in the same VLAN as the port it arrived on. Each VLAN therefore behaves like its own physical switch.

How to verify

The switch learns MAC addresses in a VLAN context. The employee and printer are listed under VLAN 10; nothing from VLAN 10 appears in VLAN 20:

Illustrative Cisco Catalyst IOS XE output, written for this lesson
SW1#show mac address-table vlan 10
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
  10    0200.0000.0010    DYNAMIC     Gi1/0/1
  10    0200.0000.0020    DYNAMIC     Gi1/0/2
Total Mac Addresses for this criterion: 2

The VLAN column is part of the lookup. The entries show that source frames were learned on Gi1/0/1 and Gi1/0/2 in VLAN 10. They do not prove that a print service is running or that its IP settings are correct.

Data, voice, management and other VLAN roles

Some VLAN names describe a purpose (voice, management, guest); others describe behaviour (native, default). A VLAN can have more than one role, and all of them are ordinary VLANs underneath.

Data VLAN

Carries ordinary user traffic: web, email, files, applications. Example: employee laptops and printers in VLAN 10, as above.

Voice VLAN

A VLAN-aware phone can learn its voice VLAN through Cisco Discovery Protocol (CDP) or Link Layer Discovery Protocol Media Endpoint Discovery (LLDP-MED), depending on equipment and configuration. The phone can then label its voice traffic separately from the PC data it passes through.

Situation: a desk phone sits between the wall port and a PC, so one switch port serves both. The phone's calls should be separated from the PC's data.

VLAN 10PCdataVLAN 40IP phonevoiceSW1Gi1/0/5Network

Device key: PC (computer) · IP phone (desk phone) · SW1 (switch) · Network (network / service)

Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

  1. 1. The phone learns its VLAN. The switch advertises the voice VLAN with CDP or LLDP-MED (depending on the equipment).
  2. 2. Voice is tagged. The phone tags its own voice traffic with VLAN 40.
  3. 3. Data stays untagged. The PC's frames pass through the phone untagged, and the switch puts them in access VLAN 10.
The VLAN-aware phone tags its voice traffic while passing this PC's untagged data. The switchport has separate data and voice settings.

This voice-port example assumes Cisco Catalyst IOS XE, with VLANs 10 and 40 already created. Enter it from global configuration mode. Phone discovery support and interface names depend on the equipment.

interface GigabitEthernet1/0/5 switchport mode access switchport access vlan 10 switchport voice vlan 40

One port, two VLANs: untagged data in VLAN 10, tagged voice in VLAN 40.

Separating voice makes policy and troubleshooting easier, but it doesn't guarantee call quality on its own: quality of service (QoS), which manages competing traffic, may be needed too. A separate VLAN does not create more bandwidth.

Management VLAN

Carries traffic used to manage the network equipment itself (SSH, HTTPS, SNMP). Example: administrators reach the switches at 192.168.100.2 and .3 in VLAN 100. Restrict who can reach it. It isn't an out-of-band network: if the production switches fail, management traffic fails with them.

Default VLAN

Layer 2 access ports on a factory-default Catalyst switch typically belong to VLAN 1. "Default" describes the starting configuration only; moving user and management traffic out of VLAN 1 is common practice.

Native VLAN

Decides how an 802.1Q trunk, a link carrying multiple VLANs, handles untagged frames: incoming untagged frames are placed in the native VLAN, and native-VLAN traffic leaves the trunk untagged (unless native tagging is configured). Both ends must match. Covered in detail in the native VLAN lesson.

Guest VLAN

A separate network for visitors. Example: VLAN 20 can reach the internet but not employee servers. The VLAN separates the traffic; an ACL or firewall rule enforces the "internet only" policy. ("Guest VLAN" is also the name of an 802.1X feature that places unauthenticated devices into a limited VLAN.)

Design-purpose VLANs

Design-purpose VLANs
Design-purpose VLANsName; Example use. Department VLAN: Separate Finance from other employees Server VLAN: Group application servers IoT VLAN: Sensors and building devices Camera VLAN: Cameras and their recorderNameExample useDepartment VLANSeparate Finance from other employeesServer VLANGroup application serversIoT VLANSensors and building devicesCamera VLANCameras and their recorder

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Each item on the left, with what it means on the right.

These are naming conventions, not different kinds of Ethernet. Use ACLs or firewall policy to enforce access between routed VLANs.

Short lab: separate ports, then verify membership

On an isolated Catalyst-style lab switch, create VLANs 10, 20 and 30 with the global vlan command. Give them the names EMPLOYEES, GUESTS and CAMERAS using name in VLAN configuration mode.

  1. Under each interface, use switchport mode access and switchport access vlan <ID>. Assign Gi1/0/1 and Gi1/0/2 to VLAN 10, Gi1/0/3 to 20 and Gi1/0/4 to 30.
  2. Run show vlan brief. Confirm the VLANs are active and the four ports appear under the intended IDs. A VLAN name is a label; the numeric ID determines membership.
  3. Generate traffic between the employee and printer, then read show mac address-table vlan 10. Entries are learned from traffic, so an empty table immediately after startup is not proof of a broken VLAN.
  4. In the isolated lab, deliberately place the printer port in VLAN 20. The employee's ARP request cannot reach it. Restore Gi1/0/2 to VLAN 10, verify membership and repeat the test.

Check the boundary

Predict · scenario 1

The employee sends an ARP broadcast in VLAN 10. Which illustrated device receives it?

Predict · scenario 2

The printer stays on a VLAN 20 port. You change only its IP to 192.168.10.20/24. Does it now receive VLAN 10 broadcasts?

Predict · scenario 3

VLAN 20 must provide guest internet access only. What else is needed when routing is available?

Technical references

Examples assume Cisco Catalyst IOS XE Layer 2 switchports. See Cisco's VLAN configuration guide and voice VLAN guide. Simulator support and defaults vary; outputs are written teaching examples.