Networking

What Is a VLAN? How VLANs Work and How to Configure Them (Step-by-Step)

By adminNovember 30, 2026 4 min read

If you work with office networks, CCTV systems or Wi-Fi, you will hear the word VLAN again and again. In this guide you will learn what a VLAN is, how it works, why every serious network uses it, and how to configure one on a switch step by step.

What Is a VLAN?

A VLAN (Virtual Local Area Network) is a way to split one physical switch into several separate logical networks. Devices in one VLAN can talk to each other directly, but they cannot reach devices in another VLAN unless a router or Layer 3 switch allows it.

Think of one large office floor divided by glass walls into rooms. The floor (the switch) is the same, but each room (VLAN) is isolated.

Why Use VLANs?

  • Security: Keep guest Wi-Fi, CCTV cameras, servers and staff computers separate.
  • Less broadcast traffic: Each VLAN is its own broadcast domain, so the network runs faster.
  • Easy management: Group devices by department, not by physical location.
  • Lower cost: You do not need a separate switch for every network.

How Does a VLAN Work?

VLANs use the IEEE 802.1Q standard. When a frame travels between switches, a small 4-byte tag is added that carries the VLAN ID (1 to 4094). The receiving switch reads the tag and delivers the frame only to ports in that VLAN.

Access Port vs Trunk Port

Port type Carries Used for
Access port One VLAN, untagged PCs, printers, cameras, access points
Trunk port Many VLANs, tagged Switch to switch, switch to router or firewall

Common VLAN Types

  • Data VLAN: normal user traffic.
  • Voice VLAN: IP phones and PBX traffic with priority (QoS).
  • Management VLAN: used to manage switches, firewalls and access points.
  • Native VLAN: the VLAN whose traffic is sent untagged on a trunk.

Example VLAN Plan for a Small Office

VLAN ID Name Subnet
10 Staff 192.168.10.0/24
20 CCTV 192.168.20.0/24
30 Guest 192.168.30.0/24
99 Management 192.168.99.0/24

Tip: use the VLAN ID as the third octet of the subnet. It makes troubleshooting much easier.

How to Configure a VLAN on a Switch (Cisco-Style Example)

Step 1: Create the VLANs

Switch# configure terminal
Switch(config)# vlan 10
Switch(config-vlan)# name Staff
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name CCTV
Switch(config-vlan)# exit

Step 2: Assign Access Ports

Switch(config)# interface fastEthernet 0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10

Step 3: Configure the Trunk Port

Switch(config)# interface gigabitEthernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20,30,99

Step 4: Verify

Switch# show vlan brief
Switch# show interfaces trunk

Step 5: Enable Inter-VLAN Routing (if needed)

Devices in different VLANs need a Layer 3 device to talk to each other. You can use a firewall or router with sub-interfaces (router-on-a-stick) or a Layer 3 switch with SVIs. On a firewall such as FortiGate you can also decide exactly which VLAN may reach which, using firewall policies. That is the best way to allow staff to see cameras while blocking guests completely.

VLAN Best Practices

  1. Never use VLAN 1 for user traffic. Change the native VLAN to an unused ID.
  2. Allow only the required VLANs on each trunk.
  3. Shut down unused switch ports and place them in an unused VLAN.
  4. Keep a documented VLAN and IP plan.
  5. Put guest Wi-Fi and IoT devices in their own VLANs with limited access, and secure your home Wi-Fi router as well.

Common VLAN Problems and Fixes

  • Device gets no IP address: check that the DHCP server or relay exists for that VLAN.
  • VLAN does not pass between switches: the VLAN is missing on the trunk’s allowed list or not created on the other switch.
  • Native VLAN mismatch warning: make both ends of the trunk use the same native VLAN.

Frequently Asked Questions

Is a VLAN the same as a subnet?

No. A VLAN is a Layer 2 separation, a subnet is a Layer 3 addressing range. In practice we map one VLAN to one subnet.

How many VLANs can I create?

The 802.1Q standard supports VLAN IDs from 1 to 4094.

Do VLANs improve security?

Yes, they limit who can talk to whom, but they are not a replacement for a firewall. Always combine VLANs with access rules.

Do I need a managed switch?

Yes. Unmanaged switches do not support VLANs.

Conclusion

VLANs are the foundation of a clean, secure and scalable network. Start with a simple plan, create your VLANs, set access and trunk ports correctly, and control traffic between VLANs with a firewall. Practise this in a homelab with Packet Tracer or EVE-NG and you will be ready for real projects and for networking certifications.

Categories: Networking