Until this month everything at home lived on one network: laptops, phones, the TV, the robot vacuum and the lab. The vacuum talks to a cloud somewhere I have never been, and it sat on the same subnet as the Proxmox web interfaces. That bothered me more than it probably should have, so I split things up.
The plan
- VLAN 1, untagged: the home network, served by the ISP router as before. Nothing changes for the family.
- VLAN 20: lab VMs and containers.
- VLAN 30: anything that comes with an app. TV, vacuum, printer.
The ISP router knows nothing about VLANs, so routing for 20 and 30 is done by an OPNsense VM on the cluster, with its WAN side on the home network. Yes, that is double NAT for the lab. Nothing I run there cares.
Proxmox side
The bridge on every node becomes VLAN-aware. This is the whole change in /etc/network/interfaces:
auto vmbr0
iface vmbr0 inet static
address 192.168.1.11/24
gateway 192.168.1.1
bridge-ports eno1
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
ifreload -a applies it without a reboot. After that a VM gets its VLAN with one option on its network
card:
qm set 104 --net0 virtio,bridge=vmbr0,tag=20
Careful: that replaces the whole net0 line, MAC address included, unless you pass the old one again
(virtio=AA:BB:...). My DHCP reservation for that VM stopped matching and I spent ten minutes looking for it on
the wrong subnet.
The OPNsense VM gets a network card without a tag, so it sees the trunk, and the VLAN interfaces are created inside
OPNsense on top of vtnet0.
Switch side, and the lockout
The three ports to the mini PCs became trunks: VLAN 1 untagged, 20 and 30 tagged. The port to the access point carries 1 and 30 (the AP has a second SSID mapped to VLAN 30), and the TV port is untagged in 30.
Then I changed the PVID of the port my laptop was plugged into, on the switch I was configuring through that same port. The page stopped loading halfway through a click. The switch has no console port, so it was a paperclip reset and doing everything again, this time from a port that was not part of the change. Write the plan on paper, and leave one port out of it.
Doubts
The weak spot is obvious: when the node running OPNsense reboots, the TV loses its internet. The VM is set to start first on boot, and so far nobody has noticed. If they do, it will get a twin on another node with CARP, which I have read about but never set up.