← All guides

VLAN segmentation for beginners: your first IoT VLAN, step by step

Networking · 9 min read

The concepts guide on this site explains what VLANs are and why segmenting a lab is worth doing. This guide is the other half: the actual configuration, scoped for a first attempt. Most VLAN tutorials open with a four-to-seven-segment enterprise layout, management, trusted, servers, IoT, guest, lab, out-of-band, and a beginner who tries to build all of it in one evening usually ends the night locked out of a switch. The procedure below builds exactly one new segment, an IoT VLAN, proves it works, and stops. Every later VLAN is then a repeat of a procedure already understood.

Start with one VLAN, not six

Each VLAN is its own broadcast domain: devices inside it talk to each other directly, and nothing inside it can reach another VLAN unless a router routes the traffic across, which makes the router the one place where policy is enforced. That is the whole security model, and it works identically whether there are two VLANs or twelve. What does not scale gently is the bookkeeping: every added VLAN multiplies the firewall rules, DHCP scopes, and documentation entries that have to stay consistent. One IoT VLAN teaches the full pattern, plan, router interface, switch ports, DHCP scope, rules, verification, with the smallest possible blast radius if a step is wrong. The devices that benefit most go first: smart plugs, bulbs, cameras, and TVs are exactly the gadgets with the weakest security track records and the least reason to ever touch a NAS or a workstation.

The plan on paper first

Before touching a settings page, write down four facts. They take two minutes and prevent nearly every beginner failure:

DecisionThis guide's choiceWhy
VLAN ID30Easy to remember, matched to the subnet below
Subnet10.0.30.0/24The third octet repeats the VLAN ID, so any address announces its segment at a glance
Gateway10.0.30.1The router's address inside the new VLAN,.1 by convention
DHCP pool10.0.30.50 to 10.0.30.200Leaves.2,.49 free for anything that later needs a fixed address

Keep the existing main network exactly as it is. It stays the place the configuring computer lives, and it stays reachable the whole time, that detail matters in step 6 below.

What you need (and what will not work)

Two hardware requirements are non-negotiable. First, a managed or "smart" switch that understands 802.1Q VLAN tags, an unmanaged switch cannot separate anything. Second, a router or firewall that can route between tagged VLANs: OPNsense or pfSense on a mini PC is the common home-lab choice, and the menu paths below use OPNsense, but any router with per-VLAN interfaces follows the same order of operations. Most ISP-supplied gateways and basic consumer routers cannot terminate VLANs at all; no setting will change that. If the router has a single LAN port, the standard layout is one cable from router to switch carrying all VLANs at once, a configuration called router-on-a-stick. Wired devices connect to switch ports assigned to a single VLAN (access ports); the router-to-switch link is a trunk port carrying the tagged VLANs. For Wi-Fi, IoT gadgets can only land on the new VLAN if the access point supports multiple SSIDs with a VLAN mapped to each one.

The procedure: router, switch, rules, in that order

  1. Write the plan down (table above) somewhere it will survive the evening: a notes file with the VLAN's purpose, ID, subnet, gateway, and pool.
  2. Create the VLAN on the router. In OPNsense: Interfaces → Other Types → VLAN, add a VLAN with tag 30 on the LAN parent interface. Then Interfaces → Assignments, add the new VLAN as an interface and name it IOT.
  3. Give the new interface its address. Open Interfaces → [IOT], enable it, set IPv4 Configuration Type to Static IPv4, and enter 10.0.30.1/24. Save and apply. The interface address is the gateway every IoT device will use.
  4. Create the DHCP scope in the same sitting. Services → ISC DHCPv4 → [IOT]: enable the DHCP server on the IOT interface and set the range to 10.0.30.50 – 10.0.30.200. Skipping this step is the classic beginner trap: the VLAN exists, the switch is correct, and every device plugged into it gets no address at all, with symptoms that point at everything except the missing scope.
  5. Configure the switch. Create VLAN 30 there too, the ID must match the router exactly. Set the port connected to the router as a trunk carrying VLAN 30 (plus the existing LAN). Set one spare port as an access port on VLAN 30 for testing. Leave every other port untouched.
  6. Do not move the computer doing the configuring. Stay plugged into the main LAN until testing is finished. Reassigning the management path mid-procedure is how a five-minute job becomes a factory reset.
  7. Add the two firewall rules, block first. On the IOT interface (Firewall → Rules → IOT): rule 1, block traffic from IOT net to the main LAN net; rule 2, pass IOT net to anywhere else (that is what gives IoT devices the internet). Order is not cosmetic: firewall rules evaluate top to bottom, so the block must sit above the pass, or the pass matches first and the block never applies.
  8. Test with one device. Plug a single laptop (or one smart plug) into the VLAN 30 access port, or join it to an IoT SSID mapped to VLAN 30, and run the checks in the next section before moving any other device.
  9. Migrate devices one or two at a time by moving their switch ports to VLAN 30 access ports, or their Wi-Fi to the IoT SSID, confirming each one still works before continuing.

What success looks like: the four-point test

Configuration is a claim; these four checks are the evidence. All four should hold at once:

  1. Right address. The test device reports an address inside 10.0.30.x, with gateway 10.0.30.1, proof the trunk, access port, and DHCP scope all agree.
  2. Allowed path works. From the test device, the internet loads normally, proof the pass rule and routing work.
  3. Blocked path fails. From the test device, opening a known main-LAN service (the NAS file share, the router admin page) times out or is refused, proof the block rule is doing its job. Test the actual service, not just a ping: a firewall can block ping independently of everything else, so a failed ping alone proves nothing.
  4. Management still reachable. From the main-LAN computer, the router and switch admin pages still open, and a main-LAN device still reaches the internet, proof the rest of the network survived the change.

Record expected-versus-observed for each check in the plan document, and re-run the same four checks after any later change to ports, SSIDs, or rules. Segmentation drifts as devices move; the checklist is what keeps the boundary real.

If something breaks: the way back

No address on the test device: the three usual causes, in order, the VLAN ID differs between router and switch, the trunk port is not carrying VLAN 30, or the DHCP scope was never enabled. Address is right but no internet: the pass rule is missing, or it sits below a block rule that matches everything. IoT device can still reach the LAN: the block rule's destination is wrong (it should be the LAN net) or the pass rule is above it. Locked out of the switch entirely: the management port was moved onto the new VLAN before its gateway existed, reconnect from a port that is still on the main LAN, which is why step 6 exists; a factory reset is the last resort, not the first.

When to add the next VLAN

Add a segment only when a concrete need appears: a guest Wi-Fi that should see nothing but the internet, a lab segment for deliberately vulnerable practice machines that even the trusted network should not reach, or a management segment once there is enough network gear to manage. The decision rule is simple, a new VLAN earns its rules-and-scope upkeep when there is a named group of devices and a named thing they must not reach. Until then, one well-tested IoT VLAN beats six assumed ones.

FAQ

How many VLANs should a home lab have? As few as solve a real problem. One IoT segment covers the highest-risk devices; most labs eventually settle at three or four (main, IoT, guest, lab), added one at a time with the procedure above.

Can IoT devices on the VLAN still work with a phone app? Yes, in the common case: most smart-home gadgets talk to a vendor cloud service, and the phone reaches them through that cloud, not directly across the LAN. Devices that genuinely need a local path (some streaming and home-automation setups) need one narrow allow rule for that specific service, add it deliberately, above the block rule, and note it in the plan.

Does the existing router have to be replaced? Only if it cannot route tagged VLANs. The switch and the router are the two requirements; everything else, cables, devices, the ISP connection, stays as it is.

Next: Static IPs vs DHCP reservations in the home lab →