VLANs Without the Headache: Segment Your IoT, Camera, and Guest Networks
Every homelab guide eventually says the same thing: put your IoT gadgets, cameras, and guests on their own VLANs. Few explain what a VLAN actually is, and fewer still cover the two places beginners really get stuck — the port settings on the switch, and the moment casting and AirPlay stop working afterwards. This guide covers both, in plain terms, with a starter layout small enough to finish in an evening. It is the networking layer of the homelab map in our homelab components guide.
Published Nov 19, 2026 · Last updated Nov 19, 2026
What a VLAN actually is
Start with the network you already have. Right now, everything in your home — laptops, phones, the NAS, smart plugs, cameras, the TV — almost certainly sits on one single network, where any device can, in principle, try to talk to any other. Your camera can attempt a connection to your laptop; a cheap smart plug with questionable firmware can scan for your NAS. Mostly they don't, but nothing structural stops them.
A VLAN — a virtual LAN — carves that one network into several separate networks that still share the same cables and switch. Each VLAN gets its own address range (its own subnet) and one firm rule: traffic does not cross between VLANs unless the router explicitly carries it across, and the router only does that when a firewall rule says it may. That is the entire point. The segmentation is not a suggestion devices politely follow; it is enforced by the switch and the router, in paths the devices cannot argue with.
The mechanism is a label. Ethernet frames traveling between VLAN-aware devices carry a small tag — a number, from 1 to 4094, defined by the 802.1Q standard — that says which network the frame belongs to. The switch reads the tag and keeps each network's traffic apart, the way a mailroom sorts letters into separate pigeonholes even though they all arrived through the same slot. Devices themselves never see the tag; the switch adds and removes it at the port. Your job is mostly telling each port which pigeonholes it serves.
One clarification: a VLAN is a wired-Ethernet idea. Zigbee and Thread devices are not on any VLAN — they live on their own radio networks and reach Ethernet through a coordinator or border router. Planning radio channels instead of wired segments is a different layer; our Zigbee, Thread and Wi-Fi channel planner covers it. Wi-Fi devices, though, absolutely land on VLANs, through the access point — which brings us to the hardware.
The three pieces of hardware that have to agree
VLANs fail for a boring reason more often than any other: one box in the chain does not speak the language. All three of these must be VLAN-aware, or the design silently collapses back into one flat network:
- A managed switch. "Managed" means it has settings — specifically, it can be told which VLANs each port carries. An unmanaged switch has no such settings and passes everything everywhere; one unmanaged switch between your router and a device undoes the separation for everything downstream of it. Managed is not a synonym for expensive or enterprise — small desktop managed switches are the standard entry point, and one with Power over Ethernet can also power your cameras and access points.
- A router or firewall that routes between VLANs. The switch keeps the networks apart; something has to be the controlled doorway between them. That is the router's job: it holds an address on each VLAN, carries permitted traffic across, and enforces the rules in the firewall section below. Many ISP-supplied routers cannot do this at all. This is the job a dedicated firewall such as OPNsense or pfSense exists for — our OPNsense vs pfSense comparison covers choosing one.
- A VLAN-aware access point, for anything wireless. Most smart-home devices are Wi-Fi devices. To place them on different VLANs, the access point must run multiple network names (SSIDs) and attach each one to a different VLAN — "Home" landing on your main VLAN, "IoT" on the IoT VLAN, "Guest" on the guest VLAN. Consumer mesh systems vary widely here; some offer a guest network and nothing more. Check before you plan around it.
For scale: a managed switch with faster ports — the MikroTik CRS310-8G+2S+IN, with eight 2.5-gigabit ports and two 10-gigabit SFP+ cages — was $191.70 when we checked in November 2026, and a PoE model such as TP-Link's TL-SG208PE was $62.99 in the same check. The switch is rarely the budget problem in this project; the router you already own is the part most likely to need replacing.
Tagged, untagged, and PVID: the part where setups actually fail
Here is the one distinction the whole setup turns on. Almost every "my VLANs don't work" thread is, underneath, this section.
A laptop or camera knows nothing about tags. It sends plain, untagged frames and expects plain frames back, so the switch port it plugs into handles the labeling for it. That kind of port is an access port: it belongs to exactly one VLAN, configured with two settings that describe the same fact from two directions:
- Untagged membership: frames leaving this port have their tag stripped; the port is a member of one VLAN for untagged traffic — the network whose devices plug in here.
- PVID (Port VLAN ID): frames arriving at this port have no tag, so the switch stamps them with this number to decide which network they belong to. The PVID must match the untagged VLAN, or arriving traffic lands on a different network than departing traffic — the classic half-working setup where a device gets an address but nothing can reach it.
The other kind of port is a trunk port: one cable carrying several VLANs at once, every frame keeping its tag so the device at the other end can sort them. Trunks link VLAN-aware boxes — switch to router, switch to access point, switch to a server or NAS hosting things on more than one network. On a trunk, one VLAN is usually also sent untagged (the "native" VLAN in some vendors' language); the rest are tagged members.
Every vendor names these settings differently, which is half the battle. A translation table for the interfaces you are most likely to meet:
| Concept | TP-Link (SMB switches) | UniFi | MikroTik (RouterOS) | Cisco-style CLI |
|---|---|---|---|---|
| Port for one end device | Untagged member of one VLAN, PVID set to match | Port profile with one "native" network | Access port on the bridge, PVID set | Access port, one VLAN |
| Port carrying many VLANs | Tagged member of each VLAN | Port profile with tagged networks allowed | Trunk port, tagged VLAN list | Trunk port, allowed VLAN list |
| The stamp for incoming untagged frames | PVID field | "Native network" choice | PVID on the bridge port | Access VLAN / native VLAN |
Two failure modes to recognize. First: you tag the trunk to the router but forget the PVID on a camera port — the camera's frames get stamped with the default VLAN 1, it picks up an address on the main network, and your camera segment looks empty while the camera works in the wrong place. Second: the access point's trunk is missing one tagged VLAN, so the IoT SSID exists, devices join it, and they receive no address at all. When something is wrong, ask one question: does the device get an address, and from which network? That tells you whether the tagging or the routing is at fault.
A starter layout that is enough
Segmentation advice online tends to end with eight or ten networks, including separate ones for printers, work laptops, and the thermostat. Resist this. Every VLAN you add is a set of firewall rules to reason about and a new way for something to break on a Tuesday night. Beginner guides converge on the same advice: start with three or four, live with them for a month, and add a segment only when you can name the specific device and the specific worry it addresses. Four is plenty for most smart homes:
| VLAN | Who lives there | The worry it answers |
|---|---|---|
| Main (e.g. VLAN 10) | Your phones, laptops, and computers | — this is the trusted core everything else is measured against |
| Servers (e.g. VLAN 20) | NAS, Home Assistant, Jellyfin, your Docker stack | Services are reachable by the house but cannot wander into your computers |
| IoT (e.g. VLAN 30) | Smart plugs, bulbs, appliances, robot vacuums, voice assistants | The $12 gadget with abandoned firmware can reach the internet and nothing else |
| Cameras (e.g. VLAN 40) | IP cameras and the doorbell | Cameras are the devices people least want talking to the internet or the LAN — see below |
| Guest (optional, e.g. VLAN 50) | Visitors' phones | Guests get internet and nothing else, not even each other |
Each VLAN gets its own subnet — main might be 192.168.10.0/24, servers 192.168.20.0/24, IoT 192.168.30.0/24, with the VLAN number echoed in the address purely as a memory aid. Your router hands out addresses (DHCP) separately on each one.
Why do cameras get their own segment rather than sharing IoT? The traffic pattern is different and the trust is lower. Cameras stream continuously to one place — your recorder — and in a local-first setup they have no business reaching the internet at all; many will try anyway, phoning home to a vendor cloud unless the firewall says no. On their own VLAN, "no internet, talk only to the recorder" is two rules. Our camera guides, starting with Frigate NVR with Home Assistant, assume exactly this arrangement — the single segmentation step with the clearest payoff.
What about a separate management VLAN for the switch and access point admin pages? A reasonable fifth segment later, once the basics are stable. On day one it mostly adds a new way to lock yourself out of your own switch — a real risk, addressed below.
The layout above is generated for you — with your own first two octets — by the Subnet & VLAN Planner, which also works out gateways and DHCP ranges per segment and splits any network into equal subnets.
Firewall rules between VLANs, in plain English
Creating the VLANs separates the networks; the firewall rules decide what crosses. Firewalls like OPNsense and pfSense are stateful, which gives you a gift: if a device on network A may start a conversation with a device on network B, the replies are allowed back automatically. You write rules about who may start conversations, and the firewall handles the rest. The pattern below starts from "nothing crosses" and opens exactly the doors a smart home needs:
| Who starts it | To whom | Verdict | Why |
|---|---|---|---|
| Main | Everywhere | Allow | Your own devices can reach the NAS, Home Assistant, IoT controls, and the internet |
| Servers | IoT | Allow | Home Assistant lives here and must be able to control the plugs and bulbs it manages |
| Servers | Main | Block new connections | A compromised service should not be able to go browsing your laptop; replies to your requests still flow |
| IoT | Internet | Allow | Cloud-dependent gadgets keep working |
| IoT | Main, Servers (new connections) | Block | The gadget never initiates contact with your files or computers — Home Assistant reaches it, not the reverse |
| Cameras | The recorder (Frigate/NVR) only | Allow, narrowly | Streams go where they are recorded; nothing else |
| Cameras | Internet and all other VLANs | Block | No phoning home, no lateral movement — the whole point of the segment |
| Guest | Internet | Allow | Guests get what they came for |
| Guest | Everything local, including other guests | Block | Isolation in both directions |
Read the IoT rows together, because they are the ones people find counterintuitive: IoT devices cannot start a conversation with Home Assistant, yet Home Assistant controls them fine, because the control connection starts from the server side and the replies ride back on the stateful allowance. The exception to plan for is devices that push events to a server — some sensors, buttons, and local-push integrations initiate the connection themselves. When one stops working after segmentation, the fix is a single narrow rule (that device, that destination, that port), not reopening the whole segment.
The day casting broke: discovery and the mDNS fix
Here is the experience nearly everyone has, usually within the hour: the VLANs are up, the rules are in, everything pings — and the TV has vanished from the cast menu, AirPlay finds no speakers, the printer is gone, and a HomeKit accessory shows "No Response." Nothing is broken. You have met discovery.
Phones find cast targets, speakers, printers, and HomeKit accessories by listening for announcements sent using mDNS (multicast DNS, sometimes labeled Bonjour). Those announcements are deliberately local: broadcast within one network, they stop dead at its boundary — exactly the boundary you just built. A phone on the main VLAN and a TV on the IoT VLAN are both healthy; they simply cannot hear each other, the way two rooms with a closed door muffle a conversation.
The fix is a small piece of software on the router called an mDNS reflector (or repeater). It sits on two or more networks at once, listens for announcements on each, and repeats them across, so a phone on Main hears the TV on IoT announcing itself. On OPNsense it is a plugin (the mDNS repeater); on pfSense it is the Avahi package; many prosumer routers and UniFi systems have a toggle named "mDNS" or "multicast DNS proxy." Three cautions:
- Enable it selectively. Reflect between the pairs that need it — Main and IoT, typically — not across every VLAN. Reflecting the camera network's announcements buys you nothing and widens the very surface you segmented to shrink.
- It only fixes announcement, not permission. After reflecting, your phone can see the TV; the firewall rules still decide whether the cast connection itself is allowed. Seeing a device you cannot connect to means the reflector works and a rule is missing — check the IoT rows of the table above.
- Not everything uses mDNS. A minority of devices discover each other by other broadcast methods reflectors do not carry. If one gadget refuses to be found even with the reflector on, the pragmatic answers are a narrow firewall pinhole if it supports direct-IP control, or moving that one device to the main network. Do not dismantle the whole design for one speaker.
Not locking yourself out, and a testing checklist
The rite of passage nobody warns you about is changing a switch setting and realizing your computer — which was managing the switch — is now on the wrong side of your own segmentation. Avoid it with procedure, not cleverness: keep one switch port on the original network until the very end, work from a machine plugged into it, and move that last port only once everything else tests clean. Change one thing at a time, and after each change, run this checklist from a device on each VLAN:
- It gets an address — from the correct subnet for its segment. (Wrong subnet means a PVID or trunk problem, per the failure modes above.)
- It can reach the internet, if its segment is supposed to.
- It can reach the local things it should: your phone opens Home Assistant; Home Assistant still controls a plug; the recorder still shows every camera.
- It cannot reach one thing it should not: from IoT, try opening the NAS admin page. Failure here is success.
- Casting and AirPlay work from your phone to a device on the IoT network, with the reflector enabled.
Only when all five pass on every segment should you move the family's devices over — and even then, move them in groups (IoT tonight, guests when the next guest arrives), so when something odd surfaces a week later, the list of suspects is short.
Part of the Homelab guides
This guide is one part of the site's homelab coverage. The Homelab hub gathers all of it in one place — the start-here map of every layer, your first Proxmox node, OPNsense vs pfSense in 2026, UPS sizing by watts, what a homelab costs to run, 3-2-1 backups that actually restore.
Official documentation and references
- OPNsense documentation — firewall rules and the plugin catalogue, including the mDNS repeater
- MikroTik RouterOS documentation — VLAN configuration, access and trunk ports
- Avahi — the mDNS/DNS-SD implementation used as a reflector on pfSense and Linux routers
FAQ
Do I actually need VLANs at home?
Not always. If your network is a router, a few computers, and some smart bulbs you trust, a single flat network is fine and simpler. VLANs earn their complexity when you have devices you cannot vouch for — cheap IoT gadgets, IP cameras, a work laptop, guests — and you want them able to use the internet without being able to browse your NAS, your computers, or each other. The trigger is usually a specific worry ("my cameras should not be able to see my files"), not a general feeling that a serious network has them.
Why did my Chromecast and AirPlay disappear after I set up VLANs?
Because discovery does not cross between networks. Casting, AirPlay, HomeKit, and printer discovery find each other using mDNS announcements, which are local-network broadcasts that stop at the boundary between VLANs by design. Your phone and the TV are both working; they simply cannot hear each other. The fix is an mDNS reflector (also called a repeater) running on the router, which listens on two networks and repeats the announcements across. Enable it only between the pairs of VLANs that need it — typically your main network and the IoT network.
Can I set up VLANs with my ISP router and the switch I already have?
Usually not, and this is the most common reason a first attempt fails. All three pieces have to understand VLANs: a managed switch that can tag ports, a router or firewall that can route between the networks and enforce rules, and — for Wi-Fi devices — an access point that can attach different SSIDs to different VLANs. Most ISP routers and unmanaged switches cannot do any of that. An unmanaged switch anywhere between the router and a device silently strips the separation away, because it passes everything to everyone.

