
How VLANs Isolate Devices in a Homelab: Setup Guide
The VLAN draws the line, and the firewall is what holds it. Put untrusted devices on their own VLAN, tag trunks between VLAN-aware gear, and keep devices that don't understand tags on untagged access ports. Then force every packet between VLANs through a real firewall. That's how to use VLANs to isolate devices in a homelab so the isolation survives a hacked camera. pfSense, OPNsense, OpenWrt, and UniFi gateways all work; the firewall rules matter more than the badge on the box.
Last updated: 2026-10-20
VLAN tagging in a homelab comes down to one standard, IEEE 802.1Q, and one habit: every packet between segments crosses the firewall. Get it right and a compromised smart speaker stays stuck on its own segment, with no route to your laptop. You can start with the switch you already own, if it's managed, and grow from there.
Why bother segmenting a homelab at all
Because one flat network means one blast radius. When every device shares a broadcast domain, a compromised IoT gadget sees your NAS, your hypervisor, and your workstation the moment it starts probing. Segmentation is how I enforce least privilege at home without babysitting every device.
The map I recommend is small on purpose. These networks cover most homes:
- Default: trusted laptops and phones.
- IoT: smart plugs, cameras, anything you don't trust, with no path back to Default.
- Guest: internet only, isolated from everything else.
- Secure: all traffic egressing through a VPN.
- Homelab: your servers and services, with tight rules on what can reach them.
- Management: switch, access point, and hypervisor admin pages, reachable from one place.
There's a performance angle too, and it's real. Chatty devices flood a broadcast domain with discovery traffic. Smaller domains cut that noise, free up wireless airtime, and make faults easier to scope. So when something breaks, the fault stays inside one segment.
The VLAN parts you actually touch

