OPNsenseLab
Networking

OPNsense VLAN Configuration: Segment IoT, Guest, and Trusted Networks

How to create and enforce VLANs on OPNsense to isolate IoT devices, guest Wi-Fi, and your trusted LAN — with firewall rules that block inter-VLAN traffic by default.

By OPNsenseLab Editorial · · 8 min read

Proper network segmentation prevents your smart TV from talking to your NAS. This guide covers creating VLANs in OPNsense and the firewall rules that make segmentation actually work.

Design: Three-VLAN baseline

VLAN IDNameSubnetPurpose
10TRUSTED192.168.10.0/24Workstations, servers, phones you control
20IOT192.168.20.0/24Smart home devices, printers, cameras
30GUEST192.168.30.0/24Guest Wi-Fi — internet only

Step 1: Create VLANs

Interfaces → Other Types → VLAN → Add:

Repeat for VLAN 20 (IOT) and VLAN 30 (GUEST).

Step 2: Assign interfaces

Interfaces → Assignments → add each new VLAN interface. Then enable each:

Step 3: Firewall rules

IoT VLAN — block all inter-VLAN, allow internet

On the IOT interface:

Action: Block
Protocol: any
Source: IOT net
Destination: 192.168.0.0/8 (RFC1918 aggregate)
Description: Block IoT → private ranges
Action: Pass
Protocol: any
Source: IOT net
Destination: any
Description: Allow IoT → internet

Guest VLAN — internet only, block RFC1918

Same pattern as IoT, applied to the GUEST interface.

Trusted VLAN — full access

Allow all by default (or lock down as needed for your threat model).

Step 4: Test segmentation

From an IoT device, confirm:

ping 192.168.10.1   # Should fail (blocked by firewall rule)
curl https://example.com   # Should succeed

Managed switch tagging

If your switch is VLAN-aware (e.g., a UniFi switch), configure trunk ports carrying all VLANs to OPNsense and access ports assigning devices to the correct VLAN. The OPNsense VLAN sub-interfaces receive tagged traffic and route accordingly.

Running UniFi APs? See UniFiGuide for SSID-to-VLAN mapping in the Network Application.

#opnsense #vlan #network-segmentation #iot #firewall-rules

Related

Comments