Marcio Cunha

How to Configure VLANs on Managed Switches for IoT and Servers

Learn how to segment your network to keep insecure IoT devices away from your critical servers. A practical guide to VLAN configuration and trunking.

Marcio Cunha•3 min
Also available in:PortuguêsEspañol
Summary
  • VLAN segmentation creates logical barriers that prevent traffic from vulnerable IoT devices from reaching sensitive servers on the same physical infrastructure.
  • Defining access ports and trunk ports clearly dictates which data flows within each segment and how switches handle traffic identification tags.
  • Correct configuration of VLAN IDs and native VLANs is critical to prevent malicious packets from leaking between isolated networks due to mapping errors.
  • Network isolation is an essential security layer for those maintaining home servers who want to avoid intrusions coming from gadgets without updates.
  • Testing connectivity after creating VLANs requires close attention to IP addressing and routing rules that allow or block communication between domains.

Why segment your network with VLANs?

Imagine your local network is a large open-plan office. If all departments (HR, Finance, Guests) are in the same room, any conversation can be heard by anyone. In computing, we call this a single broadcast domain. If a cheap, insecure IoT device gets infected, it could try to scan your entire network looking for critical servers. Using VLANs, or Virtual LANs, is like putting each department in a room with a locked door, where communication only flows through a 'doorman' (the router or firewall).

Understanding port modes: Access vs. Trunk

Before touching the switch interface, we need to master two essential concepts: access ports and trunk ports. An access port is what you use to connect your PC, server, or smart light; it belongs to a single VLAN and doesn't expect data packets to carry tags. A trunk port is the channel between two switches (or between a switch and router) that carries traffic for multiple VLANs simultaneously. For the destination to know which VLAN a packet came from, the switch attaches a tag following the 802.1Q standard. This is vital because it prevents critical server data from mixing with camera or sensor traffic, just as we do when we configure LACP link aggregation on switches to double bandwidth without packet collisions.

Step-by-step: Configuring network isolation

To implement this scenario, we'll assume you are using a Layer 2 or Layer 3 managed switch. The goal here is to create VLAN 10 for servers (trust) and VLAN 20 for IoT devices (untrust). Follow the steps below using your equipment's CLI or web panel:

  1. Create the VLANs in the switch database, ensuring IDs 10 and 20 are globally active.
  2. Configure the ports designated for your servers as 'Access' and assign them to VLAN 10.
  3. Configure the ports receiving your IoT devices as 'Access' and assign them to VLAN 20.
  4. Set the uplink port, which connects to your firewall or router, as 'Trunk', allowing traffic for VLANs 10 and 20 (configuring VLAN 1 as native only if necessary).
  5. Validate the switch MAC address table to confirm devices are being learned on the correct VLAN.

Validating security and routing

After configuring physical segmentation, traffic will only be able to cross the boundaries between VLANs if you have a router or firewall with 'Inter-VLAN Routing' support. Practically, this means your firewall receives the packets, analyzes if access between the IoT VLAN and the Server VLAN is permitted by your ACL (Access Control List) rules, and only then forwards the traffic. This is the most effective way to protect your environment, keeping centralized control even when you need to inspect IoT MQTT traffic to diagnose anomalous behavior. If you have hardware doubts, know that testing equipment integrity is as important as logic; if a device fails, start by checking components as if you were testing MOSFET transistors on board with a multimeter to rule out physical issues before blaming network configuration.

Final considerations

Implementing VLANs transforms a chaotic home or corporate network into a professional, resilient, and secure environment. By isolating IoT devices, you minimize the attack surface and gain visibility over the traffic traversing your infrastructure. Always remember to document which VLAN IDs correspond to which IP subnets, avoiding conflicts that can take down essential services. Network management is a continuous learning process where organization and discipline overcome any complex technique.