A VLAN is a broadcast-domain boundary, nothing more mystical than that. It groups Ethernet traffic so local discovery stays local, while IP addressing and routing stay separate concerns. Here is what happens on the wire, because this explains most of the bugs you'll hit.
What the tag actually carries
Every segment gets a VLAN ID, or VID. 802.1Q adds a small header to each frame so switches keep the lanes distinct. That header opens with a tag protocol identifier (TPID), a 16-bit field set to 0x8100. Priority bits, a drop-eligible indicator, and the VID itself follow it.
The VID is a 12-bit field. As a result, IDs 1 through 4094 are available for normal VLAN assignment, while 0 and 4095 are reserved. A VID of 0x000 means the frame carries no VLAN ID and is only a priority tag. VID 0xFFF is reserved for implementation use and must never be configured or transmitted, so keep your numbering well clear of the top of the range.
A tagged trunk carries many VIDs on one cable. An access port strips the tag and sends plain Ethernet to a device that knows nothing about VLANs.
Untagged ingress is where people get burned
When a frame arrives with no tag, the switch assigns it the port's PVID (port VLAN ID), sometimes called the native or access VLAN. TP-Link's PVID tab does the same job as a Cisco access port; only the label changes. Learn where your switch hides this setting before you trust it.
One warning worth repeating. If the native VLAN differs on the two ends of a trunk, traffic leaks between segments and you get odd loops. Keep the native VID identical on both ends.
And a VLAN by itself is no security control. Devices in the same VLAN talk directly at Layer 2, the Ethernet switching layer, without passing through a gateway or firewall. Membership alone gives you no isolation between them. The isolation comes from the Layer 3 device, the router doing IP routing and firewall policy, which is why the firewall step is not optional.
Picking VLAN-aware hardware and software
Decide first whether you need plain Layer 2 tagging or Layer 3 routing between segments, because that choice drives everything else. A cheap managed switch will tag and trunk all day. Ask it to route between VLANs and it often punts the job to a weak CPU, which throttles your throughput.
The floor is a managed or "smart" switch that speaks 802.1Q. An unmanaged switch can't assign ports to VLANs at all. It can still live in your network, but only hanging off one access port, where everything plugged into it shares that port's VLAN.
Here's the trade-off in plain terms:
| Feature | L2 switch | L3 switch |
|---|---|---|
| Primary role | Tagging, trunks | Routing between segments |
| Throughput | High for switching | Line-rate inter-VLAN |
| CPU load | Low | Offloads routing to silicon |
| Cost | Lower | Higher |
The routing hardware matters more than most guides admit. On an EdgeRouter X with hardware offload, routing between VLANs barely registers on the CPU. Move the same job to software routing on comparable hardware like a Raspberry Pi 4 and the load climbs enough to notice under real traffic. That's fine for a lab and painful for your main gateway.
Which router software to run
OpenWrt tags and firewalls happily on small routers and is a cheap way to start. For heavier rulesets I reach for pfSense or OPNsense on an x86 box, or a virtualized router on a Proxmox host. UniFi appliances bundle controller, routing, and switching if you want one pane of glass. If you're still sizing switch gear, my rundown of switches worth buying for a home lab covers the uplink and PoE math.
Plan the networks before you touch a config
Sketch your networks, IP ranges, and traffic policy on paper first. A few minutes here saves you an evening of renumbering later.
Carve subnets by role and leave gaps. A scheme like 10.10.X.0/24, one octet per network, reads cleanly and scales. I match the VID to the third octet, so 10.10.30.x is always VLAN 30 and logs read at a glance. Reserve ranges for segments you haven't built yet so you don't redo addressing when you add cameras next year.
Here is the plan the rest of this guide uses. Treat it as a home network VLAN template, not scripture:
| Network | VID | Subnet | Allowed to reach |
|---|---|---|---|
| Management | 10 | 10.10.10.0/24 | Nothing except updates; reached from admin devices only |
| Default | 20 | 10.10.20.0/24 | Internet, chosen Homelab services |
| IoT | 30 | 10.10.30.0/24 | Internet, one controller host |
| Guest | 40 | 10.10.40.0/24 | Internet only |
| Homelab | 50 | 10.10.50.0/24 | Internet, whatever each service needs |
| Secure | 60 | 10.10.60.0/24 | Internet through the VPN only |
| DMZ | 70 | 10.10.70.0/24 | Internet; inbound via port forwards only |
Name consistently too: Default-Home, IoT-Home, Guest-Home. Sloppy names are how SSIDs get wired to the wrong tag. Leave VLAN 1 empty, for reasons covered in the management section.
Document the boring parts now. Write down each DHCP range, the static addresses for servers, and the DNS suffix per network. If your firewall supports it, build one alias for the private address ranges defined in RFC 1918, so your rules read against a named group instead of a wall of subnets. That keeps policy legible on both UniFi and pfSense.
How do you use VLANs to isolate devices in a homelab?
Work in order, and prove each layer before moving up. The sequence is plan, configure, connect, verify, then enforce policy. These six steps get the VLAN tagging right; the firewall section after them is what turns tags into isolation.
1. Create the VLANs on your managed switch
Add each network as a VID in the switch UI. Pick the numbers from your plan and write them down. Most switches drop frames for a VID they don't know, so a missing entry here shows up later as a dead port.
2. Set your trunks
On the link between switches, from switch to access point, and from switch to router, tag every VID that needs to cross. In UniFi's language, trunk ports allow multiple VLANs while access ports handle a single one. Leave the native VLAN consistent on both ends.
The router uplink is the trunk people forget. One tagged cable carrying every VLAN to the router is the classic router-on-a-stick layout. Skip a VID on it and that whole segment never gets DHCP.
3. Set access ports
For a single dumb device, set the port's PVID to its VLAN and send it untagged. That printer never needs to know a tag exists.
On a lot of budget smart switches, membership and PVID are separate settings. So remove the port from VLAN 1 membership as well, or it stays an untagged member of both. Broadcasts from VLAN 1 then leak out of a port you thought was IoT-only.
4. Configure the router side
Create a virtual interface per tag on the router's trunk port, then a DHCP scope and DNS for each. In pfSense, you pick a parent interface, the physical port that carries the VLAN's traffic, and enter the VLAN tag. Then you assign the new VLAN as an interface and configure it like any other. Give each one a static gateway address, such as 10.10.30.1 for IoT.
5. Map SSIDs to tags on the access point
Point each wireless network at the matching VLAN so a phone on the guest SSID lands on the guest segment. The AP's switch port must be a trunk carrying those VIDs. This step fails more often than the rest combined, which is why wireless gets its own section below.
6. Verify before you trust it
Check link lights, read the switch's port and VLAN tables, and plug a test client into each access port to confirm it pulls an address from the right scope. To test a trunk port without moving hardware around, bring up a tagged subinterface on any Linux box:
sudo ip link add link eth0 name eth0.30 type vlan id 30
sudo ip link set eth0.30 up
sudo dhclient -v eth0.30
ip -br addr show eth0.30
If that pulls an address from VLAN 30's scope, the tag is reaching the port. The dhclient -v output prints the DHCPOFFER and the server that sent it, so you know exactly whose scope answered. If a client on an access port lands on the wrong subnet, you have a PVID or trunk mismatch, not a DHCP problem.
Newer distros sometimes ship without dhclient. In that case sudo dhcpcd eth0.30 does the same job. Clean up afterwards with sudo ip link del eth0.30.
Wireless is where segmentation quietly fails

