When I first set up our network with an EdgeRouter X, back in 2020, VLANs were on the list of things I’d “get to later”. Every explanation I found either started with the frame format or assumed I already knew what a trunk was. This is the explanation I would have liked then: what a VLAN is, how the tag works, which ports carry what, and what you need at home to use them.

The problem VLANs solve

A home network starts flat. Everything plugs into the same switch or joins the same Wi-Fi, gets an address from the same range, and can talk to everything else: the laptop, the NAS, the printer, the TV, the light bulbs, and whatever a guest brings with them.

That’s convenient until you think about what is on it. A cheap smart plug with firmware that will never be updated sits next to the server with the family’s photos. A guest’s phone can see the NAS. If one device gets compromised, it can reach all the others, because nothing stands between them.

The fix is to split the network into several smaller ones and decide what may pass between them. You could do that with separate switches and cables for each network. VLANs let you do it with the switches and cables you already have.

What a VLAN actually is

One switch, several separate networks

VLAN stands for virtual LAN. A managed switch that understands VLANs can behave as several switches in one box. Ports in VLAN 10 can talk to each other, ports in VLAN 20 can talk to each other, but a device in VLAN 10 can’t reach a device in VLAN 20 through the switch at all, even though they’re plugged into the same box. (That’s true for an ordinary layer 2 switch. Some switches can route too; more on that below.) Even broadcasts, the “is anyone out there” messages that DHCP and device discovery use, stay inside their own VLAN [4].

Each VLAN has a number, the VLAN ID. The name you give it in your router or controller is just a label for you.

VLANs and subnets

In practice each VLAN gets its own IP subnet. VLAN 30 might be 192.168.30.0/24 and VLAN 40 192.168.40.0/24, each with its own DHCP server handing out addresses in its own range [4].

It helps to keep the two ideas apart. The VLAN is the separation on the wire: which devices can reach each other directly. The subnet is the addressing on top of it. One VLAN, one subnet is the usual pattern, and the one I’d stick to.

How the tag works: 802.1Q

A switch needs to know which VLAN a frame belongs to when it travels over a cable that carries more than one VLAN. The standard for that is IEEE 802.1Q. It inserts a small 4-byte tag into the Ethernet frame, between the sender’s address and the type field [1].

The part of the tag that matters here is the VLAN ID, a 12-bit number. That gives 4096 values, of which 0 and 4095 are reserved, so you can use 1 to 4094 [1]. The tag also has a 3-bit priority field, used for quality of service, which you can ignore at home.

The tag is added and removed by the network equipment. Your laptop normally never sees it: it sends ordinary, untagged frames, and the switch port decides which VLAN they belong to.

Tagged and untagged ports

This is where most of the confusion lives, and where most of my own mistakes have been.

Access ports

An access port belongs to one VLAN. Frames come in untagged from the device, the switch puts them in that port’s VLAN, and frames going out to the device have the tag removed [2] [3]. The device doesn’t know VLANs exist. This is what you use for a PC, a printer or a TV.

UniFi calls this the port’s “native” network and the other vendors may call it “untagged” or the port’s PVID. They mean the same thing: the VLAN for frames without a tag.

Trunk ports

A trunk port carries several VLANs over one cable, with each frame tagged so the other end knows where it belongs [2] [3]. You use trunks between switches, from a switch to the router, from a switch to an access point, and to a server that runs virtual machines on different VLANs.

Both ends of a trunk have to agree on which VLANs it carries. If one end sends VLAN 30 and the other end isn’t set to accept it, the frames are dropped.

The native VLAN and the classic mismatch

A trunk can also carry one VLAN untagged: the native VLAN [1] [2]. Frames that arrive on the trunk without a tag are put in it. By default it’s VLAN 1 on most equipment.

The classic mistake is a native VLAN mismatch: one end of a trunk treats untagged frames as VLAN 1 and the other as VLAN 10. Untagged traffic then leaks silently from one VLAN into the other, with no error anywhere [2]. It looks like “the network works, but the wrong device got an address from the wrong range”. When that happens, check the native VLAN on both ends of every link.

What routes between VLANs

Devices in different VLANs can’t talk to each other through the switch. To get from one VLAN to another, traffic has to go through a router, the same way it would between two physically separate networks [4].

That is the point. The router is where you decide what is allowed: the IoT VLAN may reach the internet but not the server VLAN, guests may only reach the internet, the laptop may reach everything. Those rules are firewall rules on the router. Without them, a router happily routes between all its VLANs, and you’re back to one network with extra steps.

