Marcio Cunha

How to configure VLANs on managed switches step by step

Learn how to segment corporate network traffic, configure trunk and access ports on managed switches, and troubleshoot inter-VLAN routing failures.

Marcio Cunha•4 min
Also available in:PortuguêsEspañol
Summary
  • Splitting physical networks into logical subnets protects sensitive data and reduces excessive broadcast traffic storms.
  • Access ports connect end-user devices without tagging awareness, whereas trunk ports carry multiple traffic streams simultaneously.
  • The IEEE 802.1Q encapsulation standard inserts a four-byte tag into the Ethernet frame to identify the originating group.
  • Devices in isolated networks require a router or a layer three switch to pass data between each other in a controlled manner.
  • Common misconfigurations involve omitting the native VLAN or introducing mismatched allowed lists on trunk links.

Why segment your corporate network with VLANs

In a growing computer network, placing every single device on the same subnet seems simple at first, but brings terrible headaches as the company scales. When finance department computers, printers, guests, and servers share the same physical and logical space, any broadcast storm—the background chatter computers make to find each other—consumes available bandwidth. In practice, this means generalized slowness and severe security gaps, since an attacker or infected computer gains free rein over the entire infrastructure.

The remedy for this chaos is the use of VLANs, short for Virtual Local Area Networks. This technology allows you to slice a single physical switch into multiple virtual switches completely isolated from one another by software. Each slice behaves as if it were in a different building, unable to see the rest. To connect different virtual networks and allow controlled traffic between them, practitioners often align with solid patterns, such as how to isolate IoT network traffic with VLANs and firewall rules, ensuring smart devices remain strictly confined.

Understanding the difference between access and trunk ports

To make VLANs work in practice, you must master the two main roles a switch port can assume: the access port and the trunk port. The access port is where we plug regular computers, IP phones, or printers. It assumes the end device knows nothing about VLANs, accepting ordinary data and stamping an internal tag so the switch knows which group that cable belongs to. It is a one-way street dedicated to a single logical destination.

The trunk port, on the other hand, is the main backbone of the corporate network, used strictly to connect a switch to another switch or a router. It has the capacity to carry packets from dozens of different VLANs mixed over the exact same physical cable. For the receiving switch to know who is who, the international standard IEEE 802.1Q inserts a small four-byte numeric tag into each data frame. Without this marking, crossing multiple departments over a single network cable without mixing the streams would be impossible.

Step-by-step guide to configuring VLANs on a switch

Configuring a managed switch requires access to the command line interface or the manufacturer's web dashboard. The standard procedure involves creating the network logic, defining which ports are access, and setting up the trunk links. Below is the basic workflow using a standard CLI based on Cisco-style commands:

  1. Access the switch command line and enter global configuration mode by typing
    enable
    configure terminal
  2. Create the desired VLAN by providing the ID number and a descriptive name with the commands
    vlan 20
    name FINANCE
  3. Assign a specific physical port to act in access mode for the created VLAN using the sequence
    interface GigabitEthernet 0/1
    switchport mode access
    switchport access vlan 20
  4. Convert an uplink port to trunk mode allowing tagged traffic with the commands
    interface GigabitEthernet 0/24
    switchport mode trunk
    switchport trunk allowed vlan add 10,20,30

After applying these commands, it is crucial to save the configuration to the device permanent memory to prevent data loss during power outages. In complex environments, performance issues on these links may arise, making it useful to check how to check switch latency via SNMP to monitor traffic behavior in real time.

How to resolve inter-subnetwork routing failures

Creating VLANs and configuring ports solves internal isolation, but introduces a new challenge: computers in VLAN 10 can no longer talk to computers in VLAN 20, because VLAN isolation acts like impenetrable castle gates. For different subnets to exchange data, traffic must be routed. This is handled by an external router or a layer three switch, a device capable of understanding IP addresses and making forwarding decisions across distinct virtual networks.

When routing fails, the most common symptoms are expiring pings and systems losing connection to the central server. The most frequent error occurs in the default gateway configuration on workstations or in the absence of active routes on the router. Another classic failure is a mismatch in the native VLAN—the network carrying untrusted or untagged data over the trunk link—which must be identical on both ends of the link to prevent silent packet drops. To explore these architectural concepts further in production, see our related technical analysis on How to test SMD capacitors on board with a multimeter.

Final considerations on network stability

Managing corporate networks through VLANs requires disciplined documentation and rigorous preventive maintenance. Small typos in trunk commands or inverted ports can take down entire departments in seconds. Keeping physical and logical mapping updated prevents hours of work during critical incident resolution. With proper segmentation, your infrastructure gains performance, predictability, and, above all, a robust security layer against unwanted access.

Investing time in the initial planning of the IP addressing table and VLAN numbering saves rework in the future. Testing every change before applying it in production environments ensures business continuity. Successful network engineering balances the rigidity of security rules with the operational simplicity required for day-to-day support teams.