Your access point is the most common broken link in the chain. The AP tags wireless traffic, but every switch port between it and the gateway has to carry that tag or the frames die in transit. UniFi documents this directly: the WiFi VLAN must be allowed as a tagged VLAN on the upstream switch ports that AP traffic passes through to reach the gateway and DHCP server.
Miss one uplink port in the middle and the SSID associates, then hangs with no address. Meanwhile the client shows full signal, which sends people off debugging the wrong layer.
Give the AP's own management address a home too. I put it on the management network as untagged traffic on that port, then tag the guest and IoT networks alongside it. That way an AP reboot doesn't lock you out of the controller.
Connecting VLANs without opening everything
The whole point of segmenting is to block traffic by default and then poke the smallest holes you can. So start every inter-VLAN policy with deny, and add allows deliberately. When two VLANs need to talk, write an allow rule between them and leave the segments separate.
Something has to route between the segments, and Cisco's Meraki switching docs state the rule plainly. Devices in separate VLANs need a Layer 3 forwarding device, such as a router, to talk to each other. That device can sit outside the switch or be built into it. In my layout it's the firewall running pfSense or OPNsense, so every packet between VLANs has to pass the rules.
The Layer 3 switch shortcut
Turn on routing in a Layer 3 switch and it creates a switched virtual interface (SVI) per VLAN, forwarding by destination IP. That's fast. However, the traffic now routes inside the switch and never touches your firewall. Unless the switch has its own access lists that you keep in sync, you've rebuilt the flat network with extra steps.
Rule order I use on every internal interface
Firewalls match top-down, and the first match wins. So the order is the policy:
- Allow return traffic for established connections. pfSense and OPNsense track state, so this happens for you; on raw nftables you write it yourself.
- Allow the specific holes, by source, destination, and port. For example, Default to Homelab on HTTPS and SSH, or IoT to one Home Assistant host.
- Allow each VLAN to reach its own gateway for DNS and DHCP.
- Block anything destined for the RFC 1918 alias.
- Allow everything else out, which by now can only be the internet.
Rules four and five are the pair that gives IoT internet access with no path sideways. Put rule five above rule four and you've opened the whole house.
Prove the isolation from the wrong side
Test from the untrusted segment, because a working allow rule tells you nothing about the blocks. Put a laptop on the IoT VLAN, through an access port or the IoT SSID, and run this:
ping -c 3 10.10.30.1 # own gateway: should answer
ping -c 3 10.10.20.15 # a trusted laptop: should time out
nmap -sn 10.10.50.0/24 # homelab sweep: should find nothing
ip neigh show # ARP table: only local MACs
The gateway answering proves the segment works. Timeouts to the trusted laptop and an empty homelab sweep prove the firewall is blocking.
Then read ip neigh. The ARP table should hold only MAC addresses from your own subnet, mostly the gateway. If you see the MAC of a device you believe is on another VLAN, it isn't; the two share Layer 2, and no firewall rule can separate them.
One more check catches most people. Try loading the firewall's web admin page from the IoT laptop, on every interface address it has. If any of them answers, add a block rule for the firewall itself before you call the segment done.
DNS and DHCP across segments
Each VLAN gets its own DHCP scope, normally served by the router's interface on that VLAN. If you run DHCP on a separate server in the homelab, the router needs a DHCP relay. DHCP discovery is a broadcast, and broadcasts don't cross VLANs.
For DNS, I point every scope at its own gateway address and let the firewall's resolver answer. If you run Pi-hole or AdGuard Home in the homelab, add one allow rule for DNS from each segment to that host. Then block outbound DNS to anything else, so a smart TV can't quietly use its own hardcoded resolver.
Casting and AirPlay break next, and this one surprises everybody. They find devices with multicast DNS (mDNS), which stays inside one broadcast domain. Put the TV on IoT and your phone on Default and the cast button disappears.
Most gateways offer an mDNS repeater: the Avahi package on pfSense, a repeater plugin on OPNsense, a toggle on UniFi. Enable it only between the VLANs that need it. After that, add the allow rule for the stream itself, because discovery working doesn't mean the connection is permitted.
Should your homelab and containers get separate VLANs?
Put the homelab on its own VLAN, yes. Giving every container its own VLAN, mostly no. The homelab VLAN keeps servers away from IoT and guests, and that's the big win. Splitting each container out multiplies firewall rules for little real gain.
Group by exposure instead. Anything reachable from the internet, like a reverse proxy or a port-forwarded game server, goes in the DMZ VLAN. Internal-only services stay in Homelab. An exposed service is the one most likely to get popped, so it's the one that earns its own segment.
How containers actually land on a VLAN
Docker's default bridge network hides containers behind the host's IP. On the wire, they all sit in the host's VLAN. To give a container its own VLAN, use the macvlan driver on a tagged parent interface:
docker network create -d macvlan \
--subnet=10.10.70.0/24 --gateway=10.10.70.1 \
-o parent=eth0.70 dmz
Docker creates eth0.70 for you if it doesn't exist. Here's the gotcha: the host can't reach its own macvlan containers by default. The kernel's macvlan driver blocks that path by design, and no firewall rule changes it. Test from another machine, or add a macvlan shim interface on the host if you truly need host-to-container traffic.
VMs and LXC containers on Proxmox are simpler, because you tag them at the virtual NIC. The Proxmox section below shows the bridge setup.
Keeping management access off the everyday network
Every admin page goes on the Management VLAN: switch web UIs, the AP controller, the Proxmox host, out-of-band boards like IPMI, and the firewall GUI. Allow traffic into it from one admin laptop or from Default only. Allow almost nothing out, apart from updates and time sync.
Keep management off VLAN 1. Every port on a fresh switch defaults to VLAN 1, so anything plugged into an unconfigured port lands right next to your switch's admin page. Leave VLAN 1 empty and unrouted.
Moving a switch's management VLAN is the classic lockout. Change it last, while you're connected from a port already on the new VLAN. Otherwise the switch applies the change, drops your session, and leaves you hunting for a console cable.
UniFi, pfSense, and Proxmox specifics
The concepts don't change between platforms, but the menus and defaults do. These are the settings that matter on each.
UniFi
UniFi splits port VLANs into two settings. The Native VLAN is the VLAN assigned to untagged traffic passing through a switch port. Tagged VLANs are any other VLANs explicitly permitted on that port.
Tagged VLAN Management controls which tagged VLANs are allowed on the port. Restrict it everywhere that isn't a real trunk. A camera port should carry IoT as native and block every tagged VLAN, so a swapped device can't ask for a different one.
Use Port Profiles to apply consistent configurations across multiple switches. I build one profile per role, such as AP trunk, camera port, and server trunk, and assign those. Clicking ports one at a time is how a single uplink ends up missing a VLAN.
pfSense and OPNsense
In pfSense, VLANs live under Interfaces, then Assignments, then VLANs. A VLAN must be added as an interface before you can configure it for use. Enable it, set a static IPv4 gateway address, then turn on DHCP for that interface. The official pfSense documentation walks through each screen.
New interfaces start with no pass rules, so everything on them is blocked until you write the allows. That's the default you want. OPNsense follows the same model with slightly different menu names.
Proxmox
On a Proxmox host, don't build one bridge per VLAN. Mark one bridge VLAN-aware, trunk all the VLAN IDs through it, then tag each VM at the NIC level. In /etc/network/interfaces it looks like this:
auto vmbr0
iface vmbr0 inet manual
bridge-ports enp1s0
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
auto vmbr0.10
iface vmbr0.10 inet static
address 10.10.10.5/24
gateway 10.10.10.1
The second block puts the host's own management address on VLAN 10. Then set the VLAN tag field on each VM's network device. Run bridge vlan show afterwards; it lists which VIDs each port carries, which tells you whether the tag ever reached the bridge. The Proxmox network configuration guide covers the full syntax, and my notes on a clean OpenWrt VM design for Proxmox VLANs show the router side of the same host.
Cabling, trunks, and the native VLAN trap
Untagged frames on a trunk land on the native VLAN, so treat that VLAN as hostile ground. Keep no real devices on a trunk's native VLAN. That also blunts VLAN hopping by double tagging, where an attacker on the native VLAN stacks two tags and the outer one gets stripped at the first switch.
Prune every trunk to the VLANs it actually needs. A trunk to an AP carries Management, Default, IoT, and Guest. It has no business carrying Homelab or DMZ.
Unused ports get disabled, or parked on an empty, unrouted VLAN. Then label cables at both ends with their role, and keep a simple port map: switch, port, native VLAN, tagged VLANs. The map pays for itself the first time you recable at midnight.
When something breaks
Work bottom up, and let the symptom pick the layer:
- Client gets no address. A tag is missing on some hop. Walk the path from AP to switch to switch to router and check each port's tagged list.
- Client gets an address from the wrong subnet. The port's PVID is wrong, or the port is still an untagged member of VLAN 1. Fix membership and PVID together.
- Client gets an address but no internet. The new interface has no pass rule yet, or the allow-out rule sits below the RFC 1918 block. If
ping 1.1.1.1works and names don't resolve, check the DNS rule instead. - IoT reaches something it shouldn't. Check rule order first. Then check whether a Layer 3 switch is routing that pair around the firewall.
- Traffic works, then drops or loops. Compare the native VLAN on both ends of every trunk.
When the list runs out, capture on the router's trunk port. Swap in your own interface name:
sudo tcpdump -eni eth0 vlan 30 and udp port 67
The -e flag prints the link-level header, so each line shows the 802.1Q ethertype and vlan 30. If the client's DHCP discover arrives tagged and no offer goes back, the router's interface or scope for that VLAN is the problem. If nothing shows up at all, the tag is dying upstream, and you're back to walking switch ports.
FAQ
Can I add VLANs to a running network without taking everything down?
Yes, if you build alongside what you already have. Leave your current LAN untouched, create the new VLANs on the switch and router, and move Guest first, since no other device depends on it. IoT follows a few devices at a time. Move your trusted machines last, once the rules have held up under normal daily use for a while.
Does IPv6 slip past these firewall rules?
It can. If your ISP delegates an IPv6 prefix, the router may hand every VLAN its own routed IPv6 subnet. An alias built from RFC 1918 ranges only matches IPv4, so those block rules never fire for IPv6 traffic. Write matching blocks for your internal IPv6 prefixes, or keep IPv6 disabled on the IoT and Guest interfaces until you do, then rerun the tests with ping -6.
Is Wi-Fi client isolation enough instead of a guest VLAN?
No. Client isolation only stops wireless clients on one SSID from reaching each other through the access point. Their traffic still goes wherever the router sends it, so a guest phone can reach your NAS unless that SSID lands on its own segment behind firewall rules. Turn client isolation on for the guest SSID as an extra layer on top of the VLAN.
Do cameras on the IoT VLAN need internet access at all?
Only if you rely on the vendor's cloud app. Cameras recording to a local NVR or Home Assistant work fine with no route out, and blocking it stops them sending data to servers you never picked. Put them in their own alias inside the IoT segment and drop their outbound traffic. The cost is that firmware updates become a manual chore.