So VLANs alone don’t make anything safer. VLANs plus firewall rules between them do.

A switch that routes

Everything above assumes a layer 2 switch: it moves frames inside a VLAN and nothing else. Further up the range you find switches that can also route between VLANs themselves:

  • Layer 2+ (sometimes “lite layer 3”) switches can route between their VLANs and usually take static routes.
  • Layer 3 switches add dynamic routing protocols such as OSPF on top of that.

The names aren’t strict, so check what a given model actually does. The point for a home network: if the switch routes between two VLANs, that traffic never reaches your router, so the router’s firewall rules don’t see it. The switch’s own access lists have to do the filtering instead. If you want the router to decide what passes between VLANs, leave routing on the switch switched off, or only give the switch an address in the VLAN you manage it from.

What you need to get started

A managed switch

An unmanaged switch ignores tags or drops tagged frames, depending on the model. You need a managed or “smart” switch where you can set each port’s untagged VLAN and the tagged VLANs it carries [3] [4]. Even cheap 8-port smart switches do this now.

A VLAN-aware router or firewall

The router needs an interface per VLAN, each with its own address in that VLAN’s subnet, a DHCP server per VLAN, and firewall rules between them. The EdgeRouter X does this with VLAN interfaces on its switch (switch0.30 for VLAN 30, and so on). OPNsense, pfSense and the UniFi gateways do the same in their own words.

An access point that maps SSIDs to VLANs

Wi-Fi devices don’t do tags either. A VLAN-capable access point lets you tie each SSID, each Wi-Fi network name, to a VLAN. The access point’s cable becomes a trunk, and a phone that joins the guest SSID ends up in the guest VLAN.

VLANs in a hypervisor

A Proxmox server can sit on a trunk too. With a VLAN-aware bridge, each virtual machine or container gets a VLAN tag on its network card, and the bridge adds and removes it, so the guest itself needs no VLAN setup [5]. I went through that in Networking inside Proxmox, part 5 of Proxmox from scratch. The switch port the server is on then has to carry those VLANs tagged.

Where my network is today

Our network has used VLANs for years, but only half of what they can do. The UniFi controller lists six networks: the untagged default network and five VLANs, among them one for IoT devices, one for guests and one meant for management. The EdgeRouter X is the router for all of them. The Wi-Fi does the mapping above: the main SSID is on the untagged network, and the IoT and guest SSIDs each have their own VLAN, so the smart plugs and the guests’ phones are kept apart from our own devices.

One VLAN does a different job. The fibre box and the router aren’t next to each other, so the raw internet connection, unfiltered and straight from the fibre box, travels to the router on its own VLAN over the same switch that carries the filtered networks back out to the access point. The switch keeps the two apart; only the router sits between them.

The wired side hasn’t moved. The servers, the PCs and the switches are still on the untagged Default network, and nothing inside Proxmox uses a VLAN yet. That’s the “before” picture for a later part: which device goes on which VLAN, what the firewall should allow between them, and how to move a running homelab without locking myself out.

Common mistakes

  • Moving the device you manage the switch from. Change your own port’s VLAN and you lose the switch’s web page in the middle of the change. Keep one port, or the management network, on a VLAN you don’t touch until the end.
  • Tagging on one end only. A trunk set up on the switch but not on the access point, the server or the router means the tagged VLANs simply don’t arrive.
  • A native VLAN mismatch on a trunk, as above.
  • Forgetting the firewall. Separate VLANs with an open router between them aren’t separated.
  • Forgetting DHCP. A new VLAN without a DHCP server gives every device on it a self-assigned address and no network.
  • Too many VLANs. Each one is a subnet, a DHCP scope and a set of firewall rules to keep straight. At home, four or five is plenty: trusted devices, servers, IoT, guests, and perhaps management.

Sources

  1. IEEE 802.1Q (Wikipedia), pulled 2026-09-26
  2. Tagged, Untagged, and Native VLANs (Network Direction), pulled 2026-09-26
  3. Fundamentals of 802.1Q VLAN Tagging (Cisco Meraki Documentation), pulled 2026-09-26
  4. Home Lab Networking 101: VLANs, Subnets, and Segmentation for Beginners (Virtualization Howto), pulled 2026-09-26
  5. Network Configuration (Proxmox VE wiki), pulled 2026-09-26