Lesson 5 of 9 · 28m
VLANs and Router-on-a-Stick Without Folklore
Design tagged and untagged VLAN behavior, configure DSA or legacy switch syntax, and validate trunking with packet-level evidence.
VLAN advice on the Internet is often a pile of contradictory screenshots. The underlying idea is simple: Ethernet frames can carry a tag, switch ports decide which tagged or untagged traffic they accept and emit, and the router terminates selected VLANs as logical interfaces. The pain comes from hardware differences and changing six variables at once.
Start with policy, not syntax
A sane small-network design might be:
VLAN 10 trusted workstations 192.168.10.0/24
VLAN 20 IoT devices 192.168.20.0/24
VLAN 30 guests 192.168.30.0/24
VLAN 99 management 192.168.99.0/24Decide which ports are access ports and which are trunks. End devices normally connect to access ports emitting one untagged VLAN; trunks carry multiple tagged VLANs between switches, access points, and routers.
DSA-style bridge VLAN configuration
On modern DSA targets, use a bridge with VLAN filtering:
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
config bridge-vlan
option device 'br-lan'
option vlan '10'
list ports 'lan1:u*'
list ports 'lan2:t'Terminate layer-3 networks on VLAN devices such as br-lan.10, using static addresses like 192.168.10.1/24 for each segment.
Bridge VLAN entries control layer-2 membership; logical interfaces terminate layer-3 networks. Exact UCI details vary by release, but that separation does not.
Legacy swconfig mental model
Older targets expose switch VLANs directly, using t for tagged CPU and trunk ports; never copy those port numbers across models because case labels rarely match switch indexes.
Validate tags with evidence
Create a tagged interface on a Linux workstation and test the layer-3 gateway:
sudo ip link add link eth0 name eth0.20 type vlan id 20
sudo ip addr add 192.168.20.50/24 dev eth0.20
sudo ip link set eth0.20 up
ping 192.168.20.1
sudo tcpdump -eni eth0 vlan 20If tagged traffic leaves the workstation but never reaches the router, check trunk membership. If it reaches the router but no reply leaves, check addressing and input policy.
Field notes
u*means untagged and primary VLAN in common OpenWrt syntax; understand your release rather than memorizing glyphs.- One bad trunk can bridge supposedly isolated networks even when firewall rules are perfect.
- Keep a known untagged management access port while migrating VLANs.
- Label cables after validation. Labels written before validation are fiction.
- Do not tag an untrusted WAN VLAN into an internal bridge because a diagram looked symmetric.
Was this lesson helpful?